[Haskell-cafe] Laziness question
nowgate at yahoo.com
Sat Jul 31 15:11:25 EDT 2010
Thanks, everyone, for your patience. You've been VERY helpful. Great list!
--- On Sat, 7/31/10, Brandon S Allbery KF8NH <allbery at ece.cmu.edu> wrote:
From: Brandon S Allbery KF8NH <allbery at ece.cmu.edu>
Subject: Re: [Haskell-cafe] Laziness question
To: haskell-cafe at haskell.org
Date: Saturday, July 31, 2010, 2:29 PM
-----BEGIN PGP SIGNED MESSAGE-----
On 7/31/10 14:24 , michael rice wrote:
> Are you saying:
> [ head x ] -> [ *thunk* ] and length [ *thunk* ] -> 1, independent of
> what *thunk* is, even head , i.e., *thunk* never needs be evaluated?
Exactly. (I was being cagey because the first response was cagey, possibly
suspecting a homework question although it seems like an odd time for it.)
length not only does not look inside of the thunk, it *can't* look inside
it; all it knows is that it has a list, it specifically does *not* know what
that list can hold. So the only thing it can do is count the number of
"unknown somethings" in the list.
brandon s. allbery [linux,solaris,freebsd,perl] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe