| 165 | | [ hw !! 1 ] |
| 166 | | You can, because a Signature can contain Captures. |
| 167 | | |
| 168 | | sub apply (Code $f, Capture $args) { $f(*$args) } |
| 169 | | |
| | 164 | You can, as a Capture can contain another capture object in its invocant slot: |
| | 165 | |
| | 166 | my $x = \\3; |
| | 167 | say $$$x; # same as "say 3" |
| | 168 | |
| | 169 | = Q: Can I create a "pass-through" function that captures all arguments? |
| | 170 | |
| | 171 | Yes, using the \$ signature: |
| | 172 | |
| | 173 | sub f (\$args) { g(*$args) } |
| | 174 | f(1, 2, x => 42); # same as g(1, 2, x => 42) |
| | 175 | |
| | 176 | The $args above becomes a Capture object. |