2
$\begingroup$

In MATLAB one can use cell arrays and structures to "hold" data of different types. For example, one can define a cell array in which the first cell contains an array, the second a differently sized array, the third a string, etc. Similar things can be done with the structure data type.

Do these or similar exist in Mathematica?

$\endgroup$
2

1 Answer 1

2
$\begingroup$

Mathematica doesn't need such a thing. "Everything is an expression." In many cases, subexpressions may be of a variety of types. Consider List. Any element of a list may be of any "type" you wish. List is basically a passive "wrapper", but even active things can wrap combinations of types. Consider:

1+"a string"

which simply fails to evaluate. Plus doesn't have a rule that applies to such a construct, so it becomes a passive wrapper here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.