On Sun, Jan 19, 2020 at 08:25:15PM -0800, ToddAndMargo via perl6-users wrote: > One last question on htis. What does > > multi sub prefix:<+^>(Any --> Int:D) > > Mean. Prefix means before. +^(Any) get > me a participation trophy, so I do not > understand. > > > :'( > > INQUIRING MINDS WANT TO KNOW! (That is > a joke referencing a tabloid commercial.)
The <> characters surround the name of the operator, so the operator is
named "+^". This means that you would use it on $foo as:
$something = +^$foo;
The part in the parentheses is a description of what arguments this
function (the operator that we are now describing in terms of functions)
will take and what type it will return. The part before the --> sign is
what arguments it takes - in this case it takes a single argument that
must be of the Any type or one of its subtypes, so pretty much anything
(yeah, yeah, I know) in Raku may be used as an argument to this
operator. The part after the --> sign describes the type of the value
that the function (the +^ operator) will return - it says that the
returned value will be an integer and that it will always have a
definite value, it will not be an undefined value.
So this means that whatever you have in a variable $foo, you may write
+^$foo and you will get an integer.
G'luck,
Peter
--
Peter Pentchev roam@{ringlet.net,debian.org,FreeBSD.org} [email protected]
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
signature.asc
Description: PGP signature
