>>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:

  GB> On Wed, May 02, 2001 at 04:30:07PM +0100, Michael G Schwern wrote:
  >> On Wed, May 02, 2001 at 08:05:29AM -0700, Larry Wall wrote:
  >> > Michael G Schwern writes:
  >> > : (grep {...} @stuff)[0] will work, but its inelegant.
  >> > 
  >> > It's inelegant only because the slice doesn't know how to tell the
  >> > iterator it only needs one value.  If it did know, you'd call it
  >> > elegant.  :-)
  >> 
  >> I'd call it Haskel!  I've just installed it and have been skimming the
  >> docs.
  >> 
  >> Would be neat if:  my($first) = grep {...} @list;  knew to stop itself, yes.

  GB> Yes. This could probably fall out of the suggestion that wantarray
  GB> (or want) return how many elements are wanted in a list context

provided the list was literal. if it is created via a function or an
expression then you have to pass the laziness and wantarray count up the
line, etc. i don't know if we (or larry) wants to make all code have a
maximum iteration/count value implicitly passed into them and have such
lazy evaluation at all times.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html

Reply via email to