Mathematica pseudo-types Integer, Real, Rational, Complex String and Symbol and their use.
52
votes
7answers
4k views
Struct equivalent in Mathematica?
I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
14
votes
4answers
522 views
How to create strong types?
In a program I'm writing, I create a list of lists, that looks something like this:
{{100, {1,2,3,4,5}},
{105, {2,4,6,8}},
{42, {42,39,56}}}
I then pass this ...
7
votes
5answers
214 views
How to check if an expression is a real-valued number
What is a simple, fast way to test whether an expression is a real-valued number? I ask since there is no RealQ function.
If we call this test realQ, it should satisfy these constraints:
...
6
votes
3answers
130 views
Does there exist any way to add type annotations?
Is there any way to add my own annotations to values or functions in Mathematica? Imagine, for example, that I wanted to annotate a List specifically as a ...
0
votes
1answer
77 views
Mathematica command for type checking?
I have a program where users can enter mathematica commands that can evaluate to any of the standard numeric types (complex, real, int, etc.), or to boolean values. Moreover the users can enter ...
0
votes
1answer
125 views
What format to use to store expressions in database?
I am storing lists of expressions into a MySQL database. Each list is of form
{_String, {_String, _Real}, _Real}
What data format should each column of the ...
