Skip to content

Commit f2be2af

Browse files
committed
Add docs to all, any & map
1 parent ad632f2 commit f2be2af

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/common.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,27 @@ function Base.iszero(p::AbstractPolynomial)
301301
end
302302

303303
# See discussions in https://github.com/JuliaMath/Polynomials.jl/issues/258
304+
"""
305+
all(pred, poly::AbstractPolynomial)
306+
307+
Test whether all coefficients of an `AbstractPolynomial` satisfy predicate `pred`.
308+
309+
You can implement `isreal`, etc., to a `Polynomial` by using `all`.
310+
"""
304311
Base.all(pred, poly::AbstractPolynomial) = all(pred, poly[:])
312+
"""
313+
any(pred, poly::AbstractPolynomial)
314+
315+
Test whether any coefficient of an `AbstractPolynomial` satisfies predicate `pred`.
316+
"""
305317
Base.any(pred, poly::AbstractPolynomial) = any(pred, poly[:])
318+
"""
319+
map(fn, p::AbstractPolynomial)
320+
321+
Transform coefficients of `p` by applying a function (or other callables) `fn` to each of them.
322+
323+
You can implement `real`, etc., to a `Polynomial` by using `map`.
324+
"""
306325
Base.map(fn, p::P) where {P<:AbstractPolynomial} = (P)(map(fn, coeffs(p)), p.var)
307326

308327
"""

0 commit comments

Comments
 (0)