[Haskell-cafe] Laziness question

Albert Y. C. Lai trebla at vex.net
Sat Jul 31 13:47:39 EDT 2010


On 10-07-31 01:30 PM, Brandon S Allbery KF8NH wrote:
> On 7/31/10 12:59 , michael rice wrote:
>> But since both still have eval x to *thunk* : *thunk*,  g evaluates "to a
>> deeper level?"
>
> The whole point of laziness is that f *doesn't* have to eval x.

To elaborate, in computer-friendly syntax:

f x = length (red_herring : [])

length cares about cons cells (:) and nil [] only. You have already 
hardcoded exactly those. Enough said... err, enough evaluated.


More information about the Haskell-Cafe mailing list