Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define == on Variable #1

Merged
merged 1 commit into from
Feb 12, 2020
Merged

Define == on Variable #1

merged 1 commit into from
Feb 12, 2020

Conversation

YingboMa
Copy link
Member

No description provided.

@@ -16,6 +16,9 @@ struct Variable <: Symbolic
end
Variable(x) = Variable(x, Number)
symtype(v::Variable) = v.type
Base.:(==)(a::Variable, b::Variable) = a === b
Base.:(==)(::Variable, ::Symbolic) = false
Base.:(==)(::Symbolic, ::Variable) = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

julia> a == a*a
ERROR: StackOverflowError:
Stacktrace:
 [1] isequal(::SymbolicUtils.Variable, ::SymbolicUtils.Term) at ./operators.jl:123
 [2] ==(::SymbolicUtils.Variable, ::SymbolicUtils.Term) at /Users/yingboma/.julia/dev/SymbolicUtils/src/symbolic.jl:3
 ... (the last 2 lines are repeated 39998 more times)
 [79999] isequal(::SymbolicUtils.Variable, ::SymbolicUtils.Term) at ./operators.jl:123

@shashi shashi merged commit c1533f7 into master Feb 12, 2020
@shashi shashi deleted the myb/var branch April 26, 2020 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants