[Haskell-cafe] Laziness question
michael rice
nowgate at yahoo.com
Sat Jul 31 15:11:25 EDT 2010
Subtle stuff.
Thanks, everyone, for your patience. You've been VERY helpful. Great list!
Michael
--- 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-----
Hash: SHA1
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/
iEYEARECAAYFAkxUa54ACgkQIn7hlCsL25XVpgCeIxWwVWhjYQQ86uE2JeJD7mCB
mKUAn3WwhrgrYyudv/E8pn5a0HB4gLA9
=H++/
-----END PGP SIGNATURE-----
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100731/68f33338/attachment.html
More information about the Haskell-Cafe
mailing list