<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 22, 2014 at 12:10 AM, Phil Xiaojun Hu <span dir="ltr"><<a href="mailto:phil@cnphil.com" target="_blank">phil@cnphil.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":168" class="a3s" style="overflow:hidden">Think of a network socket as the source of your list, and the first<br>
character is all you need. If you need to evaluate the second character<br>
to get the first, you could be stuck on the network socket for some<br>
time waiting for the second one to come.</div></blockquote></div><br>That's more of a time leak. I think the space leak aspect comes from the fact that you've evaluated a second list element that was not requested, may never be used, and will be held in the heap until all shared consumers of the list go out of scope. (It may of course also be a time leak if computing that second element is expensive.)<br clear="all"><div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</div></div>