4 ms·
Some from Raku (formerly Perl 6) that I really like: * sub MAIN: sub MAIN(Int $x, :$verbose) { } generates a command line parser that expects an Integer plus
by perlgeek 4y ago
Some from Raku (formerly Perl 6) that I really like:
* sub MAIN:
sub MAIN(Int $x, :$verbose) { }
generates a command line parser that expects an Integer plus an optional named switch --verbose
* It has named params (as seen above), and there are abbreviations: instead of thing => $thing you can write :$thing to avoid duplicating the name (:thing also exists, though it create a pair "thing" => True, so ruby lovers need to be careful :D )
* junctions for quick conditionals/validation: 0 <= all($x, $y, $z) <= 2 * pi
* this is a probably debatable, but: if you use a * as a term, it will create a lambda for you, so *+2 is similar to sub ($x) { $x + 2 }
- zem 4y agophasers are brilliant too. so much nicer than all the clunky workarounds for "the first/last pass through this loop needs to be treated specially"