Mathematica pseudo-types Integer, Real, Rational, Complex String and Symbol and their use.

learn more… | top users | synonyms

5
votes
1answer
60 views

Determine return type of CompiledFunction expression

Is there a way to extract the types of the arguments and the return type from a CompiledFunction expression? I am writing a package for code generation (basically a wrapper around CCodeGenerate) where ...
10
votes
3answers
198 views

Find all heads a function is defined on

So say I've got a function g defined as follows: g[x_Integer] := x + 1 g[s_String] := s <> "!!!" How would I write a ...
3
votes
1answer
63 views

.NET link - index of property

I have a property in .NET Type, which is actually a generic list of objects. When I try access the property using numeric index e.g. 10, this works. However when I iterate through indices using ...
75
votes
7answers
7k 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 ...
0
votes
0answers
56 views

Using less memory to store and manipulate specific types

Is there a simple way to use Integer types (in particular, a table of Integer types) that require only 4 or 8 bytes (reps. 32 and 64 bits) representation? It seems that integers in Mathematica have a ...
5
votes
1answer
130 views

Behavior of 1.2 ∈ Rationals changes in v9?

A friend of mine using version 9 recently showed me this: It's strange because in version 8.0.4 1.2 ∈ Rationals does return ...
23
votes
4answers
1k 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 ...
6
votes
2answers
178 views

Get information about a stack of images, without plotting it

A very long time ago I used Mathematica for a few months and found it very intuitive. Now for my work I use MatLab. I was just trying some stuff out with Mathematica again and there is something I ...
15
votes
5answers
1k 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 ...
2
votes
3answers
241 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 ...
0
votes
1answer
293 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 ...
6
votes
3answers
169 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 ...