Created
August 19, 2023 20:44
-
-
Save FCO/56139e86d474cb8025cce5ace31fa293 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
class Agg does Callable { | |
has Callable @.subs; | |
has Signature $.signature = Signature.new: :params[|@!subs.map: |*.signature.params], :returns(Parameter.new(:type(Map()))); | |
method CALL-ME(|c) { | |
%( | |
|@.subs.map: { | |
my @names = .signature.params.grep({ .named }).map(|*.named_names); | |
my %params := (c.hash{@names}:p).Map; | |
|.(|%params) | |
} | |
) | |
} | |
} | |
class C { | |
::?CLASS.^add_method: "run-at", Agg.new: :subs[ sub (:$a) { :$a }, sub (:$b) { :c($b) } ] | |
} | |
say C.run-at: :1a, :2b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment