"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: [email protected]
Toolsmith, developer, gamer and life-long student.
On Sun, Sep 18, 2016 at 6:06 PM, Trey Harris <[email protected]> wrote:
> Why does this:
>
> for @inputs.map( .prefix:<+> ) { ... }
>
> Not work? It results inMethod 'prefix:<+>' not found for invocant of
> class 'Any', but the docs
> <https://docs.perl6.org/language/operators#prefix_+> say it is defined as
> a multi on Any….
>
> Trey
>
>
> On Sun, Sep 18, 2016 at 4:37 PM Brandon Allbery <[email protected]>
> wrote:
>
>> On Sun, Sep 18, 2016 at 4:31 PM, Parrot Raiser <[email protected]>
>> 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 out of range 1..7
>>> dino
>>>
>>
>> [18 20:35] <geekosaur> m: say so "21" ~~ 1..7
>> [18 20:35] <camelia> rakudo-moar 34f950: OUTPUT«True
>> [18 20:35] »
>>
>> It came from lines(), it is a Str. Numify it first.
>>
>> --
>> brandon s allbery kf8nh sine nomine
>> associates
>> [email protected]
>> [email protected]
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>>
>