Created
January 28, 2013 09:22
-
-
Save KamilaBorowska/4654154 to your computer and use it in GitHub Desktop.
Infix "in"
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
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