File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ Converts MathLink `WExpr`essions to Julia `Expr`essions
88function W2JuliaExpr (wexpr:: WExpr )
99 # ###Check if the operator has an alias
1010 if haskey (funcDict, wexpr. head. name)
11+ # ###Use the alias
1112 Operator= funcDict[wexpr. head. name]
1213 else
13- Operator= Symbol (wexpr. head. name)
14+ # ###Use the name directly as a symbol (but in lowercase)
15+ Operator= Symbol (lowercase (wexpr. head. name))
1416 end
1517 return Expr (:call ,Operator,[W2JuliaExpr (arg) for arg in wexpr. args]. .. )
1618end
@@ -23,6 +25,4 @@ funcDict=Dict("Plus"=>:+,
2325 " Minus" => :- ,
2426 " Power" => :^ ,
2527 " Times" => :* ,
26- " Sin" => :sin ,
27- " Cos" => :cos ,
2828 )
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import MathLink: WExpr, WSymbol
1818 @test W2JuliaExpr (W ` Cos[a^b]` ) == :(cos (a^ b))
1919 @test W2JuliaExpr (W ` a/b` ) == :(a* (b^- 1 ))
2020 @test W2JuliaExpr (W ` a^b` ) == :(a^ b)
21+ @test W2JuliaExpr (W ` Exp[a]` ) == :(exp (a))
2122 end
2223end
2324
You can’t perform that action at this time.
0 commit comments