On 1/19/20 2:47 AM, ToddAndMargo via perl6-users wrote:
Hi All,
Thank you all for the wonderful help on this.
What I am still confused about is how to
read these silly definition lines:
multi sub infix:<+>($a, $b --> Numeric:D)
multi sub infix:<+^>($a, $b --> Int:D)
How exactly does the above tell me to do this?
$c = $a + $b
$c = $a +^ $b
I figured I'd start with addition and work my
way up.
It is what Elizabeth already said and a bit of latin would help.
prefix: +foo
'pre' means something like 'before'. What is before then. It is about
operators. So an operator goes before an argument. '+foo' here could
then be +$a.
Other prefix examples are ?$a, !$a, -$a, .
postfix: foo++
'post' means something like 'after'. The operator goes after the
argument. Examples
are $a++, $b--.
infix: foo + bar
This means that the operator is in between arguments. Like $a + $b, $a
** 2.
circumfix: [foo]
Means the operator goes around the argument. Like a list ( $a, $b, 3, 4
)
postcircumfix: foo[bar]
The operator here is placed around an argument which is placed after
another.
Like @a[$b], (^10)[3], %h{$k}
Marcel
Many thanks,
-T