-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Labels
docsDocumentation issue (primary issue type)Documentation issue (primary issue type)
Description
https://docs.perl6.org/type/List#method_flatmap incorrectly suggests that flatmap
flattenes the input list before iterating it, when in fact it seems to flatten the result of the map operation:
dd ((1, 2), <a b>).map({ $_, $_ }); # (((1, 2), (1, 2)), (("a", "b"), ("a", "b"))).Seq
dd ((1, 2), <a b>).flatmap({ $_, $_ }); # (1, 2, 1, 2, "a", "b", "a", "b").Seq
The example given on the page should be removed altogether, as it lies about &uc
being called four times (it's called twice, once for each element of the input list), and doesn't produce a nested output so there's nothing to flatten, and thus fails to demonstrate what flatmap
actually does.
Metadata
Metadata
Assignees
Labels
docsDocumentation issue (primary issue type)Documentation issue (primary issue type)