Closed timholy closed 1 year ago
I just discovered similar_variable
!
Since this is the first thing I thought of, perhaps for generic programming it could be added to TypedPolynomials too? In essence, have that constructor call similar_variable
.
For TypedPolynomials, the type depends on the name so it would be weird to have Variable{:x}(Val{:y})
return Variable{:y}
:
julia> typeof(x)
Variable{:x}
julia> typeof(similar_variable(x, Val{:y}))
Variable{:y}
Yeah, that would definitely be bad. I hadn't played enough with TypedPolynomials to realize what that would look like.
Rather than creating a variable with
Variable(name, V, M)
, sometimes it's easier to create one withVariable{V,M}(name)
. This allows one to create a new variable from an old one withtypeof(oldvar)(newname)
.