2010/11/7 Alan <a...@malloys.org>: > 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) > > On Nov 6, 6:33 pm, Michel Alexandre Salim <michael.silva...@gmail.com> > wrote: >> On Fri, 05 Nov 2010 19:03:20 -0700, Yang Dong wrote: >> > Maybe because Clojure has a vector, and conj conjoins new elements to >> > the end of the vector, so there's mere little use of fold-right. But, >> > fold-right is an abstraction tool, missing it in the core is kind of >> > pity. >> >> fold-right and reduce-right are both called reduce in >> Clojure:http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ >> reduce >> >> Regards, >> >> -- >> Michel Alexandre Salim, MSc., University of Erlangen-Nuremberg >> Open Source Research Group, Applied Software Engineering >> Web:http://osr.cs.fau.de, Email: michel.sa...@cs.fau.de >> GPG key ID: D09272F7 >> >> () ascii ribbon campaign - against html e-mail >> /\ www.asciiribbon.org - against proprietary attachments > > -- > 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 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