Compound data type: Difference between revisions

Content added Content deleted
(adding maxima)
Line 776:
 
=={{header|Mathematica}}==
Expressions like point[x, y] can be used without defining.
<lang Mathematica>a = Point[{3, 4}];
<lang mathematica>In[1]:= a = point[2, 3]
Graphics[a]</lang>
 
[[File:Point_mma.png]]
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}}==