3 ms·
That is starting to look more like J or K than Perl. Is the Perl 6 team still considering syntax changes? If so, any thought on making map/grep/join operators
by gecko 14y ago
That is starting to look more like J or K than Perl. Is the Perl 6 team still considering syntax changes? If so, any thought on making map/grep/join operators?
- cygx 14y agomap, grep and join are subs as well as methods. Perl6 is a multi-paradigm language and of course there's more than one way to do it - even when using the same operations. Instead of chaining methods, one could also use # p5 style join "\n", grep ?*, map *.description, @list; # dataflow style @list ==> map *.description ==> grep ?* ==> join "\n"; join "\n" <== grep ?* <== map *.description <== @list;
- draegtun 14y agoPerl6 allows you to define your own operators: $ perl6 > sub infix:<J> ($sep, @list) { @list.join($sep) } > sub prefix:<J,> (@list) { @list.join(',') } > ':' J <one two three four>; one:two:three:four > J,<five six seven eight>; five,six,seven,eight