On Mon, Aug 09, 2021 at 01:00:52PM -0700, Joseph Brenner wrote:
> There's this much:
>
> https://docs.raku.org/language/variables#index-entry-$$CIRCUMFLEX_ACCENT
>
> > If you have self-declared a parameter using $^a once, you may refer to it
> > using only $a thereafter.
>
> But it doesn't go a
There's this much:
https://docs.raku.org/language/variables#index-entry-$$CIRCUMFLEX_ACCENT
> If you have self-declared a parameter using $^a once, you may refer to it
> using only $a thereafter.
But it doesn't go anywhere near far enough. You *had better* to
refer to it as $a or you'll get s
Okay, so my central confusion here has to do with not
understanding that the caret gets used *only once* in
a construct like this:
my $cb = {
do if ($^a eq $^b) {
"$a";
} else {
"$a & $b";
}
};
say $cb( 'a', 'b' );
After $^a is used,
Here's a simple use of a callback that just works:
my $cb = {
"$^a & $^b";
};
say $cb('a', 'b'); # a & b
Just as an aside, it's interesting that this would be an error:
say $cb('a', 'b', 'c');
# Too many positionals passed; expected 2 arguments but got 3
The numbe