On (03 May 2001 10:23:15 +0300) you wrote:
> Michael Schwern:
> >
> > 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
> > 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
From: "Alexander Farber (EED)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2001 5:13 AM
Subject: Please make "last" work in "grep"
> Here I am looking for a button with a special name - "Delete ..." -
> and the
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 nee
[EMAIL PROTECTED] writes:
:> >Hopefully the "something similar", I hope in Perl 6 we will able to
:> >bury the "0 but true" workaround to the backyard on a moonless night :-)
:>
:> Especially since you don't need it. "0E0" and "0.", to name just two,
:> work just as well. ;-
Graham Barr wrote:
> How this cooperates with lazy is a different matter entirely.
>
> Graham.
http://dev.perl.org/rfc/123.html#Assigning_from_lazy_lists
suggests that assigning to a sized busy array from a lazy array will
fill it and stop.
--
David Nicol 816.235.1187 [
At 06:06 AM 5/3/2001 +1000, Damian Conway wrote:
>> >Hopefully the "something similar", I hope in Perl 6 we will able to
>> >bury the "0 but true" workaround to the backyard on a moonless
> night :-)
>>
>> Especially since you don't need it. "0E0" and "0.", to name just two,
>
> >Hopefully the "something similar", I hope in Perl 6 we will able to
> >bury the "0 but true" workaround to the backyard on a moonless night :-)
>
> Especially since you don't need it. "0E0" and "0.", to name just two,
> work just as well. ;-)
http://yetanother.org/damian/Perl
> > Because you might have a wantarray situation that expects no values?
> >
> > () = whateveryouwant();
>
> I am sure that situation is handled by the 'want' RFC.
Yep. The most recent version is at:
http://www.yetanother.org/damian/Perl5+i/want.html
> I have not re
On Wed, 2 May 2001 11:41:32 -0500, Jarkko Hietaniemi wrote:
>but I suspect in this case want('LIST') would
>> return that magical "0 but true" or something similar.
>
>Hopefully the "something similar", I hope in Perl 6 we will able to
>bury the "0 but true" workaround to the backyard on a moonle
At 09:58 AM 5/2/2001 -0700, Larry Wall wrote:
>Dan Sugalski writes:
>: I'd really like to get into the details of what is and isn't valid for the
>: optimizer to do, though I expect it's still a little early in the
>: Apocalypse season for that.
>
>Doubtless we'll do as other compilers do, and hav
Dan Sugalski writes:
: I'd really like to get into the details of what is and isn't valid for the
: optimizer to do, though I expect it's still a little early in the
: Apocalypse season for that.
Doubtless we'll do as other compilers do, and have a little knob you
just keep turning up until som
Bart Lateur writes:
: Because you might have a wantarray situation that expects no values?
:
: () =3D whateveryouwant();
:
: You can always expect one more than is on the LHS.
:
: How is this currently handled with split()?
It fakes up a third argument that is one more than the length of
Michael G Schwern wrote:
> If we could determine if the block has no side effects... oh wait,
> everything in Perl has a side effect. ;)
:pure (again!)
--
John Porter
At 09:29 AM 5/2/2001 -0700, Larry Wall wrote:
>H.Merijn Brand writes:
>: wanting the side effects of grep/map finishing over all elements (which
>could
>: of course be from a tied array or database connection)
>
>If we do that kind of optimization, then we would certainly provide
>some kind of ea
On Wed, May 02, 2001 at 05:36:11PM +0100, Graham Barr wrote:
> On Wed, May 02, 2001 at 06:29:51PM +0200, Bart Lateur wrote:
> > On Wed, 2 May 2001 17:05:31 +0100, Graham Barr wrote:
> >
> > >wantarray-ness is already passed along the call stack today. Thats
> > >the whole point of it. So what is
On Wed, May 02, 2001 at 06:29:51PM +0200, Bart Lateur wrote:
> On Wed, 2 May 2001 17:05:31 +0100, Graham Barr wrote:
>
> >wantarray-ness is already passed along the call stack today. Thats
> >the whole point of it. So what is the difference in passing a number
> >instead of a boolean ?
>
> Becau
H.Merijn Brand writes:
: On Wed, 2 May 2001 08:05:29 -0700 (PDT), Larry Wall <[EMAIL PROTECTED]> 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 on
On Wed, 2 May 2001 17:05:31 +0100, Graham Barr wrote:
>wantarray-ness is already passed along the call stack today. Thats
>the whole point of it. So what is the difference in passing a number
>instead of a boolean ?
Because you might have a wantarray situation that expects no values?
()
On Wed, May 02, 2001 at 06:05:54PM +0200, H. Merijn Brand wrote:
> IIRC, that optimization is not even considered for reasons of many people
> wanting the side effects of grep/map finishing over all elements (which could
> of course be from a tied array or database connection)
If we could determi
On Wed, 2 May 2001 08:05:29 -0700 (PDT), Larry Wall <[EMAIL PROTECTED]> 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 cal
On Wed, May 02, 2001 at 12:01:24PM -0400, Uri Guttman wrote:
> > "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:
>
> "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.
>> >
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
> >
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. :-
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. :-)
Larry
Michael G Schwern wrote:
> And I'm quite sure there's an RFC for doing something like this alread
> up for Perl 6.
At least RFC 199, and several related threads
such as "$a in @b".
--
John Porter
It's so mysterious, the land of tears.
On Wed, May 02, 2001 at 11:10:22AM +0100, Michael G Schwern wrote:
> On Wed, May 02, 2001 at 11:13:13AM +0200, Alexander Farber (EED) wrote:
> > I would like to propose adding the "last" statement
> > to the "grep", which currently doesn't work:
>
> For the record, I have no problem with this. :)
On Wed, May 02, 2001 at 11:13:13AM +0200, Alexander Farber (EED) wrote:
> I would like to propose adding the "last" statement
> to the "grep", which currently doesn't work:
For the record, I have no problem with this. :)
> maas34: perl -e 'grep { print and $_ == 3 and last } (1,2,3,4,5)'
>
Hi,
I would like to propose adding the "last" statement
to the "grep", which currently doesn't work:
maas34: perl -e 'grep { print and $_ == 3 and last } (1,2,3,4,5)'
123
Can't "last" outside a loop block at -e line 1.
This way it would be possible to use such constructs:
print_header
30 matches
Mail list logo