Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reflow while revising #1803
  • Loading branch information
JJ committed May 10, 2019
1 parent 1f8e0da commit 671eb50
Showing 1 changed file with 38 additions and 34 deletions.
72 changes: 38 additions & 34 deletions doc/Type/Any.pod6
Expand Up @@ -117,10 +117,10 @@ Defined as:
method push(|values --> Positional:D)
The method push is defined for undefined invocants and allows for
autovivifying undefined to an empty L<Array|/type/Array>, unless the undefined value
implements L<Positional|/type/Positional> already. The argument provided will then be pushed
into the newly created Array.
The method push is defined for undefined invocants and allows for autovivifying
undefined to an empty L<Array|/type/Array>, unless the undefined value
implements L<Positional|/type/Positional> already. The argument provided will
then be pushed into the newly created Array.
my %h;
say %h<a>; # OUTPUT: «(Any)␤» <-- Undefined
Expand Down Expand Up @@ -193,9 +193,10 @@ Defined as:
method deepmap(&block --> List) is nodal
C<deepmap> will apply C<&block> to each element and return a new L<List|/type/List> with
the return values of C<&block>, unless the element does the L<Iterable|/type/Iterable> role.
For those elements L<deepmap|/routine/deepmap> will descend recursively into the sublist.
C<deepmap> will apply C<&block> to each element and return a new
L<List|/type/List> with the return values of C<&block>, unless the element does
the L<Iterable|/type/Iterable> role. For those elements
L<deepmap|/routine/deepmap> will descend recursively into the sublist.
say [[1,2,3],[[4,5],6,7]].deepmap(* + 1);
# OUTPUT: «[[2 3 4] [[5 6] 7 8]]␤»
Expand Down Expand Up @@ -232,19 +233,25 @@ number 3 and squared. In the next case, however
say [[1,2,3],[[4,5],6.1,7.2]].duckmap( -> Rat $_ { $_²} );
# OUTPUT: «[[1 2 3] [[4 5] 37.21 51.84]]␤»
3-item lists are not C<Rat>, so it descends recursively, but eventually only applies the operation to those that walk (or slither, as the case may be) like a C<Rat>.
3-item lists are not C<Rat>, so it descends recursively, but eventually only
applies the operation to those that walk (or slither, as the case may be) like a
C<Rat>.
Although on the surface (and name), C<duckmap> might look similar to L<C<deepmap>|/routine/deepmap>, the latter is applied recursively regardless of the type of the item.
Although on the surface (and name), C<duckmap> might look similar to
L<C<deepmap>|/routine/deepmap>, the latter is applied recursively regardless of
the type of the item.
=head2 method nodemap
Defined as:
method nodemap(&block --> List) is nodal
C<nodemap> will apply C<&block> to each element and return a new L<List|/type/List> with
the return values of C<&block>. In contrast to L<deepmap|/routine/deepmap> it will B<not> descend
recursively into sublists if it finds elements which L<does|/routine/does> the L<Iterable|/type/Iterable> role.
C<nodemap> will apply C<&block> to each element and return a new
L<List|/type/List> with the return values of C<&block>. In contrast to
L<deepmap|/routine/deepmap> it will B<not> descend recursively into sublists if
it finds elements which L<does|/routine/does> the L<Iterable|/type/Iterable>
role.
say [[1,2,3], [[4,5],6,7], 7].nodemap(*+1);
# OUTPUT: «(4, 4, 8)␤»
Expand Down Expand Up @@ -459,8 +466,8 @@ Defined as:
method BagHash(--> BagHash:D) is nodal
Coerces the invocant to L<BagHash|/type/BagHash>, whereby L<Positionals|/type/Positional>
are treated as lists of values.
Coerces the invocant to L<BagHash|/type/BagHash>, whereby
L<Positionals|/type/Positional> are treated as lists of values.
=head2 method Set
Expand All @@ -477,8 +484,8 @@ Defined as:
method SetHash(--> SetHash:D) is nodal
Coerces the invocant to L<SetHash|/type/SetHash>, whereby L<Positionals|/type/Positional>
are treated as lists of values.
Coerces the invocant to L<SetHash|/type/SetHash>, whereby
L<Positionals|/type/Positional> are treated as lists of values.
=head2 method Mix
Expand All @@ -495,8 +502,8 @@ Defined as:
method MixHash(--> MixHash:D) is nodal
Coerces the invocant to L<MixHash|/type/MixHash>, whereby L<Positionals|/type/Positional>
are treated as lists of values.
Coerces the invocant to L<MixHash|/type/MixHash>, whereby
L<Positionals|/type/Positional> are treated as lists of values.
=head2 method Supply
Expand All @@ -516,13 +523,12 @@ Defined as:
multi sub min(+args, :&by!)
multi sub min(+args)
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically smallest
element. In C<sub> form, the invocant is passed as an argument.
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically
smallest element. In C<sub> form, the invocant is passed as an argument.
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
into the filter, and its return value is compared instead of the
original value. The original value is still the one returned from
C<min>.
If a L<Callable|/type/Callable> positional argument is provided, each value is
passed into the filter, and its return value is compared instead of the original
value. The original value is still the one returned from C<min>.
say (1,7,3).min(); # OUTPUT:«1␤»
say (1,7,3).min({1/$_}); # OUTPUT:«7␤»
Expand All @@ -538,13 +544,12 @@ Defined as:
multi sub max(+args, :&by!)
multi sub max(+args)
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically largest
element.
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically
largest element.
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
into the filter, and the return value is compared instead of the
original value. The original value is still the one returned from
C<max>.
If a L<Callable|/type/Callable> positional argument is provided, each value is
passed into the filter, and the return value is compared instead of the original
value. The original value is still the one returned from C<max>.
say (1,7,3).max(); # OUTPUT:«7␤»
say (1,7,3).max({1/$_}); # OUTPUT:«1␤»
Expand All @@ -562,10 +567,9 @@ Defined as:
Returns a C<Range> from the smallest to the largest element.
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
into the filter, and its return value is compared instead of the
original value. The original values are still used in the returned
C<Range>.
If a L<Callable|/type/Callable> positional argument is provided, each value is
passed into the filter, and its return value is compared instead of the original
value. The original values are still used in the returned C<Range>.
say (1,7,3).minmax(); # OUTPUT:«1..7␤»
say (1,7,3).minmax({-$_}); # OUTPUT:«7..1␤»
Expand Down

0 comments on commit 671eb50

Please sign in to comment.