Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Nov 9, 2023
1 parent 45e4c7d commit 674c3a1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,12 @@ function noperators(φ::SyntaxTree)::Integer
end

function Base.isequal(a::SyntaxTree, b::SyntaxTree)
return (
(arity(a) == 0 && arity(b) == 0 && a == b) ||
(Base.isequal(token(a), token(b)) &&
if arity(a) == 0 && arity(b) == 0
return a == b
else
return (Base.isequal(token(a), token(b)) &&
all(((c1,c2),)->Base.isequal(c1, c2), zip(children(a), children(b))))
)
end
end

Base.hash::SyntaxTree) = Base.hash(token(φ), Base.hash(children(φ)))
Expand Down Expand Up @@ -614,7 +615,7 @@ function truthsupertype(T::Type{<:Truth})
end

function Base.isless(t1::Truth, t2::Truth)
if t1 == t2
if Base.isequal(t1, t2)
return false
else
return error("Please, provide method Base.isless(::$(typeof(t1)), ::$(typeof(t2))).")
Expand Down

0 comments on commit 674c3a1

Please sign in to comment.