In the following the 「:」 makes it so you don't need parenthesis
(…).sort: …
(…).sort(…)
The reason there needs to be a space is so it isn't confused for an adverb.
「*.Version」 is a method call turned into a lambda.
Basically it creates a lambda where the only thing it does is call a method
named 「Version」
A 「*」 where a term is expected is an instance of Whatever.
If you use that with an operator it becomes a WhateverCode lambda.
sub say-the-type ( $_ ) {
say .^name
}
say-the-type *; # Whatever
say -the-type *.method; # WhateverCode
On Mon, May 25, 2020 at 1:24 PM ToddAndMargo via perl6-users <
[email protected]> wrote:
> Hi All,
>
> Looking at the following:
>
> > my @things = <a5.1 a2.3 b1a23 a1b33 a1 a2rc2>.sort: *.Version; dd
> @things; for @things {say $_;}
>
> Array @things = ["a1b33", "a1", "a2rc2", "a2.3", "a5.1", "b1a23"]
>
> a1b33
> a1
> a2rc2
> a2.3
> a5.1
> b1a23
>
> Other than not quite getting the alpha, beta, and
> release candidate thing down, I do not understand:
>
> .sort: *.Version
>
> 1) What does the `:` do?
>
> 2) Why the space?
>
> 3) What does the `*` do?
>
> 4) Is the dot before Version mean something other
> than .Version being a method?
>
> Yours in confusion,
> -T
>