Skip to content

Commit a38b5d0

Browse files
committed
Remove incorrect deprecation warning and simplify docs
per lizmat, this has been the case since Christmas release!
1 parent 593ae47 commit a38b5d0

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

doc/Type/Any.rakudoc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -639,20 +639,7 @@ don't really have keys.
639639

640640
method flatmap(&block, :$label)
641641

642-
B<DEPRECATION NOTICE>: This method is deprecated in 6.d and will be removed in
643-
6.e. Use C<.map> followed by C<.flat> instead.
644-
645-
Applies L<C<map>|/type/Any#routine_map> to every element with the block and
646-
L<C<Label>|/type/Label> used as an argument and flattens out the result using C<.flat>.
647-
648-
say "aabbccc".comb.Mix.flatmap: "→ " ~ *; # OUTPUT: «(→ b␉2 → c␉3 → a␉2)␤»
649-
650-
In this case, the elements of the L<C<Mix>|/type/Mix> are itemized to key␉value, and then
651-
mapped and flattened. Same result as
652-
653-
say "aabbccc".comb.Mix.map( "→ " ~ * ).flat
654-
655-
Which is why it is deprecated in 6.d and will be eventually eliminated in 6.e.
642+
Convenience method, analogous to L<C<.map(&block)>|#method_map>L<C<.flat>|#method_flat>.
656643

657644
=head2 method roll
658645

doc/Type/List.rakudoc

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ Note that C<map> does not flatten embedded lists and arrays, so
378378
((1, 2), <a b>).map({ .join(',')})
379379

380380
passes C<(1, 2)> and C«<a b>» in turn to the block, leading to a total of
381-
two iterations and the result sequence C<"1,2", "a,b">. See
382-
L<method flatmap|/type/List#method_flatmap> for an alternative that flattens.
381+
two iterations and the result sequence C<"1,2", "a,b">.
383382

384383
If C<&code> is a L<C<Block>|/type/Block> loop phasers will be executed and
385384
loop control statements will be treated as in loop control flow. Please
@@ -404,26 +403,7 @@ be handled in the context of that L<C<Routine>|/type/Routine>.
404403

405404
method flatmap(List:D: &code --> Seq:D)
406405

407-
Like L«C<map>|/type/Any#routine_map» iterates over the elements of the invocant
408-
list, feeding each element in turn to the code reference, and assembling the
409-
return values from these invocations in a result list.
410-
411-
The use of C<flatmap> B<is strongly discouraged>. Instead of C<.flatmap( )>,
412-
please use C<.map( ).flat> as it is clear when the C<.flat> is called
413-
and is not confusing like C<.flatmap>.
414-
415-
Unlike C<map> it flattens non-itemized lists and arrays, so
416-
417-
## flatmap
418-
my @list = ('first1', ('second2', ('third3', 'third4'), 'second5'), 'first6');
419-
say @list.flatmap({.reverse}).raku;
420-
# OUTPUT: «("first1", "second5", "third3", "third4", "second2", "first6").Seq␤»
421-
## map
422-
say @list.map({"$_ was a {.^name}"}).raku;
423-
# OUTPUT: «("first1 was a Str", "second2 third3 third4 second5 was a List", "first6 was a Str").Seq␤»
424-
## .map .flat has the same output as .flatmap
425-
say @list.map({.reverse}).flat.raku;
426-
# OUTPUT: «("first1", "second5", "third3", "third4", "second2", "first6").Seq␤»
406+
Convenience method, analogous to L<C<.map(&block)>|#method_map>L<C<.flat>|#method_flat>.
427407

428408
=head2 method gist
429409

0 commit comments

Comments
 (0)