On 2020-01-19 08:52, Marcel Timmerman wrote:
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
Hi Marcel,
Are you sitting down?
Guess what? I understand!
And that was a beautiful explanation. Started small,
defined the terms, then gave examples. Wonderful
technical writing. I wish I wrote so well. Ya,
you just got some fan mail!
I will post my keep on this in another thread.
-T