Skip to content

Commit f6942e9

Browse files
committed
MAge unknownfuctions into lower case.
1 parent 3b91ea4 commit f6942e9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/W2JuliaExpr.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Converts MathLink `WExpr`essions to Julia `Expr`essions
88
function 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]...)
1618
end
@@ -23,6 +25,4 @@ funcDict=Dict("Plus"=>:+,
2325
"Minus"=>:-,
2426
"Power"=>:^,
2527
"Times"=>:*,
26-
"Sin"=>:sin,
27-
"Cos"=>:cos,
2828
)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
2223
end
2324

0 commit comments

Comments
 (0)