Skip to content

Instantly share code, notes, and snippets.

@viklund
Created June 6, 2009 18:23
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 viklund/124951 to your computer and use it in GitHub Desktop.
Save viklund/124951 to your computer and use it in GitHub Desktop.
use v6;
multi infix:<compress> ( $a, $b ) { $a ~~ $b ?? $a !! [ $a, $b ] }
multi infix:<compress> ( @a, $b ) { @a[*-1] ~~ $b ?? @a !! [ @a, $b ] }
say ([compress] <a a a a b c c a a d e e e e>).perl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment