Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I was surprised to see Graph objects are atomic. Is there a way (through documentation or programmatically) to find all atomic heads?

The ones I know of are:

Integer
Rational
Real
Complex
Symbol
String
SparseArray
StructuredArray
Image (* since v9 *)
Image3D
Graph
ColorProfileData
Association
MeshRegion
BoundaryMeshRegion
Language`ArrayObject

Are there any others?

Others mentioned in the comments

Internal`Bag
System`Utilities`HashTable
System`RawArray
BooleanFunction
Dispatch (* since v10 *)
Dataset
share|improve this question
5  
Strangely, SparseArrays are actually not atomic, but just treated for most purposes as if they were. They are the only non-atomic atoms, though, as far as I know. And in addition to your list, there are several other undocumented atomic objects as well, such as the Internal`Bag, the System`Utilities`HashTable, the System`RawArray, and probably others besides. Several objects that should be atomic (by the standards of the SparseArray) aren't, such as CompiledFunction and LibraryFunction. –  Oleksandr R. Apr 27 at 3:38
3  
The same question on Stack Overflow: (5964469) –  Mr.Wizard Apr 28 at 19:19
3  
What is atomic and what isn't changes with versions. Image isn't atomic in v7 and v8. –  Szabolcs Apr 29 at 16:54
2  
@TaliesinBeynon ... With[{a = Association[1 -> 2]}, Hold[a]]. But it doesn't, there are differences (again, part extraction, pattern matching). Also consider SparseArray, which also has parts, but again doesn't behave identically to its FullForm. SparseArray is also marked as AtomQ for this reason. Perhaps you could consider changing the description of AtomQ in the documentation instead of letting AtomQ return False for associations. What AtomQ really means is a bit complicated, but it's valuable to have it, and changing it would break either consistency ... –  Szabolcs Aug 5 at 14:39
2  
@TaliesinBeynon ... or backwards compatibility, and has the potential to cause a lot of confusion. Of course the decision is up to you, I'm just trying to explain why Association is indeed AtomQ according to my mental model of what is atomic. It is definitely true that it is not as simple as "an expression which cannot be divided into subexpressions", but the real question is not whether AtomQ follows this definition. It is: which kind of AtomQ is a practically useful function? The actual one or the one that would be based on this simple definition? –  Szabolcs Aug 5 at 14:39

1 Answer 1

Since it's the only "answer" I can see to post (as CW) there is also BooleanFunction as originally pointed out by Sasha.


In version 10 Dispatch tables are atomic.(1)

Array[# -> 2 # &, 5] // Dispatch // AtomQ
True
share|improve this answer
    
The same as association. <|a -> 1|> // AtomQ gives True. –  Yi Wang Jul 14 at 15:55
    
@YiWang Association is already mentioned in the Question body above, but yes. –  Mr.Wizard Jul 14 at 23:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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