Re: This seems to be wrong

2016-09-19 Thread Timo Paulssen
On 19/09/16 15:56, Aaron Sherman wrote:> You can also use map, but it's slightly clunkier: > > "for @inputs.map: .Int -> $i { ... }" This also needs to have "*.Int" or "{ .Int }" otherwise you'll pass $_.Int as the argument to map rather than telling map to call .Int on things.

Re: This seems to be wrong

2016-09-19 Thread Aaron Sherman
"for @inputs.map( .prefix:<+> ) {...}" That's spelled: "for @inputs>>.Int -> $i { ... }" You can also use map, but it's slightly clunkier: "for @inputs.map: .Int -> $i { ... }" Aaron Sherman, M.: P: 617-440-4332 Google Talk, Email and Google Plus: a...@ajs.com Toolsmith, developer, gamer

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

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 >

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: 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 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 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

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