symbolic list element as expression?
Opened this issue · 5 comments
Hi,
I noticed that right now the list element cannot be used as an expression, e.g.
a[i]
,in which a and i are just two symbols, will trigger an error.
The expression is not supported and is supposed to trigger an error.
Thanks. Yes, it is not supported. But I had considered a more user-friendly (Symata-level) error. For instance
symata 12> 3[4]
BoundsError("part specification 4 is longer than the depth of the object.", #undef)
Although the Symata-level error is no longer working as I want now. As you can see. It is thrown to Julia.
But, I think I did implement subscripted variables. I'll search for if/how I did it.
You can use a(i)
. This is analogous to a[i]
in Mathematica. And Symata a[i]
is Mathematica a[[i]]
. I think I have not yet implemented a(i), a(3), a(j)
etc as a hash table, which would improve effciency. But, I'm not sure.
I'll open this again, because the error is exposing the implementation.
More precisely, a[i]
is supported. It is equivalent to Mathematica a[[i]]
. But, if the "part specification is longer than the depth of the object", then an error is thrown.
symata 1> a[1]
BoundsError("part specification 1 is longer than the depth of the object.", #undef) ...
symata 1> b = [0]
Out(1) = [0]
symata 2> b[1]
Out(2) = 0
Mathematica
In[1]:= Table[a[i], {i, 10}]
Out[1]= {a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10]}
Symata
symata 1> Table(a(i) , [i, 10])
Out(1) = [a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10)]