In Operators§
See primary documentation in context for infix ,
sub infix:<,>(*@a --> List:D) is assoc<list>
Constructs a higher-order Cool
from its arguments.
my @list = :god('Þor'), ['is',"mighty"]; say @list; # OUTPUT: «[god => Þor [is mighty]]» my %hash = :god('Þor'), :is("mighty"); say %hash.raku; # OUTPUT: «{:god("Þor"), :is("mighty")}» my %a = :11a, :22b; say %(%a, :33x); # OUTPUT: «{a => 11, b => 22, x => 33}»
In the first case it returns a List
, in the second case, since the arguments are Pair
s, it builds a Hash
.
It can also be used for constructing variables from other variables, collating elements of different types, in this case a Hash
and a Pair
:
my %features = %hash, :wields("hammer"); say %features; # OUTPUT: «{god => Þor, is => mighty, wields => hammer}»
The comma is also used syntactically as the separator of arguments in calls.