Michael G Schwern <[EMAIL PROTECTED]> writes:

> 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!

That's "Haskell", for anyone Googling.

>  I've just installed it and have been skimming the
> docs.

I eagerly anticipate a workable proposal for "monadic <>" (hopefully :-)

> 
> 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.

But it would need a completely different algorithm.  Which is not too
bad.  And even

    my ($first, $second, $third) = sort {...} @list;

is kind-of plausible.  So we'd definitely want

    ((undef)x((@list+1)/2), $median) = sort {...} @list;

to apply Perl's patented MindReader(tm) technology and run a median
algorithm.  Wait, that last one's probably a bit too far-fetched...
-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658117 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to