This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
sub MAIN(*@p) { | |
die "Arguments need to be integers" | |
unless all(@p) ~~ /^ \d+ $/; | |
die "Arguments need to be 1..N in some order" | |
unless sort(@p) ~~ [1..@p]; | |
say "($_)" for sort *.[0], gather for @p -> $e { | |
next if (state %handled).exists($e); |