Multiple returns
Opened this issue · 4 comments
BeastyBlacksmith commented
In a Mathematica notebook, every line that doesn't end with ;
will be displayed/ returned.
This is handled differently in MathLink
where only one return value is possible.
MWE:
W```
a = 1;
b = 2
c = 3
``` |> weval
┌ Warning: Set::write: Tag Times in 2 c is Protected.
└ @ MathLink ~/.julia/packages/MathLink/6K9ao/src/eval.jl:16
3
I would expect to get the tuple (2, 3)
back.
simonbyrne commented
It isn't being parsed correctly:
julia> ex = W```
a = 1;
b = 2
c = 3
```
W"CompoundExpression"(W"Set"(W"a", 1), W"Set"(W"b", W"Set"(W"Times"(2, W"c"), 3)))
i.e. it is being parsed as a = 1; (b = ((2*c) = 3))
. I'm not sure why it would be different.
BeastyBlacksmith commented
I'm not sure why it would be different.
I don't understand. What would be different?
simonbyrne commented
Why it parses differently in Mathematica notebooks than via calling ToExpression
asdasd1dsadsa commented
a = 1;
b = 2
c = 3
is not an expression. But
(
a = 1;
b = 2
c = 3
)
is.