Created
February 22, 2024 05:04
-
-
Save librasteve/0ec5bb2a70bc545faca830ec91baca92 to your computer and use it in GitHub Desktop.
How to use sub capture and gather together
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 dims-match( @a ) { | |
given @a { | |
when *== 0 { '' } | |
when *== 1 { .first } | |
when *>= 2 { .&type-hint } | |
} | |
} | |
gather { | |
for $.dictionary.type-to-dims.kv -> $key, $value { | |
take $key if $value eqv self.dims | |
} | |
} ==> dims-match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment