Tag: currying
-
How do you create a callable variable to call a class method with arguments?
7 I’m trying to create a callable variable for a class method. class Person { method walk(Str $direction) { say "Walking $direction"; } } I can create a callable variable for the method ‘walk’ that works as expected. my $person = Person.new; my $callable = $person.^find_method(‘walk’); $person.$callable(‘up’); # OUTPUT: "Walking up" Now I want to…