Anonymous user
Compound data type: Difference between revisions
→{{header|Mathematica}}
Capra Hircus (talk | contribs) (adding maxima) |
|||
Line 776:
=={{header|Mathematica}}==
Expressions like point[x, y] can be used without defining.
<lang mathematica>In[1]:= a = point[2, 3]
Out[1]= point[2, 3]
In[2]:= a[[2]]
Out[2]= 3
In[3]:= a[[2]] = 4; a
Out[3]= point[2, 4]</lang>
Or you can just define a function.
<lang mathematica>p[x] = 2; p[y] = 3;</lang>
Data will be stored as down values of the symbol ''p''.
=={{header|Maxima}}==
|