Skip to content

Commit 8d03c71

Browse files
authored
Merge pull request #5 from JuliaSymbolics/s/sym
add a default issym, make it work on types
2 parents def31aa + c7cec41 commit 8d03c71

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TermInterface"
22
uuid = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"
33
authors = ["Shashi Gowda <gowda@mit.edu>", "Alessandro Cheli <sudo-woodo3@protonmail.com>"]
4-
version = "0.1.7"
4+
version = "0.1.8"
55

66
[compat]
77
julia = "1"

src/TermInterface.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export symtype
3030
Returns `true` if `x` is a symbol. If true, `nameof` must be defined
3131
on `x` and must return a Symbol.
3232
"""
33-
function issym end
33+
issym(x) = issym(typeof(x))
34+
issym(x::Type{T}) where {T} = false
3435
export issym
3536

3637
"""
@@ -96,7 +97,7 @@ similarterm(x, head, args, symtype=nothing; metadata=nothing) =
9697
similarterm(x::Type{Expr}, head, args, symtype=nothing; metadata=nothing) = Expr(head, args...)
9798

9899
function similarterm(x::Type{T}, head, args, symtype=nothing; metadata=nothing) where T
99-
if !istree(T) head else head(args...) end
100+
!istree(T) ? head : head(args...)
100101
end
101102
export similarterm
102103

0 commit comments

Comments
 (0)