Skip to content

Commit 0082a01

Browse files
committed
shorten doc of single argument, and fix doctests
1 parent 4e49673 commit 0082a01

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

base/iterators.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,21 +1661,19 @@ end
16611661
nth(n::Integer)
16621662
16631663
Return a function that gets the `n`-th element from any iterator passed to it.
1664-
Throw a `BoundsError`[@ref] if not existing.
1665-
1666-
Fixes the second element. Equivalent to `Base.Fix2(nth, n)`.
1667-
Will advance any `Stateful`[@ref] iterator.
1664+
Equivalent to `Base.Fix2(nth, n)` or `itr -> nth(itr, n)`.
16681665
16691666
See also: [`nth`](@ref), [`Base.Fix2`](@ref)
16701667
# Examples
16711668
```jldoctest
16721669
julia> fifth_element = Iterators.nth(5)
1673-
(::Base.Fix2{typeof(nth), Int64}) (generic function with 1 method)
1670+
(::Base.Fix2{typeof(Base.Iterators.nth), Int64}) (generic function with 2 methods)
16741671
16751672
julia> fifth_element(reshape(1:30, (5,6)))
16761673
5
16771674
1678-
julia> map(Iterators.nth(3), my_vec)
1675+
julia> map(fifth_element, ("Willis", "Jovovich", "Oldman"))
1676+
('i', 'v', 'a')
16791677
```
16801678
"""
16811679
nth(n::Integer) = Base.Fix2(nth, n)

0 commit comments

Comments
 (0)