Skip to content

Commit

Permalink
add postfix C<».>
Browse files Browse the repository at this point in the history
  • Loading branch information
gfldex committed Dec 10, 2015
1 parent fb993b8 commit 2490324
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Language/operators.pod
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,17 @@ L<List> is returned.
Technically this is not an operator, but syntax special-cased in the compiler.
=head2 postfix C<».> / postfix C«>>.»
Hyper method call operator will call a method on all elements of a C<List> out of order and return the list of return values in order.
my @a = <a b c>;
@a».say; # a␤b␤c␤
my @b = @a».ord; # [97, 98, 99]
sub foo(Str:D $c){ $c.ord * 2 }; # The first parameter of a method is the invocant.
say @a».&foo; # So we can pretend to have a method call with a sub that got a good first positional argument.
say @a».&({ .ord}); # Blocks have an implicit positional arguments that lands in $_. The latter can be obmitted for method calls.
=head2 X«postfix C<.postfix>
|postfix,.postfix;postcircumfix,.( );postcircumfix,.[ ];postcircumfix,.{ };postcircumfix,.< >»
Expand Down

0 comments on commit 2490324

Please sign in to comment.