Hi Marc,
On 05/26/2013 12:49 PM, Marc Chantreux wrote:
> say [+]
> ('a'..'z')\
> .pairs\
> .map: { 1 + .key if .value ~~ any < m a t h > }
>
> i already know i have to get used to the anoying \ at the end of the
> lines but i'm pretty sure there are plenty ways to make this expression
> shorter.
masak took this to #perl6:
http://irclog.perlgeek.de/perl6/2013-05-26#i_7117450
My solution, with a bit of help from masak:
say [+] <m a t h>ยป.ord X- ('a'.ord - 1)
Other approaches have been developed too, it's worth reading the logs :-)
If anybody has a good idea for removing that - 1, please tell me. (Using
'`'.ord instead of 'a'.ord - 1 seems too obscure for my taste).
Cheers,
Moritz