Skip to content

Commit

Permalink
Adds example for |, refs #1889
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jul 7, 2018
1 parent b066c68 commit b465f43
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions doc/Language/operators.pod6
Expand Up @@ -923,12 +923,23 @@ Coerces the argument to L<Str> by calling the L<Str|/type/List#method_Str> metho
=head2 prefix C«|»
Flattens objects of type L<Capture>, L<Pair>, L<List>, L<Map> and L<Hash>
into an argument list.
Outside of argument lists, it returns a L<Slip|/type/Slip>, which makes it
flatten into the outer list. Inside L<argument list|/language/list#Argument_List_(Capture)_Context> L<C<Positional>s|/type/Positional> are turned
into positional arguments and L<C<Associative>s|/type/Associative> are turned into named arguments.
Flattens objects of type L<Capture>, L<Pair>, L<List>, L<Map> and
L<Hash> into an argument list.
sub foo( *@args ) {
say @args.perl
};
foo( | <2 3 4>, 'a' | ' b', \( 3, 33) )
# OUTPUT: «[IntStr.new(2, "2"), IntStr.new(3, "3"),\
IntStr.new(4, "4"),any("a", " b"), \(3, 33)]␤»
Outside of argument lists, it returns a L<Slip|/type/Slip>, which makes
it flatten into the outer list. Inside L<argument
list|/language/list#Argument_List_(Capture)_Context>
L<C<Positional>s|/type/Positional> are turned into positional arguments
and L<C<Associative>s|/type/Associative> are turned into named
arguments.
=head2 prefix C«||»
Expand Down

0 comments on commit b465f43

Please sign in to comment.