I've seen postwalk and prewalk but never really played around with them so 
I will give it a shot.

Thanks for your input!

Ryan

On Tuesday, December 10, 2013 10:29:51 AM UTC+2, Jeroen van Dijk wrote:
>
> Don't forget about the option of walking over a map by using 
> clojure.walk/postwalk or clojure.walk/prewalk
>
> I use these functions often lately. Especially useful if you have to 
> update values in your map and they could occur anywhere. It is a bit tricky 
> to get working at first, because the return value of each step needs to 
> match the structure that is currently walked. For that reason you sometimes 
> need to switch between a postwalk instead of a prewalk etc.
>
> Try this for a demo
>
> (def m
>   {"outerKeyA" {:innerKeyA {"string id" {:foo 1 :bar 2}}}
>    "outerKeyB" {:innerKeyB {"string id" {:bar 5 :baz 10}}}})
>
> (clojure.walk/postwalk-demo m)
>
>
>
>
> On Thu, Dec 5, 2013 at 11:06 AM, Ryan <areka...@gmail.com <javascript:>>wrote:
>
>> Thanks guys for the useful answers :)
>>
>> Ryan
>>
>>
>> On Wednesday, December 4, 2013 1:27:57 AM UTC+2, James Ferguson wrote:
>>>
>>> `update-in` could be helpful, depending on what exactly you're doing.
>>>
>>> (doseq [keyA keys, keyB otherkeys]
>>>   (update-in m [keyA keyB] some-function))
>>>
>>> On Tuesday, December 3, 2013 6:05:14 PM UTC-5, Ryan wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I am trying to figure out a better way to loop the following map than 
>>>> using nested doseq. The map has the following structure:
>>>>
>>>> (def m
>>>>>   {"outerKeyA" {:innerKeyA {"string id" {:foo 1 :bar 2}}}
>>>>>    "outerKeyB" {:innerKeyB {"string id" {:bar 5 :baz 10}}}})
>>>>
>>>>
>>>> So, right now i am doing the following:
>>>>
>>>> (doseq [[outer-keys collections] m]
>>>>>   (doseq [[collection-name collection] collections]
>>>>>     (doseq [[string-id data] collection]
>>>>>       ;; do stuff with all the above 
>>>>> )))
>>>>
>>>>
>>>> Is there a more idiomatic/better way to do deeply nested 
>>>> iterations/traversal of map of maps?
>>>>
>>>> Thank you for any replies!
>>>>
>>>> Ryan 
>>>>
>>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to