On 9/23/07, Thomas Hartman <[EMAIL PROTECTED]> wrote:
> -- this is the usual implementation right?
> myreverse xs = foldl f [] xs
>   where f accum el = el : accum

This is often written

  reverse = foldl (flip (:)) []

which I quite like, because you can contrast it with

  foldr (:) []

which of course is just a type-restricted version of id.


Stuart
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to