: my @attrs = qw{ name type breed }
: my Pet @list=qw{
: fido dog collie
: fluffy cat siamese
: } ~~ sub (@x) { map { _ => _ } @attrs x Inf ^, @x }
: ~~ sub (@x) { map { { _ , _ , _ } } @x ;
by the way , ~~ seems to work like unix "|" pipe .
in the Apo4 the entry says
@a ~~ sub ( @x ) { ... } ----> &b(@a)
will it hande that :
@a ~~ map { _ => _ }
~~ map { {_,_,_} }
where the first *unsupplyed* argument to map
is expected to be *list* ?
also , is here the following DWIMmery in place
sub pairs ( $x,$y ){ $x => $y } ;
sub triples ( $x,$y,$z ){ {$x,$y,$z} };
@a ~~ &pairs ~~ &triples ;
?
so that ~~ will wrap "for" loop around "pairs" and "tripples" ,
similar to "-n" perl flag ;