Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eliminates wrong definition of map
This addresses partially #2675. Probably new examples will need to be
added to clarify how the sigilless argument works.
  • Loading branch information
JJ committed May 6, 2019
1 parent 18d2226 commit 8b23372
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions doc/Type/List.pod6
Expand Up @@ -267,14 +267,12 @@ will also return a C<Junction> with concatenation done as much as possible:
=head2 routine map
Defined as:
sub map(&code, *@elems --> Seq:D)
method map(List:D: &code --> Seq:D)
This method or sub is defined in L<C<Any>|/type/Any#method_map>. Examples
applied to lists are included here for the purpose of illustration.
Invokes C<&code> for each element and gathers the return values in a
sequence and returns it. This happens lazily, i.e. C<&code> is only
invoked when the return values are accessed.Examples:
For a list, it invokes C<&code> for each element and gathers the return values
in a sequence and returns it. This happens lazily, i.e. C<&code> is only invoked
when the return values are accessed.Examples:
=for code
say ('hello', 1, 22/7, 42, 'world').map: { .^name } # OUTPUT: «(Str Int Rat Int Str)␤»
Expand All @@ -292,9 +290,9 @@ Note that C<map> does not flatten embedded lists and arrays, so
((1, 2), <a b>).map({ .join(',')})
passes C<(1, 2)> and C<< <a b> >> in turn to the block, leading to a total
of two iterations and the result sequence C<"1,2", "a,b">.
See L<method flatmap|/type/List#method_flatmap> for an alternative that flattens.
passes C<(1, 2)> and C<< <a b> >> in turn to the block, leading to a total of
two iterations and the result sequence C<"1,2", "a,b">. See
L<method flatmap|/type/List#method_flatmap> for an alternative that flattens.
If C<&code> is a L<Block|/type/Block> loop phasers will be executed and
loop control statements will be treated as in loop control flow. Please
Expand Down

0 comments on commit 8b23372

Please sign in to comment.