Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created March 25, 2014 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/9772688 to your computer and use it in GitHub Desktop.
Save jnthn/9772688 to your computer and use it in GitHub Desktop.
sub trait_mod:<is>(&c, :$curried!) {
my $arity = &c.arity;
&c.wrap(-> |args {
args.list.elems == $arity
?? callsame()
!! &c.assuming(|args)
});
}
sub foo($a, $b) is curried {
say $a + $b;
}
foo(3, 4);
my $c = foo(5);
$c(6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment