Re: Control flow variables

2003-11-19 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > David Wheeler wrote: > >> Isn't that just: >> for @array_of_random_values_and_types, 'ok' -> $t { >> when 'ok' { yada(); last } >> last unless some_sort_of_test($t); >> } >> IOW, the topic is only 'ok' when all of the items in the

Re: s/// in string context should return the string

2003-11-19 Thread Piers Cawley
Stéphane Payrard <[EMAIL PROTECTED]> writes: > s/// in string context should return the string after substituion. > It seems obvious to me but I mention it because I can't find it > in the apocalypses. Surely it should return the string after substitution, but with an appropriate 'but true' or

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Piers Cawley
"Joe Gottman" <[EMAIL PROTECTED]> writes: > - Original Message - > From: "Austin Hastings" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, November 18, 2003 3:04 PM > Subject: [perl] RE: s/// in string context should return the string > > >> As a "Bvalu

Re: Control flow variables

2003-11-19 Thread Jonathan Scott Duff
On Tue, Nov 18, 2003 at 11:05:57AM -0800, Michael Lazzaro wrote: > > On Tuesday, November 18, 2003, at 06:38 AM, Simon Cozens wrote: > >Given that we've introduced the concept of "if" having a return status: > > > > my $result = if ($a) { $a } else { $b }; > > > > Would that then imply that > >

RE: Control flow variables

