I just wanted to thank all of you for your insightful responses. This has been very useful! --Will K.
On Fri, Aug 13, 2010 at 3:21 PM, Will M. Farr <[email protected]> wrote: > +1 from me, too. I always have to check myself to remember that the foldl > accumulator argument comes in on the *right*. FWIW, OCaml also does it the > Haskell way (foldl accumulator on the left, foldr accumulator on the right). > > This also makes the obvious many-argument version more efficient: > > (define (foldl kons knil . lists) > (if (ormap null? lists) > knil > (apply foldl kons (apply kons knil (map car lists)) (map cdr lists)))) > > as opposed to > > (define (foldl* kons knil . lists) > (if (ormap null? lists) > knil > (apply foldl* kons (apply kons (append (map car lists) (list knil))) > (map cdr lists)))) > > The extra append is kinda annoying in the foldl* version.... > > Will > > On Aug 13, 2010, at 4:18 PM, Matthias Felleisen wrote: > > > > > I privately +1ed Joe, and I all supportive of introducing new folds and > phasing out the old ones. > > > > > > On Aug 13, 2010, at 4:04 PM, Sam Tobin-Hochstadt wrote: > > > >> On Fri, Aug 13, 2010 at 3:11 PM, Joe Marshall <[email protected]> > wrote: > >>> It seems to me that the Haskell version is better. > >> > >> The Haskell ordering also has the advantage of fitting with the Typed > >> Racket type system for variable-arity functions. > >> -- > >> sam th > >> [email protected] > >> _________________________________________________ > >> For list-related administrative tasks: > >> http://lists.racket-lang.org/listinfo/users > > > > _________________________________________________ > > For list-related administrative tasks: > > http://lists.racket-lang.org/listinfo/users > > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

