Skip to content

Commit

Permalink
flatmap docstring fixes, NEWS (#44905)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlw0 authored Apr 14, 2022
1 parent 6319b3a commit c0c7194
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Build system changes
New library functions
---------------------

* `Iterators.flatmap` was added ([#44792]).

Library changes
---------------

Expand Down
6 changes: 5 additions & 1 deletion base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,11 @@ last(f::Flatten) = last(last(f.it))
Equivalent to `flatten(map(f, iterators...))`.
See also [`Iterators.flatten`](@ref), [`Iterators.map`](@ref).
!!! compat "Julia 1.9"
This function was added in Julia 1.9.
# Examples
```jldoctest
julia> Iterators.flatmap(n->-n:2:n, 1:3) |> collect
Expand All @@ -1182,7 +1187,6 @@ julia> Iterators.flatmap(n->-n:2:n, 1:3) |> collect
3
```
"""
# flatmap = flatten ∘ map
flatmap(f, c...) = flatten(map(f, c...))

"""
Expand Down
1 change: 1 addition & 0 deletions doc/src/base/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Base.Iterators.cycle
Base.Iterators.repeated
Base.Iterators.product
Base.Iterators.flatten
Base.Iterators.flatmap
Base.Iterators.partition
Base.Iterators.map
Base.Iterators.filter
Expand Down

0 comments on commit c0c7194

Please sign in to comment.