You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -9,25 +9,25 @@ You should define the following methods for an expression tree type `T` with sym
9
9
with TermInterface.jl, and therefore with [SymbolicUtils.jl](https://github.com/JuliaSymbolics/SymbolicUtils.jl)
10
10
and [Metatheory.jl](https://github.com/0x0f0f0f/Metatheory.jl).
11
11
12
-
#### `isterm(x::T)` or `isterm(x::Type{T})`
12
+
#### `istree(x::T)` or `istree(x::Type{T})`
13
13
14
14
Check if `x` represents an expression tree. If returns true,
15
-
it will be assumed that `gethead(::T)` and `getargs(::T)`
15
+
it will be assumed that `operation(::T)` and `arguments(::T)`
16
16
methods are defined. Definining these three should allow use
17
17
of `SymbolicUtils.simplify` on custom types. Optionally `symtype(x)` can be
18
18
defined to return the expected type of the symbolic expression.
19
19
20
-
#### `gethead(x::T)`
20
+
#### `operation(x::T)`
21
21
22
22
Returns the head (a function object) performed by an expression
23
-
tree. Called only if `isterm(::T)` is true. Part of the API required
24
-
for `simplify` to work. Other required methods are `getargs` and `isterm`
23
+
tree. Called only if `istree(::T)` is true. Part of the API required
24
+
for `simplify` to work. Other required methods are `arguments` and `istree`
25
25
26
-
#### `getargs(x::T)`
26
+
#### `arguments(x::T)`
27
27
28
28
Returns the arguments (a `Vector`) for an expression tree.
29
-
Called only if `isterm(x)` is `true`. Part of the API required
30
-
for `simplify` to work. Other required methods are `gethead` and `isterm`
29
+
Called only if `istree(x)` is `true`. Part of the API required
30
+
for `simplify` to work. Other required methods are `operation` and `istree`
31
31
32
32
In addition, the methods for `Base.hash` and `Base.isequal` should also be implemented by the types for the purposes of substitution and equality matching respectively.
33
33
@@ -71,16 +71,16 @@ ex = 1 + (:x - 2)
71
71
```
72
72
73
73
74
-
How can we use SymbolicUtils.jl to convert `ex` to `(-)(:x, 1)`? We simply implement `isterm`,
74
+
How can we use SymbolicUtils.jl to convert `ex` to `(-)(:x, 1)`? We simply implement `istree`,
75
75
`head`, `arguments` and we'll be able to do rule-based rewriting on `Expr`s:
0 commit comments