Skip to content

Commit a2dfcf6

Browse files
authored
Merge pull request #214 from JuliaSymbolics/myb/num
Add skips in number_methods
2 parents bde73d1 + d79ea63 commit a2dfcf6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SymbolicUtils"
22
uuid = "d1185830-fcd6-423d-90d6-eec64667417b"
33
authors = ["Shashi Gowda"]
4-
version = "0.8.3"
4+
version = "0.8.4"
55

66
[deps]
77
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"

src/methods.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ islike(a, T) = symtype(a) <: T
3434
function number_methods(T, rhs1, rhs2, options=nothing)
3535
exprs = []
3636

37-
skip_basics = !isnothing(options) ? options == :skipbasics : false
37+
skip_basics = options !== nothing ? options == :skipbasics : false
38+
skips = Meta.isexpr(options, [:vcat, :hcat, :vect]) ? Set(options.args) : []
3839
basic_monadic = [-, +]
3940
basic_diadic = [+, -, *, /, \, ^]
4041

4142
rhs2 = :($assert_like(f, Number, a, b); $rhs2)
4243
rhs1 = :($assert_like(f, Number, a); $rhs1)
4344

4445
for f in (skip_basics ? diadic : vcat(basic_diadic, diadic))
46+
nameof(f) in skips && continue
4547
for S in previously_declared_for
4648
push!(exprs, quote
4749
(f::$(typeof(f)))(a::$T, b::$S) = $rhs2
@@ -62,6 +64,7 @@ function number_methods(T, rhs1, rhs2, options=nothing)
6264
end
6365

6466
for f in (skip_basics ? monadic : vcat(basic_monadic, monadic))
67+
nameof(f) in skips && continue
6568
push!(exprs, :((f::$(typeof(f)))(a::$T) = $rhs1))
6669
end
6770
push!(exprs, :(push!($previously_declared_for, $T)))

0 commit comments

Comments
 (0)