Re: [Haskell-cafe] reverse with foldl

21 Sep
21 Sep
10:17 a.m.
New subject: reverse with foldl
Prelude> :t foldl (\x -> \xs -> xs:x) []
foldl (\x -> \xs -> xs:x) [] :: [b] -> [b]
Strange choice of names, though, since x is a list, and xs is an
element. I would have gone for:
foldl (\xs x -> x:xs) []
although the library opts for:
foldl (flip (:)) []
On 21/09/2007, Miguel Mitrofanov
reverse = foldl (\x -> \xs -> xs:x) []
Doesn't typecheck. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
6453
Age (days ago)
6453
Last active (days ago)
1 comments
2 participants
participants (2)
-
Miguel Mitrofanov
-
Rodrigo Queiro