specter

Latest version: 1.1.3
nathanmarz 2018-06-14T03:23:05.000160Z

@jsa-aerial with walker it's:

(let [replacements {:b 77 :x :xxx}]
  (transform [(walker (complement coll?)) #(contains? replacements %)]
    replacements
    data
    ))

nathanmarz 2018-06-14T03:23:20.000213Z

better than doing recursion manually in my opinion

jsa-aerial 2018-06-14T05:09:50.000235Z

💯 ah...

lispyclouds 2018-06-14T15:24:20.001015Z

Hello, I have the following structure

lispyclouds 2018-06-14T15:25:35.000629Z

and a function (get-details) which does url -> [detailed-url1, detailed-url2 …]

lispyclouds 2018-06-14T15:25:53.000249Z

What i need is the following

lispyclouds 2018-06-14T15:26:59.000325Z

This is what Im using currently

(defn categorized-urls []
  (->> (input)
       (transform [ALL MAP-VALS ALL MAP-VALS ALL] get-details)
       (transform [ALL MAP-VALS ALL MAP-VALS] flatten)))

lispyclouds 2018-06-14T15:27:16.000992Z

Is there a better way?

lispyclouds 2018-06-14T15:29:41.000645Z

The input structure is pretty huge and its taking a while to execute this. Was wondering there might be a better way than twice transforms.

nathanmarz 2018-06-14T15:42:59.000789Z

@rahul080327 this will speed it up:

(defn categorized-urls [input]
  (multi-transform
    [ALL
     MAP-VALS
     ALL
     MAP-VALS
     (multi-path
       [ALL (terminal get-details)]
       (terminal #(into [] (mapcat identity) %)))]
    input))

nathanmarz 2018-06-14T15:43:14.000836Z

traverses the data structure once instead of twice

lispyclouds 2018-06-14T15:48:10.000143Z

Ahan thanks a lot @nathanmarz superb 😃