Missing method for √
danbe opened this issue · comments
danbe commented
On Reduce.jl v1.2.6 √:x results in a MethodError, I'd expect it to work in the same way as sqrt(:x). Same issue for √(::Expr).
This is a small issue that can easily be worked around by defining the functions by hand.
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0 (2020-03-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Reduce
Reduce (Free CSL version, revision 5286), 01-Mar-20 ...
REPL mode REDUCE initialized. Press } to enter and backspace to exit.
julia> @force using Reduce.Algebra
julia> sqrt(:x)
:(sqrt(x))
julia> √:x
ERROR: MethodError: no method matching sqrt(::Symbol)
Closest candidates are:
sqrt(::Float16) at math.jl:1114
sqrt(::Complex{Float16}) at math.jl:1115
sqrt(::Missing) at math.jl:1167
...
Stacktrace:
[1] top-level scope at REPL[4]:1
julia> import Base.√
julia> √(x::Symbol) = sqrt(x) # Add the missing method definition
sqrt (generic function with 20 methods)
julia> √:x # now it works
:(sqrt(x))