You are viewing a single comment's thread. Return to all comments →
Or, with flip:
rev = foldl (flip (:)) 
Although, this is pretty advanced since we're making use of higher order functions already.
Deriving the 'inefficient' solution first, before learning why it's inefficient is the way to go.
yet I read on haskell.org/prelude, "Also note that if you want an efficient left-fold, you probably want to use foldl' instead of foldl." So maybe this isn't that efficient? Can you say a word about this? (I'm a complete newbie... :-))