can't adverb and infix

2017-09-19 Thread Luca Ferrari
Hi all, this will sound trivial, but the following piece of code that in my mind should work does not: $mode = 'csv' if ( ! $mode.defined || %available_modes{ $mode }:!exists ); and the compiler says: You can't adverb :<||> at /home/luca/tmp/am/folken.p6:16 --> ined || %available_modes{

help with map and regexp

2017-09-19 Thread Luca Ferrari
Hi all, I'm trying to understand how to use map correctly to apply several regexps at once, something like: my @fields = $line.split( ',' ).map: { s:g/\'//; s:g/^\"|\"$//; $_ }; while the first regexp works, the second fails with "Cannot modify an immutable Str", but the topic variable should

Re: can't adverb and infix

2017-09-19 Thread Brandon Allbery
On Tue, Sep 19, 2017 at 3:44 AM, Luca Ferrari wrote: > this will sound trivial, but the following piece of code that in my > mind should work does not: > > $mode = 'csv' if ( ! $mode.defined || %available_modes{ $mode }:!exists ); > > and the compiler says: > > You can't

Re: help with map and regexp

2017-09-19 Thread Timo Paulssen
You'll have to type the $_ of the block as "is copy" if you want to do this. Another way would be to have "is rw" but that can of course only work if a container is present in what you map over; there isn't in this case.     perl6 -e '.perl.say for "hello, how, are, you".split(",").map: -> $_ is

DateTime.Str default formatter with sprintf is pretty slow

2017-09-19 Thread Thor Michael Støre
Hey, When I profiled my "read CSV, munge, write CSV" script to see why it is a bit on the slow side DateTime.Str stood out. I saw the default formatter eventually reached sprintf, which consumed a lot of time. Each output line from my script has one date and time in ISO 8601 format, and when I