Skip to content

Instantly share code, notes, and snippets.

@KamilaBorowska
Created January 28, 2013 09:22
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 KamilaBorowska/4654154 to your computer and use it in GitHub Desktop.
Save KamilaBorowska/4654154 to your computer and use it in GitHub Desktop.
Infix "in"
proto infix:<in>(|) is equiv<==> is assoc<non> { * }
multi infix:<in>($a, $b) { so $b ~~ / $a / }
multi infix:<in>($a, @b) { so $a eqv any @b }
multi infix:<in>($a, %b) { %b{$a}:exists }
say 2 in 22;
say 2 !in (1, 22, 23);
say 22 in (1, 22, 23);
say "a" in {a => "b"};
say "a" !in {aa => "b"};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment