Skip to content

Commit 590083e

Browse files
committed
Change all unsorted_arguments to arguments
1 parent 4e26a2d commit 590083e

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

src/code.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ end
744744
function cse_state!(state, t)
745745
!iscall(t) && return t
746746
state[t] = Base.get(state, t, 0) + 1
747-
foreach(x->cse_state!(state, x), unsorted_arguments(t))
747+
foreach(x->cse_state!(state, x), arguments(t))
748748
end
749749

750750
function cse_block!(assignments, counter, names, name, state, x)
@@ -759,7 +759,7 @@ function cse_block!(assignments, counter, names, name, state, x)
759759
return sym
760760
end
761761
elseif iscall(x)
762-
args = map(a->cse_block!(assignments, counter, names, name, state,a), unsorted_arguments(x))
762+
args = map(a->cse_block!(assignments, counter, names, name, state,a), arguments(x))
763763
if isterm(x)
764764
return term(operation(x), args...)
765765
else

src/interface.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ is the function being called.
3636
function operation end
3737

3838
"""
39-
arguments(x)
39+
sorted_arguments(x)
4040
4141
Get the arguments of `x`, must be defined if `iscall(x)` is `true`.
4242
"""
43-
function arguments end
43+
function sorted_arguments end
4444

4545
"""
46-
unsorted_arguments(x::T)
46+
sorted_arguments(x::T)
4747
4848
If x is a term satisfying `iscall(x)` and your term type `T` provides
4949
an optimized implementation for storing the arguments, this function can
5050
be used to retrieve the arguments when the order of arguments does not matter
5151
but the speed of the operation does.
5252
"""
53-
unsorted_arguments(x) = arguments(x)
54-
arity(x) = length(unsorted_arguments(x))
53+
function arguments end
54+
arity(x) = length(arguments(x))
5555

5656
"""
5757
metadata(x)

src/ordering.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function lexlt(degs1, degs2)
6565
return false # they are equal
6666
end
6767

68-
_arglen(a) = iscall(a) ? length(unsorted_arguments(a)) : 0
68+
_arglen(a) = iscall(a) ? length(arguments(a)) : 0
6969

7070
function <(a::Tuple, b::Tuple)
7171
for (x, y) in zip(a, b)

src/polyform.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ end
347347

348348
function add_with_div(x, flatten=true)
349349
(!iscall(x) || operation(x) != (+)) && return x
350-
aa = unsorted_arguments(x)
350+
aa = arguments(x)
351351
!any(a->isdiv(a), aa) && return x # no rewrite necessary
352352

353353
divs = filter(a->isdiv(a), aa)
@@ -385,12 +385,12 @@ end
385385

386386
function needs_div_rules(x)
387387
(isdiv(x) && !(x.num isa Number) && !(x.den isa Number)) ||
388-
(iscall(x) && operation(x) === (+) && count(has_div, unsorted_arguments(x)) > 1) ||
389-
(iscall(x) && any(needs_div_rules, unsorted_arguments(x)))
388+
(iscall(x) && operation(x) === (+) && count(has_div, arguments(x)) > 1) ||
389+
(iscall(x) && any(needs_div_rules, arguments(x)))
390390
end
391391

392392
function has_div(x)
393-
return isdiv(x) || (iscall(x) && any(has_div, unsorted_arguments(x)))
393+
return isdiv(x) || (iscall(x) && any(has_div, arguments(x)))
394394
end
395395

396396
flatten_pows(xs) = map(xs) do x
@@ -418,8 +418,8 @@ Has optimized processes for `Mul` and `Pow` terms.
418418
function quick_cancel(d)
419419
if ispow(d) && isdiv(d.base)
420420
return quick_cancel((d.base.num^d.exp) / (d.base.den^d.exp))
421-
elseif ismul(d) && any(isdiv, unsorted_arguments(d))
422-
return prod(unsorted_arguments(d))
421+
elseif ismul(d) && any(isdiv, arguments(d))
422+
return prod(arguments(d))
423423
elseif isdiv(d)
424424
num, den = quick_cancel(d.num, d.den)
425425
return Div(num, den)

src/rewriters.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function (p::Walk{ord, C, F, false})(x) where {ord, C, F}
221221

222222
if iscall(x)
223223
x = p.maketerm(x, operation(x), map(PassThrough(p),
224-
unsorted_arguments(x)), metadata=metadata(x))
224+
arguments(x)), metadata=metadata(x))
225225
end
226226

227227
return ord === :post ? p.rw(x) : x

src/rule.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ function (acr::ACRule)(term)
399399
end
400400

401401
T = symtype(term)
402-
args = unsorted_arguments(term)
402+
args = arguments(term)
403403

404404
itr = acr.sets(eachindex(args), acr.arity)
405405

src/simplify.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ end
4545

4646
has_operation(x, op) = (iscall(x) && (operation(x) == op ||
4747
any(a->has_operation(a, op),
48-
unsorted_arguments(x))))
48+
arguments(x))))
4949

5050
Base.@deprecate simplify(x, ctx; kwargs...) simplify(x; rewriter=ctx, kwargs...)

src/substitute.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ function substitute(expr, dict; fold=true)
2020
op = substitute(operation(expr), dict; fold=fold)
2121
if fold
2222
canfold = !(op isa Symbolic)
23-
args = map(unsorted_arguments(expr)) do x
23+
args = map(arguments(expr)) do x
2424
x′ = substitute(x, dict; fold=fold)
2525
canfold = canfold && !(x′ isa Symbolic)
2626
x′
2727
end
2828
canfold && return op(args...)
2929
args
3030
else
31-
args = map(x->substitute(x, dict, fold=fold), unsorted_arguments(expr))
31+
args = map(x->substitute(x, dict, fold=fold), arguments(expr))
3232
end
3333

3434
maketerm(typeof(expr),

0 commit comments

Comments
 (0)