@@ -12,7 +12,7 @@ export degree, coeffs, variable
1212export polyval, polyint, polyder, roots, polyfit
1313export Pade, padeval
1414
15- import Base: start, next, done, length, size, eltype
15+ import Base: start, next, done, length, size, eltype, collect
1616import Base: endof, getindex, setindex!, copy, zero, one, convert, norm, gcd
1717import Base: show, print, * , / , // , - , + , == , isapprox, divrem, div, rem, eltype
1818import Base: promote_rule, truncate, chop, conj, transpose, dot, hash
@@ -134,7 +134,8 @@ convert{T, S<:Number}(::Type{Poly{T}}, x::S, var::SymbolLike=:x) = Poly(T[x], va
134134convert {T, S<:Number} (:: Type{Poly{T}} , x:: AbstractArray{S} , var:: SymbolLike = :x ) = map (el-> Poly (T[el],var), x)
135135promote_rule {T, S} (:: Type{Poly{T}} , :: Type{Poly{S}} ) = Poly{promote_type (T, S)}
136136promote_rule {T, S<:Number} (:: Type{Poly{T}} , :: Type{S} ) = Poly{promote_type (T, S)}
137- eltype {T} (:: Poly{T} ) = Poly{T}
137+ # Check JuliaLang/METADATA.jl#8528
138+ eltype {T} (:: Poly{T} ) = T
138139
139140length (p:: Poly ) = length (coeffs (p))
140141endof (p:: Poly ) = length (p) - 1
@@ -144,6 +145,9 @@ next(p::Poly, state) = (temp = zeros(coeffs(p)); temp[state+1] = p[state]; (Pol
144145done (p:: Poly , state) = state > degree (p)
145146eltype {T} (:: Type{Poly{T}} ) = Poly{T}
146147
148+ # shortcut for collect(eltype, collection)
149+ collect {T} (p:: Poly{T} ) = collect (Poly{T}, p)
150+
147151size (p:: Poly ) = size (p. a)
148152size (p:: Poly , i:: Integer ) = size (p. a, i)
149153
0 commit comments