Skip to content

Instantly share code, notes, and snippets.

@2colours
Last active May 25, 2022 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2colours/0720e806de9107437a5ab8b53fdaa2b7 to your computer and use it in GitHub Desktop.
Save 2colours/0720e806de9107437a5ab8b53fdaa2b7 to your computer and use it in GitHub Desktop.
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