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.
It also reminds me of mjd's mention of: my($first) = sort {...} @list;
being O(n) if Perl were really Lazy.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
I have this god-awful need to aquire useless crap!!!
- Please make "last" work in "grep&quo... Alexander Farber (EED)
- Re: Please make "last" work in "... James Mastros
- Re: Please make "last" work in "... Michael G Schwern
- Re: Please make "last" work in &... Graham Barr
- Re: Please make "last" work in &... John Porter
- Re: Please make "last" work in "... Larry Wall
- Re: Please make "last" work in "... Michael G Schwern
- Re: Please make "last" work in "... Graham Barr
- Re: Please make "last" work in "... Uri Guttman
- Re: Please make "last" work in "... Graham Barr
- Re: Please make "last" work in &... David L. Nicol
- Re: Please make "last" work in "... H . Merijn Brand
- Re: Please make "last" work in "... Michael G Schwern
- Re: Please make "last" work in &... John Porter
- Re: Please make "last" work in "... Bart Lateur
- Re: Please make "last" work in &... Larry Wall
- Re: Please make "last" work in &... Damian Conway
