17 Jun
2009
17 Jun
'09
4:55 p.m.
On Wed, Jun 17, 2009 at 1:07 PM, Henk-Jan van Tuyl
On Wed, 17 Jun 2009 10:38:23 +0200, Yitzchak Gale
wrote: An improved reverse function: reverse' = foldl' (flip (:)) [] There is no need for reverse to be lazy, so this one could replace the original one. reverse' is not too strict: Data.List> let reverse' = foldl' (flip (:)) [] in head $ reverse' [undefined, 1] 1
Since reverse' is polymorphic in the type of list elements, the only way it could be strict in the *elements* is if it applied seq to them. --Max