I see.

I tried to add more nested elements into my original structure but now the 
output isn't correct.

My question is:

Is it possible to implement a generic algorithm with Zippers that could 
traverse as long as needed and update an item? Maybe I'm doing zippers 
wrong in this case.

Thanks a lot for your time and your helpful answers. Now I started to 
understand zippers, thanks to you.


On Monday, August 24, 2015 at 7:36:17 PM UTC+2, Moe Aboulkheir wrote:
>
> Hussein, 
>
>
> On Mon, Aug 24, 2015 at 5:40 PM, Hussein B. <hubag...@gmail.com 
> <javascript:>> wrote: 
>
> > But now the updated children is using list notation, not vector. Is it 
> ok or 
> > it is for displaying purposes? 
>
> The collection type is now different, as the example I gave uses 
> "reverse" as the transform, which is a generic sequence function - it 
> doesn't care that it was passed a vector.  It may not matter - it 
> depends on how you're using the sequences.  In this specific case, 
> modifying the transform in the example to #(update % "children" (comp 
> vec reverse)) will result in a vector, though there are more general 
> ways of doing this without baking the collection type in everywhere 
> (into (empty x) (reverse x)). 
>
> Take care, 
> Moe 
>

-- 
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/d/optout.

Reply via email to