Created
December 10, 2012 16:06
-
-
Save KamilaBorowska/4251501 to your computer and use it in GitHub Desktop.
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
glitchmr@feather ~/examples> cat in | |
#!/usr/bin/env perl6 | |
multi infix:<in>(Str $a, Str $b --> Bool) { so $b ~~ / $a / } | |
multi infix:<in>(Str $a, @b --> Bool) { so $a eq any @b } | |
multi infix:<in>(Str $a, %b --> Bool) { %b{$a}:exists } | |
say 'ab' in 'abc'; | |
say 'cake' in 'lolcakes'; | |
say 'win' in 'win'; | |
say 'lol' !in 'face'; | |
say 'fin' in ['a', 'b', 'fin', 'lol']; | |
say 'fi' !in ['a', 'b', 'fin', 'lol']; | |
say 'a' in {a => 'b'}; | |
say 'b' !in {a => 'b'}; | |
glitchmr@feather ~/examples> /usr/bin/perl6 in | |
===SORRY!=== | |
Cannot negate in because it is not iffy enough | |
at in:9 | |
------> say 'lol' !in⏏ 'face'; | |
glitchmr@feather ~/examples> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment