On Sun, Nov 7, 2010 at 3:04 AM, Laurent PETIT <[email protected]> wrote: > 2010/11/7 Alan <[email protected]>: >> Clojure's reduce is fold-left, not fold-right. My suspicion is that >> fold-right is not as amenable to laziness or to tail-call recursion as >> fold-right, but I don't have much experience in the area so I could be >> wrong. >> >> What I'm surprised we're missing is unfold, not foldr: unfold is easy >> to define lazily, and foldr can often be replaced with foldl. > > There's iterate, which seems to be like unfold (minus the recursion > stopping predicate)
And then there's (take-while #(not (stop-pred %)) (iterate f start)). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
