Front page | perl.perl6.users |
Postings from January 2020
my keeper on operators
From:
Tony Ewell via perl6-users
Date:
January 19, 2020 22:26
Subject:
my keeper on operators
Message ID:
071ecfc1-aa64-97e5-699d-da0d9403f994@zoho.com
Hi All,
Since several of you help me on this, this is my
keeper on the definition of operators. Marcel
helped a lot. He did an extraordinary job of
explaining things. He is cited in the keeper,
so I am not plagiarizing him.
:-)
-T
Raku /Perl 6:
https://docs.raku.org/language/functions#Defining_operators
Operators are just subroutines with funny [latin] names.
The funny names are composed of the category name (infix,
prefix, postfix, circumfix, postcircumfix), followed by a
colon, and a list of the operator name or names (two
components in the case of circumfix and postcircumfix).
Category names defined:
On 2020-01-19 08:52, Marcel Timmerman wrote:
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 [example] $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}
-
my keeper on operators
by Tony Ewell via perl6-users