Skip to content

Instantly share code, notes, and snippets.

@2colours
Last active May 25, 2022
Embed
What would you like to do?
my @hexa-letters <== sort() <== |('a'..'f'), |<o l i s t>;
proto next-hexa-word($current-word) {*} # if I don't add this: `Cannot resolve caller next-hexa-word(aa, ab); none of these signatures matches (...)`
multi next-hexa-word('' --> 'a') {}
multi next-hexa-word($current-word where /t$/) { samewith($current-word.chop: 1) ~ 'a' }
multi next-hexa-word($current-word where /(.)$/) { $current-word.chop(1) ~ @hexa-letters.first: * gt $0 }
my @hexa-sequence = 'a' x 2, &next-hexa-word ... 't' x 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment