Skip to content

Commit c98739a

Browse files
author
a
committed
no type
1 parent 3331fd2 commit c98739a

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

src/TermInterface.jl

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ Returns `true` if `x` is an expression tree (an S-expression). If true, `head` a
1515
isexpr(x) = false
1616
export isexpr
1717

18-
"""
19-
symtype(expr)
20-
21-
Returns the symbolic type of `expr`. By default this is just `typeof(expr)`.
22-
Define this for your symbolic types if you want `SymbolicUtils.simplify` to apply rules
23-
specific to numbers (such as commutativity of multiplication). Or such
24-
rules that may be implemented in the future.
25-
"""
26-
function symtype(x)
27-
typeof(x)
28-
end
29-
export symtype
3018

3119
"""
3220
issym(x)
@@ -109,10 +97,10 @@ function metadata end
10997

11098

11199
"""
112-
maketerm(T, head, children, type, metadata)
100+
maketerm(T, head, children, metadata)
113101
114102
Constructs an expression. `T` is a constructor type, `head` and `children` are
115-
the head and tail of the S-expression, `type` is the `type` of the S-expression.
103+
the head and tail of the S-expression.
116104
`metadata` is any metadata attached to this expression.
117105
118106
Note that `maketerm` may not necessarily return an object of type `T`. For example,
@@ -125,7 +113,7 @@ the sub-expression. `T` will be the type of the outer expression.
125113
126114
Packages providing expression types _must_ implement this method for each expression type.
127115
128-
Giving `nothing` for `type` or `metadata` results in a default being selected.
116+
Giving `nothing` for `metadata` should result in a default being selected.
129117
"""
130118

131119
function maketerm end

src/expr.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ children(e::Expr) = e.args
1010
operation(e::Expr) = iscall(e) ? first(children(e)) : error("operation called on a non-function call expression")
1111
arguments(e::Expr) = iscall(e) ? @view(e.args[2:end]) : error("arguments called on a non-function call expression")
1212

13-
function maketerm(::Type{Expr}, head, args, type, metadata)
14-
Expr(head, args...)
15-
end
13+
maketerm(::Type{Expr}, head, args, metadata) = Expr(head, args...)

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using Test
99
@test arguments(ex) == [:a, :b]
1010
@test isexpr(ex)
1111
@test iscall(ex)
12-
@test ex == maketerm(Expr, :call, [:f, :a, :b], nothing, nothing)
12+
@test ex == maketerm(Expr, :call, [:f, :a, :b], nothing)
1313

1414

1515
ex = :(arr[i, j])
@@ -18,5 +18,5 @@ using Test
1818
@test_throws ErrorException arguments(ex)
1919
@test isexpr(ex)
2020
@test !iscall(ex)
21-
@test ex == maketerm(Expr, :ref, [:arr, :i, :j], nothing, nothing)
21+
@test ex == maketerm(Expr, :ref, [:arr, :i, :j], nothing)
2222
end

0 commit comments

Comments
 (0)