2003-11-19 Thread Gordon Henriksen
No, because the if $a from "return if $a;" doesn't match the production if [else ] I so don't want to be anywhere near the Perl6 parser... -- Gordon Henriksen IT Manager ICLUBcentral Inc. [EMAIL PROTECTED] > -Original Message- > From: Michael Lazzaro [mailto:[EMAIL PROTEC

Re: Control flow variables

2003-11-19 Thread Smylers
Michael Lazzaro writes: > [EMAIL PROTECTED] (Dan Sugalski) writes: > > > Luke Palmer: > > > > > That's illegal anyway. Can't chain statement modifiers :-) > > > > Will be able to. > > I was under the strong impression that Larry had decided that > syntactic ambiguities prevented this from hap

Re: Control flow variables

2003-11-19 Thread Jonathan Scott Duff
On Tue, Nov 18, 2003 at 11:37:22PM +0100, Seiler Thomas wrote: > So... lets call a function instead: > > my $is_ok = 1; > for 0..6 -> $t { > if abs(@new[$t] - @new[$t+1]) > 3 { > $is_ok = 0; > last; > } > } > if $is_ok { > yada() # h

RE: Control flow variables

2003-11-19 Thread Gordon Henriksen
Austin Hastings wrote: > I'm way not sure about how the vector context result of iteration structures > will work. Specifically, what happens when a loop forks a thread, or passes > to a parallelized coroutine? There may not actually BE a result. (Of course, > in a right-thinking system this will

RE: Control flow variables

2003-11-19 Thread Gordon Henriksen
> Damian Conway wrote: > > > push @moves, [$i, $j]; > > for 0..6 -> $t { > > if abs(@new[$t] - @new[$t+1]) > 3 { > > pop @moves; > > last; > > } > > } Thomas Seiler writes: > my $is_ok = 1; > for 0..6 -> $t { > if abs(@new[$t] - @new[$t+1]) > 3 { > $is_ok = 0

RE: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Austin Hastings
> -Original Message- > From: Joe Gottman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 9:58 PM > To: Perl6 > Subject: Re: [perl] RE: s/// in string context should return the string > > > - Original Message - > From: "Austin Hastings" <[EMAIL PROTECTED]> > To: <[E

RE: Control flow variables

2003-11-19 Thread Austin Hastings
> Austin Hastings wrote: > > > I'm way not sure about how the vector context result of iteration > structures > > will work. Specifically, what happens when a loop forks a thread, or > passes > > to a parallelized coroutine? There may not actually BE a result. (Of > course, > > in a right-thinking

Re: Control flow variables

2003-11-19 Thread Randal L. Schwartz
> "Smylers" == Smylers <[EMAIL PROTECTED]> writes: Smylers> I also was under the strong impression that Larry had decreed Smylers> that we wouldn't have chained statement modifiers ... but I Smylers> thought it was because Larry had decided they would be a bad Smylers> thing to have rather th

RE: Control flow variables

2003-11-19 Thread Austin Hastings
> -Original Message- > From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 9:46 AM > To: [EMAIL PROTECTED] > Subject: Re: Control flow variables > > > > "Smylers" == Smylers <[EMAIL PROTECTED]> writes: > > Smylers> I also was under the strong impre

Re: Control flow variables

2003-11-19 Thread Randal L. Schwartz
> "Austin" == Austin Hastings <[EMAIL PROTECTED]> writes: Austin> This is surprising. Perl has never failed to provide me with Austin> an adequacy of rope in other places. Why get squeamish in this Austin> instance? The rope in other places provides overwhelming positive benefits as well, I g

Re: Control flow variables

2003-11-19 Thread Randal L. Schwartz
> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes: Randal> I actually consider that an annoying statement. I have to back up Randal> three times to figure out what it means. And before someone whips out the Schwartzian Transform to undermine my statement... please note that in Perl6

Re: Control flow variables

2003-11-19 Thread Luke Palmer
Jonathan Scott Duff writes: > On Tue, Nov 18, 2003 at 11:37:22PM +0100, Seiler Thomas wrote: > > So... lets call a function instead: > > > > my $is_ok = 1; > > for 0..6 -> $t { > > if abs(@new[$t] - @new[$t+1]) > 3 { > > $is_ok = 0; > > last; > > } >

Re: Control flow variables

2003-11-19 Thread Luke Palmer
Piers Cawley writes: > All of which means you can wrap it up in a macro and prove Simon's > point about what's syntax and what's CP6AN: > >macro unless_all( Block &test is parsed //, > Block &consequence, [EMAIL PROTECTED] ) > { my $guard = Object.new; >for [

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Larry Wall
On Wed, Nov 19, 2003 at 09:03:38AM -0500, Austin Hastings wrote: : : : > -Original Message- : > From: Joe Gottman [mailto:[EMAIL PROTECTED] : > Sent: Tuesday, November 18, 2003 9:58 PM : > To: Perl6 : > Subject: Re: [perl] RE: s/// in string context should return the string : > : > : >

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Simon Cozens
[EMAIL PROTECTED] (Larry Wall) writes: > Sigh. There's no =~ operator in Perl 6. How should we go about bringing A3 up to match current reality? It is, after all, over two years old now. -- End July 2001 - Alpha release for demonstration at TPC

Re: Control flow variables

2003-11-19 Thread Larry Wall
On Wed, Nov 19, 2003 at 08:08:49AM +1100, Damian Conway wrote: : Michael Lazzaro wrote: : : >So, just to make sure, these two lines are both valid, but do completely : >different things: : > : >return if $a; : : Means: : : if ($a) { return } : : : >return if $a { $a } : : Means:

Re: Control flow variables

2003-11-19 Thread Larry Wall
On Tue, Nov 18, 2003 at 06:28:59PM -0500, Gordon Henriksen wrote: : Whuh? Tangential at best... The result would be the same as in a : non-vectorized version, just repeated automatically for you. : : my @b = for @a -> $_ { : ... : } That will be a syntax error. Generators are too

Re: Control flow variables

2003-11-19 Thread Larry Wall
On Wed, Nov 19, 2003 at 09:30:15AM -0700, Luke Palmer wrote: : Piers Cawley writes: : > All of which means you can wrap it up in a macro and prove Simon's : > point about what's syntax and what's CP6AN: : > : >macro unless_all( Block &test is parsed //, : > Block &conseque

Re: Control flow variables

2003-11-19 Thread Jonathan Scott Duff
On Tue, Nov 18, 2003 at 09:36:31PM -0800, Larry Wall wrote: > As for the original question that started this whole silly thread, > control structures that return values should probably be considered > some kind of generator, and have an explicit "yield"-like statement > that is orthogonal to "last"

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Jonathan Scott Duff
On Wed, Nov 19, 2003 at 06:17:33PM +, Simon Cozens wrote: > [EMAIL PROTECTED] (Larry Wall) writes: > > Sigh. There's no =~ operator in Perl 6. > > How should we go about bringing A3 up to match current reality? It is, after > all, over two years old now. Isn't Allison the maintainer? Just p

RE: Control flow variables

2003-11-19 Thread Gordon Henriksen
Larry Wall wrote: > On Tue, Nov 18, 2003 at 06:28:59PM -0500, Gordon Henriksen wrote: > > > my @b = for @a -> $_ { > > ... > > } > > That will be a syntax error. Generators are too mind-stretching to > inflict on novices [...] I making the point that within the context of this w

Re: Control flow variables

2003-11-19 Thread Luke Palmer
Gordon Henriksen writes: > Larry Wall wrote: > > > On Tue, Nov 18, 2003 at 06:28:59PM -0500, Gordon Henriksen wrote: > > > > > my @b = for @a -> $_ { > > > ... > > > } > > > > That will be a syntax error. Generators are too mind-stretching to > > inflict on novices [...] > > I m

Re: Control flow variables

2003-11-19 Thread Larry Wall
On Wed, Nov 19, 2003 at 09:12:01AM -0600, Jonathan Scott Duff wrote: : On Tue, Nov 18, 2003 at 09:36:31PM -0800, Larry Wall wrote: : > As for the original question that started this whole silly thread, : > control structures that return values should probably be considered : > some kind of generato

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Allison Randal
Simon wrote: > > How should we go about bringing A3 up to match current reality? It is, after > all, over two years old now. We talked about this today. Our current thought is to retroactively write the Synopses and keep those up-to-date (with notes in the outdated parts of the A's and E's pointi

RE: Control flow variables

2003-11-19 Thread Austin Hastings
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > On the other hand, putting the default up front is clearer if the > block is long. Could even be something like: > > @foo = gather is default(@results) { > for @a -> $x { pick $x if mumble($x) } > } And C

Re: Control flow variables

2003-11-19 Thread Sean O'Rourke
[EMAIL PROTECTED] (Austin Hastings) writes: > What does C do? That's the operator that's used to assign values to C<$^x> and friends in closures. In all its glory, you give it a set of values, and it assigns them to a block's undefined variables, quieting those annoying warnings: @x = 1..10;

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Simon Cozens
[EMAIL PROTECTED] (Allison Randal) writes: > We talked about this today. Our current thought is to retroactively > write the Synopses and keep those up-to-date (with notes in the outdated > parts of the A's and E's pointing to the relevant section of the > S's). To be honest, I don't care how it's

Parsing macros (was: Control flow variables)

2003-11-19 Thread Jonathan Lang
Larry Wall wrote: > So far we've only allowed "is parsed" on the macro itself, not on > individual arguments. Still, that's an interesting idea. Forgive me if this has already been addressed, but this could have some useful applications: So far, everything I've read about macro parsing concentra