Skip to content

Instantly share code, notes, and snippets.

@KamilaBorowska
Created December 10, 2012 16:06
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/4251501 to your computer and use it in GitHub Desktop.
Save KamilaBorowska/4251501 to your computer and use it in GitHub Desktop.
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