-
-
Save hinrik/a8ce1c656d4cc88e96f7df87004b0f67 to your computer and use it in GitHub Desktop.
This file contains 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
sub print ($a, $b = False) { | |
# uncommenting this takes the runtime from 0.15s to 0.6s | |
#my &reprint = &print.assuming(*, $b); | |
given $a { | |
when Array { | |
'[' ~ join(',', $a.map({ print($_) })) ~ ']'; | |
} | |
when Hash { | |
'{' ~ $a.map({.key ~ print(.value)}) ~ '}' | |
} | |
default { $a.gist } | |
} | |
} | |
say print { foo => 'bar', baz => ['bla','sdf', {a => 'b', c => ['z']}]}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment