On Jul 27, 11:57 am, Aaron Cohen <[email protected]> wrote: > On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson <[email protected]> wrote: > > On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen <[email protected]> wrote: > > > I may be wrong, but don't you need to swap the order of the arguments to > > f? > > > You can do that by writing f itself appropriately. Usually either it > > will be a closure or it won't matter (core +, etc.). > > If the order of evaluation doesn't matter, you should probably just be using > reduce in the first place.
I wrote my foldr to swap the order of arguments to f, but I think Ken's right not to. Having acc be on the right is a good reminder that you're folding right, and makes some of the most common patterns, like (cons x acc) look natural. -- 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
