Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

19
  • 7
    $\begingroup$ 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. $\endgroup$ Commented Apr 27, 2014 at 3:38
  • 5
    $\begingroup$ The same question on Stack Overflow: (5964469) $\endgroup$ Commented Apr 28, 2014 at 19:19
  • 6
    $\begingroup$ What is atomic and what isn't changes with versions. Image isn't atomic in v7 and v8. $\endgroup$ Commented Apr 29, 2014 at 16:54
  • 4
    $\begingroup$ @ChipHurst AtomQ is defined as "an expression which cannot be divided into subexpressions", and has notes such as "You can use AtomQ in a recursive procedure to tell when you have reached the bottom of the tree corresponding to an expression." and "AtomQ gives True for any object whose subparts cannot be accessed using functions like Map". Clearly Association should not be AtomQ by these measures. But as you point out, it is also not NormalQ (which would mean that it behaves like its FullForm), if we had such a thing. AtomQ and NormalQ are currently "mixed together", we should separate them. $\endgroup$ Commented Jul 17, 2014 at 18:20
  • 3
    $\begingroup$ @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 ... $\endgroup$ Commented Aug 5, 2014 at 14:39