
22 Jun
2007
22 Jun
'07
7:13 p.m.
Chris Kuklewicz wrote:
Specifically it is graph reduced like this:
or [F,T,F,F...]
foldr (||) F [F,T,F,F...]
F || foldr (||) F [T,F,F...]
foldr (||) F [T,F,F...]
T || foldr (||) F [F,F...]
T
The last line is because (T || _ = T) and lazyness
I must sheepishly confess that I mistakenly throught that foldr would construct a chaint chain of ORs, which would then only be evaluated when it's returned. Now I see why there's a strict version of foldl but *not* foldr... ;-)