Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/comp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ end
# Comparison of PolyVar

function (==)(x::PolyVar{C}, y::PolyVar{C}) where C
x.id == y.id
x.id == y.id && x.name == y.name
end

Base.isless(x::PolyVar{C}, y::PolyVar{C}) where C = isless(y.id, x.id)
Base.isless(x::PolyVar{C}, y::PolyVar{C}) where C = isless(x.name, y.name)

# Comparison of Monomial

Expand Down
7 changes: 2 additions & 5 deletions src/var.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ macro ncpolyvar(args...)
end

struct PolyVar{C} <: AbstractVariable
id::Int
id::UInt
name::String

function PolyVar{C}(name::AbstractString) where {C}
# gensym returns something like Symbol("##42")
# we first remove "##" and then parse it into an Int
id = parse(Int, string(gensym())[3:end])
new(id, convert(String, name))
new(hash(name), convert(String, name))
end
end

Expand Down