Skip to content

Commit

Permalink
Updated version number in Project.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
eswagel committed Jul 29, 2024
1 parent 419e4cf commit 780ea35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SymbolicsMathLink"
uuid = "7963cd39-1b62-4514-9cf0-788fb5452611"
authors = ["E. Swagel"]
version = "1.0.1"
version = "2.0.0"

[deps]
MathLink = "18c93696-a329-5786-9845-8443133fa0b4"
Expand Down
18 changes: 11 additions & 7 deletions src/wcall.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
function wcall(returnJulia::Union{Val{true}, Val{false}}, head::AbstractString, args...; kwargs...)
"""
wcall([returnJulia::Val{bool},] head::AbstractString, args...; returnJulia=Val(true), kwargs...)
Expand All @@ -10,12 +11,12 @@
- `kwargs...`: Keyword arguments to the Mathematica function. These can be Symbolics, Julia types, or Mathematica types.
# Returns
- If `returnJulia` is `false`, returns a Mathematica MathLink object representing the result of the Mathematica function.
- If `returnJulia` is `true` (default), returns a Julia expression representing the result of the Mathematica function.
- If `returnJulia` is `Val(false)`, returns a Mathematica MathLink object representing the result of the Mathematica function.
- If `returnJulia` is `Val(true)` (default), returns a Julia expression representing the result of the Mathematica function.
# Examples
```julia
julia> wcall("Solve", x^2 + 2x + 1 == 0, returnJulia=false)
julia> wcall(Val(false), "Solve", x^2 + 2x + 1 == 0)
MathLink.MathLinkObject(...)
julia> wcall("Solve", x^2 + 2x + 1 == 0)
Expand All @@ -24,12 +25,15 @@
-1 - x
```
"""
function wcall(::Val{false}, head::AbstractString, args...; kwargs...)
mathematica_result = wcall(head, args...; kwargs...)
return convert_to_julia(mathematica_result)

return wcall(returnJulia, head, expr_to_mathematica.(args)...; kwargs...)
end
wcall(::Val{true}, head::AbstractString, args::Vararg{Mtypes}; kwargs...) = begin
mathematica_result = wcall(Val(false), head, args...; kwargs...)
return mathematica_to_expr(mathematica_result)
end

wcall(::Val{true}, head::AbstractString, args...; kwargs...)=begin
wcall(::Val{false}, head::AbstractString, args::Vararg{Mtypes}; kwargs...) = begin
return weval(MathLink.WSymbol(head)(args...; kwargs...))
end

Expand Down

0 comments on commit 780ea35

Please sign in to comment.