as it always happens.. I figured the problem as soon as I posted it . I just had to replace the branch? function from "(constantly true) with identity . The problem was it was treating even nil values as valid nodes and hence getting into an infinite loop.
Sorry for this. Thanks again, Sunil. On Fri, Aug 26, 2011 at 12:52 PM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hello everybody, > I am trying to figure out how to use the zippers. And I wrote the > following code > > https://gist.github.com/1172883 > > It seems to get in-to an infinite loop ..can somebody help me figure it > out. The purpose of the last s-expression is to simply return a new "s" > where all the values stored in :val is incremented by one. The reason that > the branch? function is "(constantly true)" is because it is asked to return > true for any node that can be potentially a branch whether it has any > children or not. As you can notice, each node has 3 fields ( :val :l (left) > :r (right) ) . The children function is simply returning the non-nil > sequence of nodes at :l and :r. > Hoping somebody can help me with this. > > Thanks, > Sunil. > -- 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