Re: r26938 - docs/Perl6/Spec

2009-05-26 Thread Eirik Berg Hanssen
pugs-comm...@feather.perl6.nl writes: statement, or if you want to attach multiple statements. you must either use the curly form or surround the entire expression in brackets of some sort: -@primes = (do (do $_ if .prime) for 1..100); +@primes = do $_ if prime($_) for 1..100;

Re: Question for Larry

2009-05-26 Thread TSa
HaloO, John M. Dlugosz wrote: Daniel Ruoso daniel-at-ruoso.com |Perl 6| wrote: %ab := 1; is an operation in the hash itself, not in that specific cell of the hash. This to me implies that postcircumfix:{'',''} returns some assignment proxy that knows the hash. This is e.g. needed for

Re: Meditations on a Loop

2009-05-26 Thread Patrick R. Michaud
On Mon, May 25, 2009 at 12:37:34PM -0700, yary wrote: That's an enjoyable and educational read, thanks! There's one form under TMTOWTDI that I'd like to see, but can't figure out myself. It's the version analogous to this perl5 snippet- sub odd {$_ % 2} say grep odd,0..6; -where the

Unexpected behaviour with @foo.elems

2009-05-26 Thread Daniel Carrera
Hello, The following construction doesn't do what a user might expect: for 0...@foo.elems - $k { do_something($k,@foo[$k]) } Obviously, the intention is to step through every key/value in @foo. Buf @f...@foo.elems] does not exist. If @foo = (1,2,3); then @foo.elems is 3, and @foo[3] is

Re: Meditations on a Loop

2009-05-26 Thread yary
On Tue, May 26, 2009 at 1:57 PM, Patrick R. Michaud pmich...@pobox.com wrote: On Mon, May 25, 2009 at 12:37:34PM -0700, yary wrote: How about...?    sub odd { ^$a % 2 } typo. sub odd {$^a % 2} works (caret goes between $ and a)    say grep odd, 0..6; nice. I need to learn the differences

Re: Unexpected behaviour with @foo.elems

2009-05-26 Thread yary
I'm a relative beginner at perl6, but pretty good with perl5 (and C and a few others), so I read for 0...@foo.elems as saying Give me a list with one item longer then @foo, not give me the indexes of @foo. I can see users being tripped up by the old problem of we start counting at 0 and not at 1,

Re: Unexpected behaviour with @foo.elems

2009-05-26 Thread John M. Dlugosz
Daniel Carrera daniel.carrera-at-theingots.org |Perl 6| wrote: Hello, The following construction doesn't do what a user might expect: for 0...@foo.elems - $k { do_something($k,@foo[$k]) } Obviously, the intention is to step through every key/value in @foo. Buf @f...@foo.elems] does not

Re: Meditations on a Loop

2009-05-26 Thread John M. Dlugosz
yary not.com-at-gmail.com |Perl 6| wrote: I was wondering why the perl5 example didn't work in p6- $_ is a contextual variable, so why doesn't the body of odd get its $_ value from grep in something like this: sub odd_a { $_ % 2} If you make it a formally declared sub, then you have to

r26940 - docs/Perl6/Spec

2009-05-26 Thread pugs-commits
Author: jdlugosz Date: 2009-05-27 01:59:45 +0200 (Wed, 27 May 2009) New Revision: 26940 Modified: docs/Perl6/Spec/S04-control.pod Log: [s04] replace example that no longer was applicable after previous edits; update old Array and List uses to Capture (and note that bare parens construct a

Re: r26938 - docs/Perl6/Spec

2009-05-26 Thread John M. Dlugosz
I fixed that today... will check in in a few hours. It's harder to come up with a new example than to update syntax. :) --John Eirik Berg Hanssen Eirik-Berg.Hanssen-at-allverden.no |Perl 6| wrote: pugs-comm...@feather.perl6.nl writes: statement, or if you want to attach multiple

Re: Unexpected behaviour with @foo.elems

2009-05-26 Thread Patrick R. Michaud
On Tue, May 26, 2009 at 06:43:40PM -0500, John M. Dlugosz wrote: Daniel Carrera daniel.carrera-at-theingots.org |Perl 6| wrote: The following construction doesn't do what a user might expect: for 0...@foo.elems - $k { do_something($k,@foo[$k]) } Write ^...@foo.elems as a shortcut of

Continuations

2009-05-26 Thread Jon Lang
From S09, under Junctions: The exact semantics of autothreading with respect to control structures are subject to change over time; it is therefore erroneous to pass junctions to any control construct that is not implemented via as a normal single or multi dispatch. In particular, threading

Re: Continuations

2009-05-26 Thread John M. Dlugosz
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote: From S09, under Junctions: The exact semantics of autothreading with respect to control structures are subject to change over time; it is therefore erroneous to pass junctions to any control construct that is not implemented via as a normal

Re: Meditations on a Loop

2009-05-26 Thread Patrick R. Michaud
On Tue, May 26, 2009 at 04:10:45PM -0700, yary wrote: On Tue, May 26, 2009 at 1:57 PM, Patrick R. Michaud pmich...@pobox.com wrote: On Mon, May 25, 2009 at 12:37:34PM -0700, yary wrote: How about...?    sub odd { ^$a % 2 } typo. sub odd {$^a % 2} works (caret goes between $ and a)