9

I am looking for a full list of atomic objects in Mathematica (for which AtomQ yields True).

I know about

Symbol
String
Integer
Real
Rational
Complex

SparseArray
BooleanFunction
Graph

Are there any others?

ref: http://reference.wolfram.com/mathematica/tutorial/BasicObjects.html

EDIT: Continually adding new symbols from answers to list above.

3
  • 4
    I am sure that the developers had their reasons to add more atomic objects to the list (which remained fixed for a long time), perhaps such as better integration of components, efficiency, etc, but if this represents a new development trend, I'd be worried, since keeping the number of elementary and atomic objects small seems (to me anyway) to be one essential ingredient for the true power and consistency of a programming language. May 11, 2011 at 14:56
  • 3
    Why did someone down-vote this?
    – Mr.Wizard
    May 11, 2011 at 21:28
  • Now that you're "back in town" have you seen my answer?
    – Mr.Wizard
    Nov 12, 2012 at 22:23

2 Answers 2

5

It appears your list needs one more object to be complete:

In[520]:= f = BooleanFunction[30, 3];

In[521]:= AtomQ[f]

Out[521]= True
9
  • 2
    I am curious if there is any programmatic way to get this list (possibly based on some undocumented internal top-level functions), with only the top-level functionality (available to the end-user)? May 11, 2011 at 14:22
  • @Leonid, I'm also curious, and also tried to do that. It's not trivial, compare e.g. AtomQ@SparseArray[] with AtomQ@SparseArray[{1->1}]
    – Szabolcs
    May 11, 2011 at 14:29
  • @Szabolcs I think I can explain at least what you observed. For non-trivial atomic heads such as Rational, Complex, SparseArray (those that appear to have elements and not be atomic, the way they are rendered), auto-evaluation happens. For example, AtomQ[Unevaluated[Rational[1, 2]]] gives False. This auto-evaluation is normally invisible, but you can track it with On[]. It does not happen when you supply wrong number or type of arguments, like in Rational[{1},{2}]. My guess is that AtomQ (as well as some other functions) is internally overloaded on these auto-evaluated forms. May 11, 2011 at 14:36
  • 1
    @leonid I would guess that Rational[1,2] does not auto-evaluate to an atom, but rather the atom is directly constructed in the parse stage.
    – ragfield
    May 11, 2011 at 15:04
  • 4
    @ragfield In fact, we can prove that we are dealing with auto-evaluation here, as follows: Block[{Rational}, AtomQ[Rational[1, 2]]] gives False. And, this could not be done for all cases at parse-time anyway, without breaking some functional/mettaprogramming features of Mathematica, allowing for example for the code like this: Rational @@ {1, 2}, and generally for the automatic construction of atomic objects from pieces at run-time. May 11, 2011 at 15:26
1

Looks like we have another one:

obj = Graphics`Mesh`Delaunay @ RandomReal[1, {10, 2}]

AtomQ[obj]
"MeshObject[1]"[2, {10, 21, 12}]

True
3
  • Sorry, I forgot to check my replies on SO (I did check them on Mma.SE). Are you still using v7? On v8 this doesn't seem to be atomic. Did you have to do any other initialization to make this function usable than Graphics`Mesh`MeshInit[]?
    – Szabolcs
    Nov 13, 2012 at 14:24
  • @Szabolcs still on v7, and no, running only the code above is sufficient to produce the given output.
    – Mr.Wizard
    Nov 13, 2012 at 14:32
  • It must be a difference between v7 and v8 then. It's a little surprising as I'd expect them to move from composite expressions to optimized atomic representations, not the other way.
    – Szabolcs
    Nov 13, 2012 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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