Skip to content

Commit e7c385b

Browse files
committed
treat 0-arg function calls as variables in ordering
1 parent 69fb606 commit e7c385b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/simplify.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ end
7979
<(a::T, b::S) where {T, S} = T===S ? isless(a, b) : nameof(T) < nameof(S)
8080

8181
function <(a::Term, b::Term)
82+
if arglength(a) === 0
83+
return operation(a) <ₑ b
84+
elseif arglength(b) === 0
85+
return a <operation(b)
86+
end
87+
8288
if 0 < arglength(a) <= 2 && 0 < arglength(b) <= 2
8389
# e.g. a < sin(a) < b ^ 2 < b
8490
@goto compare_args

test/order.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,10 @@ end
5050
end
5151
end
5252
end
53+
54+
@testset "0-arg variable calls ordering" begin
55+
@syms z ρ
56+
57+
@test -1z() <ρ()
58+
@test !(ρ() <-1z())
59+
end

0 commit comments

Comments
 (0)