Skip to content

Commit 4452b65

Browse files
Merge pull request #100 from karlwessel/main
replace deprecated istree with iscall
2 parents c199a85 + 29a44bf commit 4452b65

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/SymbolicNumericIntegration.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module SymbolicNumericIntegration
22

33
using SymbolicUtils
4-
using SymbolicUtils: istree, operation, arguments
4+
using SymbolicUtils: iscall, operation, arguments
55
using Symbolics
66
using Symbolics: value, get_variables, expand_derivatives, coeff, Equation
77
using SymbolicUtils.Rewriters

src/rules.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ h_rules = [@rule +(~~xs) => ω + sum(~~xs)
278278
# it is roughly similar ro kolmogorov complexity
279279
function complexity(eq)
280280
eq = value(eq)
281-
if istree(eq)
281+
if iscall(eq)
282282
return 1 + sum(complexity(t) for t in args(eq))
283283
elseif is_number(eq)
284284
return abs(eq)

src/tree.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22

33
function is_add(eq)
44
y = value(eq)
5-
return istree(y) && exprtype(y) == SymbolicUtils.ADD
5+
return iscall(y) && exprtype(y) == SymbolicUtils.ADD
66
end
77

88
function is_mul(eq)
99
y = value(eq)
10-
return istree(y) && exprtype(y) == SymbolicUtils.MUL
10+
return iscall(y) && exprtype(y) == SymbolicUtils.MUL
1111
end
1212

1313
function is_pow(eq)
1414
y = value(eq)
15-
return istree(y) && exprtype(y) == SymbolicUtils.POW
15+
return iscall(y) && exprtype(y) == SymbolicUtils.POW
1616
end
1717

1818
function is_div(eq)
1919
y = value(eq)
20-
return istree(y) && exprtype(y) == SymbolicUtils.DIV
20+
return iscall(y) && exprtype(y) == SymbolicUtils.DIV
2121
end
2222

2323
is_term(eq) = SymbolicUtils.isterm(value(eq))
2424
# is_sym(eq) = SymbolicUtils.issym(value(eq))
2525

2626
function args(eq)
2727
eq = value(eq)
28-
return istree(eq) ? arguments(eq) : []
28+
return iscall(eq) ? arguments(eq) : []
2929
end
3030

3131
diff(eq, x) = expand_derivatives(Differential(x)(eq))

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ end
9999
# pox(k,n) means k*x^n
100100
@syms pox(k, n)
101101

102-
is_pox(x) = istree(x) && operation(x) == pox
102+
is_pox(x) = iscall(x) && operation(x) == pox
103103
is_not_pox(x) = !is_pox(x)
104104

105105
get_coef(p) = is_pox(p) ? arguments(p)[1] : p
@@ -127,7 +127,7 @@ function collect_powers(eq, x)
127127
#eq = Prewalk(PassThrough(count_rule1))(eq)
128128
eq = Fixpoint(Prewalk(PassThrough(Chain([count_rule1, count_rule2, count_rule3]))))(eq)
129129

130-
if !istree(eq)
130+
if !iscall(eq)
131131
return Dict{Any, Any}(0 => eq)
132132
elseif is_pox(eq)
133133
return Dict{Any, Any}(get_power(eq) => get_coef(eq))

0 commit comments

Comments
 (0)