Is this a bug?

2016-09-18 Thread Parrot Raiser
This code: 1 #! /home/guru/bin/perl6 2 3 # Ask for some lines and output them in reverse 4 # Work out the appropriate EOF symbol for the OS 5 6 my $EOF = "CTRL-" ~ ($*DISTRO.is-win ?? "Z" !! "D"); 7 8 say "Please enter some lines and end them with $EOF"; 9 10 say { for reverse lines() {} }; 11 12

Re: Is this a bug?

2016-09-18 Thread Elizabeth Mattijsen
I think you want: .say for reverse lines; not sure what you are trying to achieve otherwise, but: say { } producing something like -> ;; $_? is raw { #`(Block|170303864) … } feels entirely correct to me. :-) Liz > On 18 Sep 2016, at 21:52, Parrot Raiser <1parr...@gmail.com>

Re: This seems to be wrong

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 4:31 PM, Parrot Raiser <1parr...@gmail.com> wrote: > but seems to have a problem with larger numbers: > > 7 > 3 > 21 <- This > 2 > 1 > 0 > 4 > bamm-bamm > barney > (Any) <--- Produces this > betty > fred > 0

Re: Is this a bug?

2016-09-18 Thread Brent Laabs
Remember you can call a block with parentheses: > say { 11 + 31 }; -> ;; $_? is raw { #`(Block|140268472711224) ... } > say { 11 + 31 }(); 42 On Sun, Sep 18, 2016 at 12:58 PM, Elizabeth Mattijsen wrote: > I think you want: > > .say for reverse lines; > > not sure what you

Re: This seems to be wrong

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 6:29 PM, Trey Harris wrote: > But I see there’s a multi method Str defined on Any, and you can’t do > @inputs.map( .Str ), either (Use of uninitialized value $_ of type Any in > string context). Why not? (There’s no multi method Num on Any, even > though

Re: Is this a bug?

2016-09-18 Thread Trey Harris
On Sun, Sep 18, 2016 at 16:49 Parrot Raiser <1parr...@gmail.com> wrote: say { $_ } was the correct thing to use there. (I'm trying to avoid > any mention of O-O for the moment.) > “Trying to avoid any mention of O-O” seems like a Perl 6 obfuscation or golf constraint, not a desirable development

Re: This seems to be wrong

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 6:36 PM, Trey Harris wrote: > Does not being defined on Any explain why the error for @input.map( .Str ) > is different (Use of uninitialized value $_ of type Any in string context) > than the error for @input.map( .Num ) (Method 'Num' not found for >

This seems to be wrong

2016-09-18 Thread Parrot Raiser
This code: #! /home/guru/bin/perl6 # Ask for some numbers from 1 - 7 # and verify that they are in range my @names = < fred betty barney dino wilma pebbles bamm-bamm >; my @inputs = lines(); for @inputs { if $_ ~~ 1..7 { say @names[$_-1]; } else { say "$_ out of

Re: Is this a bug?

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 4:49 PM, Parrot Raiser <1parr...@gmail.com> wrote: > What is this -> ;; $_? is raw { #`(Block|170303864) … } output? It's the gist of a Block, which is what you asked for when you did a `say` on an executable block. Why do you believe `say { $_ }` is the right thing

Re: Is this a bug?

2016-09-18 Thread Elizabeth Mattijsen
It is the .perl representation of a Block. > On 18 Sep 2016, at 22:49, Parrot Raiser <1parr...@gmail.com> wrote: > > say { $_ } was the correct thing to use there. (I'm trying to avoid > any mention of O-O for the moment.) > say {} was a "what happens if I do this" exercise. > > What is this

Re: This seems to be wrong

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 6:06 PM, Trey Harris wrote: > Not work? It results inMethod 'prefix:<+>' not found for invocant of > class 'Any', but the docs > > > say it is defined as a multi on Any…. > > No, they say it's a multi

Re: This seems to be wrong

2016-09-18 Thread Brandon Allbery
On Sun, Sep 18, 2016 at 6:15 PM, Brandon Allbery wrote: > for @inputs.map({ .:<+> }) { ... } Which means the shorter way is: for @inputs.map(+*) { ... } -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com

Re: This seems to be wrong

2016-09-18 Thread Trey Harris
D’oh! I’m blind. But I see there’s a multi method Str defined on Any, and you can’t do @inputs.map( .Str ), either (Use of uninitialized value $_ of type Any in string context). Why not? (There’s no multi method Num on Any, even though the docs about Cool seem

Re: This seems to be wrong

2016-09-18 Thread Trey Harris
On Sun, Sep 18, 2016 at 6:30 PM Brandon Allbery allber...@gmail.com wrote: > On Sun, Sep 18, 2016 at 6:29 PM, Trey Harris wrote: > >> But I see there’s a multi method Str defined on Any, and you can’t do >> @inputs.map( .Str ), either (Use of