Skip to content

Instantly share code, notes, and snippets.

@KamilaBorowska
Created December 10, 2012 16:13
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/4251559 to your computer and use it in GitHub Desktop.
Save KamilaBorowska/4251559 to your computer and use it in GitHub Desktop.
#!/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'};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment