develooper Front page | perl.fwp | Postings from July 2002

Re: Sort is lazy?!? (as in Haskell)

Thread Previous | Thread Next
From:
Bart Lateur
Date:
July 19, 2002 14:18
Subject:
Re: Sort is lazy?!? (as in Haskell)
Message ID:
l70hjucvsf4dfush37fio7boaff5sfatqj@4ax.com
On Fri, 19 Jul 2002 07:42:53 -0400, Bernie Cosell wrote:

>Does a map in void context actually 
>happen?

LOL! That would have been fun...

No, void context is a special case for a scalar context, and map in a
scalar context has a specific use: it returns the number of items the
returned list would have had, had you not chosen to ignore it. (So it
acts a bit like an array.  -- Aw, who did that!)

map() in a normal scalar context most certainly does happen, and by
extrapolation, it does so for void context as well.

-- 
	Bart.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About