From 78ffebc5d69197d3961d04bb181a1ef1336aa6a1 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Fri, 6 Mar 2026 10:39:17 +0100 Subject: [PATCH] keep the `takewhile` doc string within the docs PR #143 made `takewhile` an alias for `Iterators.takewhile`, but unintentionally removed the `takewhile` doc string from the IterTools docs. Keep a binding for `takewhile`, thus ensuring the doc string is still in the IterTools docs. Additionally, say that `takewhile` is just an alias in the doc string. --- src/IterTools.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/IterTools.jl b/src/IterTools.jl index 5a9db02..b5e62f6 100644 --- a/src/IterTools.jl +++ b/src/IterTools.jl @@ -1,7 +1,6 @@ module IterTools import Base.Iterators: drop, take -using Base.Iterators: takewhile import Base: iterate, eltype, length, size, peek import Base: tail @@ -920,11 +919,14 @@ function iterate(ff::FlagFirst, state = (true, )) (isfirst, elt), (false, nextstate) end +const takewhile = Iterators.takewhile + """ takewhile(cond, xs) An iterator that yields values from the iterator `xs` as long as the predicate `cond` is true. +Alias for `Iterators.takewhile`. ```jldoctest julia> collect(takewhile(x-> x^2 < 10, 1:100))