Created
September 30, 2020 18:39
-
-
Save gfldex/b94039d4bd57a063c6b3e94a23683ef1 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
use v6; | |
proto s(|c) { | |
my $capture-types := c.list.map({.WHAT}).cache; | |
for &?ROUTINE.candidates -> &c { | |
my @candidate-types := &c.signature.params».type; | |
if @candidate-types (==) $capture-types { | |
my @right-order; | |
for @candidate-types -> \type { | |
@right-order.push: c.grep({type === $_.WHAT})[0]; | |
} | |
return &c(|@right-order); | |
} | |
} | |
} | |
multi s(Int $i, Str $s) { | |
say [$i, $s]; | |
} | |
s('answer', 42); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment