Piers Cawley writes:
> Simon Cozens <[EMAIL PROTECTED]> writes:
> > But it isn't, and I don't know why it isn't, and so we end up
> > spending loads of time discussing things that can be punted out to
> > modules. Designing Perl 6 is hard enough; let's not try to fill
> > CP6AN at the same time.
>
Simon Cozens <[EMAIL PROTECTED]> writes:
> Luke Palmer:
>> So modules that introduce new concepts into the language can add new
>> syntax for them without working with (ugh) a source filter. And some of
>> these new syntaxes in the "core" language will actually be in standard
>> modules, if they'r
On Thu, Nov 20, 2003 at 07:27:56PM -0600, Jonathan Scott Duff wrote:
: On Thu, Nov 20, 2003 at 03:26:36PM -0700, Luke Palmer wrote:
: > One wonders what the return value of a loop will be:
: >
: > my $what = do {
: > while $cond {...}
: > }
:
: I would expect it to be the value of
On Thu, Nov 20, 2003 at 03:26:36PM -0700, Luke Palmer wrote:
> No. gather{} is a generator (assuming nothing about its name or
> existance whatsoever). It runs some code, gathering up each pick()
> (same assumption) into a list, and returning that.
Thanks for the post Luke. I'd seen what Larry
Jonathan Scott Duff writes:
> On Wed, Nov 19, 2003 at 12:49:21PM -0800, Larry Wall wrote:
> > Sorry, I wasn't being very clear. It wouldn't be logically attached to
> > the outside of the for, but to the inside of the "confer", or whatever:
> >
> > @foo = gather {
> > for @a -> $x { pick
On Thu, 20 Nov 2003, Dave Whipp wrote:
> "Larry Wall" <[EMAIL PROTECTED]> wrote:
> > Also, since multi is orthogonal to naming ...
>
> So I'm wondering what the correct syntax is to grab a reference to a group
> of multi-somethings.
While Larry will probably weigh in on this, I'd rather you not a
"Larry Wall" <[EMAIL PROTECTED]> wrote:
> Also, since multi is orthogonal to naming ...
So I'm wondering what the correct syntax is to grab a reference to a group
of multi-somethings. Example:
multi sub foo(Int $a:) {...};
multi sub foo(String $a:) {...};
my $ref = multi &foo;
$ref("hello"); #
On Thu, Nov 20, 2003 at 11:23:34AM -0800, Michael Lazzaro wrote:
:
: On Tuesday, November 18, 2003, at 12:15 PM, Luke Palmer wrote:
: >Oh, and if you really want to do that return thing without using a
: >C, you can just:
: >
: >sub blah {
: >return $a || goto CONT;
: >CONT:
: >
On Tuesday, November 18, 2003, at 12:15 PM, Luke Palmer wrote:
Oh, and if you really want to do that return thing without using a
C, you can just:
sub blah {
return $a || goto CONT;
CONT:
...
}
I don't see what's wrong with that. :-p
Umm... refresh my/our memory. Did we
On Wednesday, November 19, 2003, at 12:28 PM, Smylers wrote:
Larry Wall writes:
: Michael Lazzaro wrote:
:
: >return if $a { $a }
No, it's a syntax error. You must write
Excellent!
I too was quietly hoping someone would say that. These hurt my
admittedly ever-shrinking brain:
retur
Smylers <[EMAIL PROTECTED]> writes:
> Larry Wall writes:
>
>> And nested modifiers are still quite illegal in Standard Perl 6.
>
> Right.
>
> Anybody else get the feeling we should write that down somewhere, so we
> don't have to have this conversation again in a few months?
It'll be in the summa
On Wed, Nov 19, 2003 at 12:49:21PM -0800, Larry Wall wrote:
> Sorry, I wasn't being very clear. It wouldn't be logically attached to
> the outside of the for, but to the inside of the "confer", or whatever:
>
> @foo = gather {
> for @a -> $x { pick $x if mumble($x) }
> DEFAULT { @
Larry Wall writes:
> On Wed, Nov 19, 2003 at 08:08:49AM +1100, Damian Conway wrote:
>
> : Michael Lazzaro wrote:
> :
> : >return if $a { $a }
> :
> : Means:
> :
> :if ($a) { return $a } else { return undef }
>
> No, it's a syntax error. You must write
>
> return do { if $a { $a
Larry Wall writes:
> And nested modifiers are still quite illegal in Standard Perl 6.
Right.
Anybody else get the feeling we should write that down somewhere, so we
don't have to have this conversation again in a few months?
Smylers
Jonathan Lang writes:
> 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
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
[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;
> -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
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
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
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
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"
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
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
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:
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 [
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;
> > }
>
> "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
> "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
> -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 PROTECTE
> "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
> 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
> 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
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
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
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
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
>
>
ael Lazzaro [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Control flow variables
>
>
>
> On Tuesday, November 18, 2003, at 06:38 AM, Simon Cozens wrote:
> > Given that we've introduced the concept of &qu
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
On Tue, Nov 18, 2003 at 11:14:54AM -0500, Dan Sugalski wrote:
: On Tue, 18 Nov 2003, Simon Cozens wrote:
:
: > [EMAIL PROTECTED] (Austin Hastings) writes:
: > > This is what I was talking about when I mentioned being able to do:
: > > &cleanup .= { push @moves: [$i, $j]; }
: >
: > This reminds m
On Tuesday, November 18, 2003, at 06:44 PM, Joseph Ryan wrote:
And also if @array_of_random_values contains 'ok'.
D'oh! See Damian's solution, then. ;-)
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://w
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 array have been
processed
Unless, of course, the string 'ok'
David Wheeler wrote:
On Tuesday, November 18, 2003, at 06:11 PM, Joseph Ryan wrote:
Not to be a jerk, but how about:
my $is_ok = 1;
for @array_of_random_values_and_types -> $t {
if not some_sort_of_test($t) {
$is_ok = 0;
last;
}
}
if $is_ok {
On Tuesday, November 18, 2003, at 06:11 PM, Joseph Ryan wrote:
Not to be a jerk, but how about:
my $is_ok = 1;
for @array_of_random_values_and_types -> $t {
if not some_sort_of_test($t) {
$is_ok = 0;
last;
}
}
if $is_ok {
yada() # has sideef
Joseph Ryan wrote:
Not to be a jerk, but how about:
my $is_ok = 1;
for @array_of_random_values_and_types -> $t {
if not some_sort_of_test($t) {
$is_ok = 0;
last;
}
}
if $is_ok {
yada() # has sideeffects...
}
That's just:
given @array_
Damian Conway wrote:
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() # has sideeffects...
}
That's just:
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() # has sideeffects...
}
That's just:
for 0..6, 'ok' -> $
Damian Conway wrote:
> push @moves, [$i, $j];
> for 0..6 -> $t {
> if abs(@new[$t] - @new[$t+1]) > 3 {
> pop @moves;
> last;
> }
> }
>
>
Indeed, an elegant way around the problem.
So... lets call a function instead:
my $is_ok = 1;
On Tue, 18 Nov 2003, Austin Hastings wrote:
>
>
> > -Original Message-
> > From: Dan Sugalski [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, November 18, 2003 4:34 PM
> > To: Language List
> > Subject: RE: Control flow variables
> >
> >
> -Original Message-
> From: Dan Sugalski [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 4:34 PM
> To: Language List
> Subject: RE: Control flow variables
>
>
> On Tue, 18 Nov 2003, Austin Hastings wrote:
>
> > This seems excessive, but eas
Luke Palmer wrote:
My C/C typo may
have misled you, but the original example pushed only if *none* of them
passed the condition.
Ah, sorry, I misunderstood.
So you want:
push @moves, [$i, $j];
for 0..6 -> $t {
if abs(@new[$t] - @new[$t+1]) > 3 {
pop @moves;
Austin Hastings writes:
> > From: Luke Palmer [mailto:[EMAIL PROTECTED]
> >
> > Austin Hastings writes:
> > > > From: Michael Lazzaro [mailto:[EMAIL PROTECTED]
> > > >
> > > > Would that then imply that
> > > >
> > > > sub blah {
> > > >... # 1
> > > >return if $a;
On Tue, 18 Nov 2003, Austin Hastings wrote:
> This seems excessive, but easily discarded during optimization. On the other
> hand, I don't trust the "last statement evaluated" behavior for loops, since
> the optimizer could very well do surprising things to loop statements.
> (Likewise, however, f
> -Original Message-
> From: Luke Palmer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 3:11 PM
> To: Austin Hastings
> Cc: Michael Lazzaro; [EMAIL PROTECTED]
> Subject: Re: Control flow variables
>
>
> Austin Hastings writes:
> >
> -Original Message-
> From: Damian Conway [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 4:02 PM
> To: Language List
> Subject: Re: Control flow variables
>
>
> Luke Palmer started a discussion:
>
>
> > I see this idiom a lot in code
Damian Conway writes:
> Luke Palmer started a discussion:
>
>
> >I see this idiom a lot in code. You loop through some values on a
> >condition, and do something only if the condition was never true.
> >$is_ok is a control flow variable, something I like to minimize. Now,
> >there are other way
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:
if ($a) { return $a } else { return undef }
Damian
Luke Palmer started a discussion:
I see this idiom a lot in code. You loop through some values on a
condition, and do something only if the condition was never true.
$is_ok is a control flow variable, something I like to minimize. Now,
there are other ways to do this:
if (0..6 ==> grep -> $
Would that then imply that
sub blah {
... # 1
return if $a;# 2
... # 3
}
...would return $a if $a was true, and fall through to (3) if it was
false?
It sure should, provided there were a correct context waiting, which
would
quite nicel
Austin Hastings writes:
>
>
> > -Original Message-
> > From: Michael Lazzaro [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, November 18, 2003 2:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Control flow variables
> >
> >
> >
> &
Austin Hastings writes:
>
>
> > -Original Message-
> > From: Michael Lazzaro [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, November 18, 2003 2:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Control flow variables
> >
> >
> >
> &
> -Original Message-
> From: Michael Lazzaro [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Control flow variables
>
>
>
> On Tuesday, November 18, 2003, at 06:38 AM, Simon Cozens 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
sub blah {
... # 1
return if $a;# 2
...
OOPS, totally miss-read your code, ignore my first part of my last
message.
--
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Luke Palmer wrote:
I was reading the most recent article on perl.com, and a code segment
reminded me of something I see rather often in code that I don't like.
Here's the code, Perl6ized:
... ;
my $is_ok = 1;
for 0..6 -> $t {
if abs(@new[$t] - @new[$t+1]) > 3 {
$is_
> -Original Message-
> From: Luke Palmer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 10:49 AM
> To: Austin Hastings
> Cc: Language List
> Subject: Re: Control flow variables
>
>
> Austin Hastings writes:
> > Luke Palmer wrote:
&g
On Tue, 18 Nov 2003, Simon Cozens wrote:
> [EMAIL PROTECTED] (Austin Hastings) writes:
> > This is what I was talking about when I mentioned being able to do:
> > &cleanup .= { push @moves: [$i, $j]; }
>
> This reminds me of something I thought the other day might be useful:
>
> $cleanup = b
[EMAIL PROTECTED] (Austin Hastings) writes:
> This is what I was talking about when I mentioned being able to do:
> &cleanup .= { push @moves: [$i, $j]; }
This reminds me of something I thought the other day might be useful:
$cleanup = bless {}, class {
method DESTROY { ... }
}
On Tue, 18 Nov 2003, Simon Cozens wrote:
> [EMAIL PROTECTED] (Dan Sugalski) writes:
> > > Luke Palmer:
> > > > That's illegal anyway. Can't chain statement modifiers :-)
> > Will be able to.
>
> I thought as much; Perl 6 will only be finally finished when the biotech
> is sufficiently advanced to
Austin Hastings writes:
> Luke Palmer wrote:
> > I was reading the most recent article on perl.com, and a code segment
> > reminded me of something I see rather often in code that I don't like.
> > Here's the code, Perl6ized:
> >
> > ... ;
> > my $is_ok = 1;
> > for 0..6 -> $t {
> >
> -Original Message-
> From: Luke Palmer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 18, 2003 9:21 AM
> To: Language List
> Subject: Control flow variables
>
>
> I was reading the most recent article on perl.com, and a code segment
> reminded me of s
[EMAIL PROTECTED] (Dan Sugalski) writes:
> > Luke Palmer:
> > > That's illegal anyway. Can't chain statement modifiers :-)
> Will be able to.
I thought as much; Perl 6 will only be finally finished when the biotech
is sufficiently advanced to massively clone Larry...
--
Sometimes it's better n
On Tue, 18 Nov 2003, Simon Cozens wrote:
> Luke Palmer:
> > That's illegal anyway. Can't chain statement modifiers :-)
>
> Bah, should be able to!
Will be able to.
Dan
--"it's like this"---
Dan Sugalsk
Luke Palmer:
> Well... it is and isn't. At first sight, it makes the language look
> huge, the parser complex, a lot of syntax to master, etc. It also seems
> to me that there is little discrimination when adding new syntax.
Correct.
> But I've come to look at it another way. Perl 6 is doing
Simon Cozens writes:
> [EMAIL PROTECTED] (Luke Palmer) writes:
> > I was reading the most recent article on perl.com, and a code segment
> > reminded me of something I see rather often in code that I don't like.
>
> The code in question got me thinking too; I wanted to find a cleaner
> way to writ
[EMAIL PROTECTED] (Luke Palmer) writes:
> I was reading the most recent article on perl.com, and a code segment
> reminded me of something I see rather often in code that I don't like.
The code in question got me thinking too; I wanted to find a cleaner
way to write it, but didn't see one.
> So,
I was reading the most recent article on perl.com, and a code segment
reminded me of something I see rather often in code that I don't like.
Here's the code, Perl6ized:
... ;
my $is_ok = 1;
for 0..6 -> $t {
if abs(@new[$t] - @new[$t+1]) > 3 {
$is_ok = 0;
77 matches
Mail list logo