Please make "last" work in "grep"
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 ($query); if ($but and not check_pass ($pass)) { print abstract (q{Wrong password ... } elsif ($but eq 'Create' and $proj and $sub and $pack and $prel) { insert_update_pack ($dbh, $proj, $sub, $pack, $prel); } elsif (grep { /^Delete\s+([\w.-]+)\|([\w.-]+)\|([\w.-]+)\|([\w.-]+)$/ and $query -> param ($_) eq 'Delete' and last } $query -> param) { delete_pack ($dbh, $1, $2, $3, $4); } else { print abstract (q{Please specify a project and ... } Here I am looking for a button with a special name - "Delete ..." - and there can be only one such button, so I have to interrupt the "grep" after I find it (otherwise the $1, $2, $3, $4 might be unset). I have to do it this strange way (using NAME and not the VALUE of an HTML submit-button), because the VALUE is shown as the label of the button (and I want it to show just "Delete", not "Delete CAPC|blah...") Regards Alex
Re: Please make "last" work in "grep"
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)' > 123 > Can't "last" outside a loop block at -e line 1. > > This way it would be possible to use such constructs: FYI, its not hard to write a routine to do just that... first { some_condition } @stuff; sub first (&@) { my($cond, @stuff) = @_; my $first; foreach (@stuff) { if( &$cond ) { $first = $_; last; } } return $first; } print first { $_ > 5 } 1..10; 6 And I'm quite sure there's an RFC for doing something like this alread up for Perl 6. > Here I am looking for a button with a special name - "Delete ..." - > and there can be only one such button, so I have to interrupt the > "grep" after I find it (otherwise the $1, $2, $3, $4 might be unset). (grep {...} @stuff)[0] will work, but its inelegant. -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Maybe they hooked you up with one of those ass-making magazines. -- brian d. foy as misheard by Michael G Schwern
Re: Please make "last" work in "grep"
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. :) > > > > 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: > > FYI, its not hard to write a routine to do just that... > > first { some_condition } @stuff; See List::Util in perl-current =item first BLOCK LIST Similar to C in that it evaluates BLOCK setting C<$_> to each element of LIST in turn. C returns the first element where the result from BLOCK is a true value. If BLOCK never returns true or LIST was empty then C is returned. $foo = first { defined($_) } @list# first defined value in @list $foo = first { $_ > $value } @list# first value in @list which # is greater than $value Graham.
Re: Please make "last" work in "grep"
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.
Re: Please make "last" work in "grep"
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
Re: Please make "last" work in "grep"
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!!!
.NET
I've been recently looking over the specification for C# and the .NET platform (and falling for very little of the verbage: almost every line of the first chapter of book I'm reading contains at least one oxymoron), and am seeing some similarities between some of the proposed goals of Perl 6 and the .NET platform. The "one IL fits all languages" type of thing, distributed objects, and many things in .NET have been discussed similarly here. Larry, et. al.: Is this similarity on purpose? If so, we'll be stopping short of insanity and complete oxymoronity, right? By the sound of it, by the time we're done with Perl 6, we'll have a major competitor to the .NET platform itself, even more so than Java is a competitor. Or are we thinking of a merge? Or are we thinking on a totally separate line that just has a few similarities? Everyone else: Comments? David T. Grove [EMAIL PROTECTED]
Re: Please make "last" work in "grep"
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. Yes. This could probably fall out of the suggestion that wantarray (or want) return how many elements are wanted in a list context Graham.
Re: Please make "last" work in "grep"
> "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
Re: Please make "last" work in "grep"
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: > >> > : (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. 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 ? How this cooperates with lazy is a different matter entirely. Graham.
Re: .NET
David Grove writes: : Larry, et. al.: Is this similarity on purpose? Yes, but only becase .NET is a VM, not because it's from MicroSoft. The basic goal is to have a Perl VM that can sit easily on other VMs, whether .NET's or Java's or our own. Another example of competing by cooperating, which Perl has always done. Larry
Re: Please make "last" work in "grep"
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 call it > elegant. :-) 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) -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Please make "last" work in "grep"
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 determine if the block has no side effects... oh wait, everything in Perl has a side effect. ;) -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/ Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One I was *meant* to mount your donuts.
Re: Please make "last" work in "grep"
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? () = whateveryouwant(); You can always expect one more than is on the LHS. How is this currently handled with split()? -- Bart.
Re: Please make "last" work in "grep"
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 one value. If it did know, you'd call it : > elegant. :-) : : IIRC, that optimization is not even considered for reasons of many people Whoever it is that is not considering it does not include me. :-) : 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 easy syntax to defeat it. But I'd say that, by and large, it's precisely when you're dealing with a slow database connection that you could use all the clever optimization you can get, because the unintended work gets magnified along with the intended, and the stakes are higher. Larry
Re: Please make "last" work in "grep"
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 ? > > Because you might have a wantarray situation that expects no values? > > () = whateveryouwant(); I am sure that situation is handled by the 'want' RFC. I have not read it recently, but I suspect in this case want('LIST') would return that magical "0 but true" or something similar. > You can always expect one more than is on the LHS. > > How is this currently handled with split()? split is special cased when it's assignment is directly to a list of known length. The current perl does not pass wanted list lengths around. Graham.
Re: Please make "last" work in "grep"
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 the difference in passing a number > > >instead of a boolean ? > > > > Because you might have a wantarray situation that expects no values? > > > > () = whateveryouwant(); > > I am sure that situation is handled by the 'want' RFC. I have not > read it recently, 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 moonless night :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Please make "last" work in "grep"
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 easy syntax to defeat it. There are a lot of side-effect things that I'd personally love to be able to optimize out, and this is one of them. Generally speaking, I think that operations on or involving a variable should be up for grabs to the optimizer unless there are some lexically visible hints that say otherwise. Which means that this: sub foo { my @bar; @bar = grep {/foo/} @_; return; } foo(bar()); would get chewed up by the optimizer such that the foo sub became a noop, and the resulting code was the same as: bar(); and that this: foo(@bar, $baz); would be a complete noop unless @bar or $baz had some sort of attribute on them that forced their evaluation. Same thing with: foreach (1..100) { $foo = $_; } should get turned into: $foo = 100; barring any explicit reason that it shouldn't. (Like the compiler sees that $foo has the no-short-circuit attribute or something) 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. Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: .NET
David Grove wrote: > am seeing some similarities between some of the proposed goals of > Perl 6 and the .NET platform. > . . . many things in .NET have been discussed similarly here. That's because .NET attempts to address real-world issues. The goals of .NET are not evil in and of themselves, you know. > distributed objects, I don't recall discussion of this wrt perl6, frankly. > Or are we thinking on a totally separate line that just has a > few similarities? Yes. Do you feel better now? -- John Porter It's so mysterious, the land of tears.
Re: Please make "last" work in "grep"
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
Re: Please make "last" work in "grep"
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 the list. In Perl 6, we'll have a unary * that (in an lvalue or formal parameter) marks the following item as a "slurper". So in a list assignment, these work differently: (@a, @b, @c) = ...; # provides 3 scalar contexts (@a, @b, *@c) = ...;# provides 2 scalar and 1 list context So by analogy, we could conceivably have: ($a, $b, $c) = split; # splits in 3 spots ($a, $b, *$rest) = split; # splits in 2 spots But what that would mean in a formal parameter list, I have no idea. So * on a scalar might not fly in general. A unary * in rvalue context defeats signature checking for the rest of the arguments in the list. So Perl 5's: &foo(@list) would likely be translated to Perl 6's: foo(*@list) Larry
Re: Please make "last" work in "grep"
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 something breaks, and then you back it off a notch and think no more about it. Larry
Re: .NET
At 12:54 PM 5/2/2001 -0400, John Porter wrote: >David Grove wrote: > > distributed objects, > >I don't recall discussion of this wrt perl6, frankly. I've mumbled about it on and off. I'd like to be able to do: $foo = new Bar; print SOCKET serialze($foo); and on the other end do: $foo = unserialize(); $foo->bar(); I don't know that much has been made of it yet. Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Please make "last" work in "grep"
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 have a little knob you >just keep turning up until something breaks, and then you back it off >a notch and think no more about it. While I've no doubt we will, given the varied uses that tied, overloaded, and custom-vtable variables are (or will) get put to, I wouldn't be at all surprised to find programs that should be compiled will full massive optimizations but still skip a good portion of them for code operating on specific variables. Seems to make sense to be able to put an attribute of some sort on a package to give the compiler a heads up that variables of that type should be considered the equivalent of C's volatile type. Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: .NET
> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: DS> I've mumbled about it on and off. I'd like to be able to do: DS>$foo = new Bar; DS>print SOCKET serialze($foo); DS> and on the other end do: DS>$foo = unserialize(); DS>$foo->bar(); DS> I don't know that much has been made of it yet. well, Data::Dumper/eval does this kinda and the new Denter (from the creator of InLine) does it too and probably better. the biggest problem is marking the boundaries of multiple serialized thingies on the pipe and doing the proper i/o and buffering that entails. i have done the same stuff for stem and it is not difficult but not trivial either. i think it would be best to support a decent (un)serializer in a standard module and let another module handle the i/o and buffering stuff. then you can use them in different ways such as saving the serialized data in a DB or a file instead of only sending over a socket. also dealing with sending object thingies over a socket is a perfect thing to do with an event loop. just had to bring that up again. :) 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
Re: .NET
Dan Sugalski wrote: > I'd like to be able to do: >$foo = new Bar; >print SOCKET serialze($foo); > and on the other end do: >$foo = unserialize(); >$foo->bar(); I personally am a big fan of Obliq semantics. It's something I'd really like to see in perl. -- John Porter It's so mysterious, the land of tears.
Re: Please make "last" work in "grep"
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 moonless night :-) Especially since you don't need it. "0E0" and "0.", to name just two, work just as well. ;-) -- Bart.
Re: Serialization
Taking a page from JavaScript, it would be nice in the same vein to be able to access the "context" (stack frame type context, not scalar/list type context) of a method, either running or not. The idea is that if the information was available, a module could start multiple threads, spawn them across more than one machine, etc. (Think of one of those db server "dashboard" arrangements, or of [EMAIL PROTECTED]) This would need some way of asking for the current namespace/environment/stack context so that it could be serialized. =Austin --- Uri Guttman <[EMAIL PROTECTED]> wrote: > > "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: > > DS> I've mumbled about it on and off. I'd like to be able to do: > > DS>$foo = new Bar; > DS>print SOCKET serialze($foo); > > DS> and on the other end do: > > DS>$foo = unserialize(); > DS>$foo->bar(); > > DS> I don't know that much has been made of it yet. > > well, Data::Dumper/eval does this kinda and the new Denter (from the > creator of InLine) does it too and probably better. the biggest > problem > is marking the boundaries of multiple serialized thingies on the pipe > and doing the proper i/o and buffering that entails. i have done the > same stuff for stem and it is not difficult but not trivial either. i > think it would be best to support a decent (un)serializer in a > standard > module and let another module handle the i/o and buffering stuff. > then > you can use them in different ways such as saving the serialized data > in > a DB or a file instead of only sending over a socket. > > also dealing with sending object thingies over a socket is a perfect > thing to do with an event loop. just had to bring that up again. :) > > 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 = Austin Hastings Global Services Consultant Continuus Software Corporation [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: .NET
DS> At 12:54 PM 5/2/2001 -0400, John Porter wrote: >> David Grove wrote: >> > distributed objects, >> >> I don't recall discussion of this wrt perl6, frankly. DS> I've mumbled about it on and off. I'd like to be able to do: DS>$foo = new Bar; DS>print SOCKET serialze($foo); DS> and on the other end do: DS>$foo = unserialize(); DS>$foo->bar(); You can serialize/deserilize object with Storable $foo = new Bar store_fd $foo, \*SOCKET; and on the other end $foo = retrieve_fd \*SOCKET; $foo->bar; It will work if you have Bar module on both ends. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | Ilya Martynov (http://martynov.org/)| | GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 | | AGAVA Software Company (http://www.agava.com/) | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Re: .NET
At 09:30 PM 5/2/2001 +0400, Ilya Martynov wrote: >DS> At 12:54 PM 5/2/2001 -0400, John Porter wrote: > >> David Grove wrote: > >> > distributed objects, > >> > >> I don't recall discussion of this wrt perl6, frankly. > >DS> I've mumbled about it on and off. I'd like to be able to do: > >DS>$foo = new Bar; >DS>print SOCKET serialze($foo); > >DS> and on the other end do: > >DS>$foo = unserialize(); >DS>$foo->bar(); > >You can serialize/deserilize object with Storable > >$foo = new Bar >store_fd $foo, \*SOCKET; > >and on the other end > >$foo = retrieve_fd \*SOCKET; >$foo->bar; > >It will work if you have Bar module on both ends. Right, but I want it to work if you don't... Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Please make "last" work in "grep"
> > 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 read it recently, but I suspect in this case > want('LIST') would return that magical "0 but true" or something > similar. No. It provides this information as (want)[1] or want->{COUNT}. But more frequently, the programmer herself would provide the information: if (want 3) {...} Damian
Re: Please make "last" work in "grep"
> >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/Perl5+i/control.html#Any_value_can_be_true_or_false ;-) Damian
Re: Please make "last" work in "grep"
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, >> work just as well. ;-) > >http://yetanother.org/damian/Perl5+i/control.html#Any_value_can_be_true_or_false Y'know, it's not fair taunting us with things The Agency has officially disclaimed any knowledge (or support) of... ;-P Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: .NET
> > am seeing some similarities between some of the proposed goals of > > Perl 6 and the .NET platform. > > . . . many things in .NET have been discussed similarly here. > > That's because .NET attempts to address real-world issues. > The goals of .NET are not evil in and of themselves, you know. Depends on whether you believe MS marketing. Once you dig through all the manure, you end up with some pretty basic concepts -- a new COM, the realization that C++ cause problems with mixed languages, and Microsoft's desperation to do something remotely interesting for a change (still waiting for "something original for a change").
Re: .NET
On Wed, May 02, 2001 at 05:22:26PM -0400, David Grove wrote: > > > am seeing some similarities between some of the proposed goals of > > > Perl 6 and the .NET platform. > > > . . . many things in .NET have been discussed similarly here. > > > > That's because .NET attempts to address real-world issues. > > The goals of .NET are not evil in and of themselves, you know. > > Depends on whether you believe MS marketing. Once you dig through all the > manure, you end up with some pretty basic concepts -- a new COM, the > realization that C++ cause problems with mixed languages, and Microsoft's > desperation to do something remotely interesting for a change (still waiting > for "something original for a change"). You are saying that the Clippy wasn't originally and truly annoying? :-) "Don't Let Architecture Astronauts Scare You" http://joel.editthispage.com/stories/storyReader$320 -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
RE: .NET
> -Original Message- > From: Jarkko Hietaniemi [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 02, 2001 5:26 PM > To: David Grove > Cc: Perl 6 Language Mailing List > Subject: Re: .NET > > > (still waiting > > for "something original for a change"). > > You are saying that the Clippy wasn't originally and truly annoying? :-) Something worthwhile and interesting? A benefit to mankind? ummm, Something that IBM or the Sun corporation would want to steal?
RE: Clippy.pl?
Actually, Clippy is definitely worth stealing. In fact, the whole notion of Generalized Robotic Open-source Animated Cartoon Images (GROACI) is imperative to the future of perl. Forget many-languages-one-engine, Larry, and focus on winning the Groaci race... =Austin --- David Grove <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Jarkko Hietaniemi [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, May 02, 2001 5:26 PM > > To: David Grove > > Cc: Perl 6 Language Mailing List > > Subject: Re: .NET > > > > > > (still waiting > > > for "something original for a change"). > > > > You are saying that the Clippy wasn't originally and truly > annoying? :-) > > Something worthwhile and interesting? > > A benefit to mankind? > > ummm, Something that IBM or the Sun corporation would want to steal? > > = Austin Hastings Global Services Consultant Continuus Software Corporation [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Please make "last" work in "grep"
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 [EMAIL PROTECTED] Parse, munge, repeat.
Re: .NET
> "Don't Let Architecture Astronauts Scare You" > > http://joel.editthispage.com/stories/storyReader$320 This is a really good article. The quotes from MS and Sun whitepapers are living proof that rarely are superior technical means being espoused. Superior sales are the more likely culprit, especially when a solution is proposed as new and innovative, when it usually isn't. Another snippet from the .NET whitepaper: Everyone believes the Web will evolve, but for that evolution to be truly empowering for developers, businesses, and consumers, a radical new vision is needed. Microsoft's goal is to provide that vision and the technology to make it a reality. In other words, evolution in and of itself is not empowering. Without the vision[tm], evolution is "deempowering".
Re: .NET
It's certainly a mistake to say "the goals of .NET", as if they were a monolithic whole. But the point is, some of the (technical) goals of .NET are worthy, if not the slightest bit original; and so it should not be a shame if some of Perl6's goals were collinear with them. And I hope that ends this thread. -- John Porter It's so mysterious, the land of tears.
Re: Please make "last" work in "grep"
[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. ;-) : : http://yetanother.org/damian/Perl5+i/control.html#Any_value_can_be_true_or_false : : ;-) Except if we take that approach it will be probably spelled: return 0 is true; More in A2, which I'm just putting the finishing touches on. Larry
Re: Clippy.pl?
On Wed, May 02, 2001 at 03:19:44PM -0700, Austin Hastings wrote: > Actually, Clippy is definitely worth stealing. In fact, the whole > notion of Generalized Robotic Open-source Animated Cartoon Images > (GROACI) is imperative to the future of perl. See http://www.cepstral.com -- and there will be perl interfaces for everything. Be careful what you wish for... kevin > Forget many-languages-one-engine, Larry, and focus on winning the > Groaci race... > > > > =Austin > > --- David Grove <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > > From: Jarkko Hietaniemi [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, May 02, 2001 5:26 PM > > > To: David Grove > > > Cc: Perl 6 Language Mailing List > > > Subject: Re: .NET > > > > > > > > > (still waiting > > > > for "something original for a change"). > > > > > > You are saying that the Clippy wasn't originally and truly > > annoying? :-) > > > > Something worthwhile and interesting? > > > > A benefit to mankind? > > > > ummm, Something that IBM or the Sun corporation would want to steal? > > > > > > > = > > Austin Hastings > Global Services Consultant > Continuus Software Corporation > [EMAIL PROTECTED] > > __ > Do You Yahoo!? > Yahoo! Auctions - buy the things you want at great prices > http://auctions.yahoo.com/