Lennart Augustsson wrote:
Even so, it's instructive to study how the normal order reduction of
this expression would proceed under the assumption that all 4 elements
will be used.
I think it's useful to try normal order until weak head normal form.
Not all steps are shown. Definitions of take, map, zipWith are taken
from the Haskell 98 Report. Whenever you see me expanding a parameter,
it is because some function's pattern matching forces it.
(take 4 . map (>0)) (f s t)
take 4 (map (>0) (f s t))
take 4 (map (>0) (zipWith (-) s t))
take 4 (map (>0) (zipWith (-) (2:t) (3:s)))
take 4 (map (>0) ( 2-3 : zipWith (-) t s ))
take 4 ( 2-3>0 : map (>0) (zipWith (-) t s) )
2-3>0 : take (4-1) (map (>0) (zipWith (-) t s))
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe