Skip to content

Commit e96b81b

Browse files
committed
flatmap is the last element of Any that needed rewriting
So this closes #1731
1 parent 3d492d2 commit e96b81b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

doc/Type/Any.pod6

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,20 @@ Defined as:
602602
603603
method flatmap(&block, :$label)
604604
605-
N<This method is deprecated in 6.d and will be removed in 6.e>
606-
Applies L<C<map>|/type/Any#method_map> to every element with the block and label
607-
used as an argument and flattens out the result using C<.flat>.
605+
B<DEPRECATION NOTICE>: This method is deprecated in 6.d and will be removed in
606+
6.e. Use C<.map> followed by C<.flat> instead.
607+
608+
Applies L<C<map>|/type/Any#method_map> to every element with the block and
609+
C<Label> used as an argument and flattens out the result using C<.flat>.
610+
611+
say "aabbccc".comb.Mix.flatmap: "→ " ~ *; # OUTPUT: «(→ b␉2 → c␉3 → a␉2)␤»
612+
613+
In this case, the elements of the C<Mix> are itemized to key␉value, and then
614+
mapped and flattened. Same result as
615+
616+
say "aabbccc".comb.Mix.map( "→ " ~ * ).flat
617+
618+
Which is why it is deprecated in 6.d and will be eventually eliminated in 6.e.
608619
609620
=head2 method roll
610621

0 commit comments

Comments
 (0)