Hi Todd, I would suggest reading https://docs.raku.org/language/optut.
For a slightly more thorough read https://docs.raku.org/language/functions#Defining_operators. On Sat, Jan 18, 2020 at 10:39 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Okay, I clearly do not understand what is > going on with these definitions, so please > correct my assumptions! > > > https://docs.raku.org/language/operators#infix_+ > https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT > > Question: would some kind soul please tell me how: > > multi sub infix:<+>($a, $b --> Numeric:D) > multi sub infix:<+^>($a, $b --> Int:D) > > gets turned into > > $c = $a + $b, and > $c = $a +^ $b > > > This is what I understand so far about > the definition lines: > > 1) "multi" means there a several way to do things > > 2) "sub" means subroutine: $c = +($a, $b) > > my $a=2; my $b=3; my $c = +($a, $b) > 2 > > And a participation trophy for the wrong answer. > > my $a=2; my $b=3; my $c = +^($a, $b) > -3 > > And I just won two a participation trophies! > > > 3) <> is a form of literal quote > > 4) infix:<+> means you can call it as a sub that > gives you back the wrong answer. > > $c = +($a, $b) > $c = +^($a, $b) > > 5) --> Numeric:D means it return a Numeric and > --> Int:D means it "coerces" your stuff and > return an Int, like it or not. > > Yours in confusion, > -T >