Integers in the Wolfram Language are atomic expressions, while uses of the Map function are not atomic.

But if you didn't know this, how could you find out using only the Wolfram Language? The best I can do is something like:

 In[2] := AtomQ[Map]
Out[2]  = True

But Wolfram isn't telling me that Map expressions are atomic. They aren't. It's Map itself, the symbol, which is atomic, and that's what Wolfram is talking about.

So how can I ask if a hypothetical expression with a particular head would be atomic. The answer should True for Integer, but false for Map.

Edit: It looks like the way I want to do things isn't possible within the language. I've written another question here that's more general, hopefully to elicit a way to do this I haven't imagined.

  • 1
    $\begingroup$ It is nearly impossible if you do not evaluate the full expression first. $\endgroup$ Jul 17, 2019 at 19:30
  • $\begingroup$ @HenrikSchumacher I don't have a full expression at all. It's sort of like, I want ask "Is 'tree' a noun?" I don't want to point at an actual tree and ask if its a noun. I'm not interested in the tree, I'm interested in the word 'tree'. $\endgroup$ Jul 17, 2019 at 19:31
  • 1
    $\begingroup$ The problem with your approach: Even in everyday English, "map" can be both a noun and a verb. There is no either or. $\endgroup$ Jul 17, 2019 at 19:35
  • $\begingroup$ @HenrikSchumacher Yes, but the noun "map" and the verb "map" are two different words that just happen to share the same phonological and graphemical form. If a word is a tuple (S, M) where S is a symbol and M is a meaning, "map" the noun would not equal "map" the verb, because their M would be different. So far as I'm aware, Wolfram requires that all symbols within a context have at most one thing they represent. So if it helps, when I say 'tree' in my last comment, replace that with "botany`tree". $\endgroup$ Jul 17, 2019 at 19:43
  • $\begingroup$ "Wolfram requires that all symbols within a context have at most one thing they represent" -- That is just not true. You miss up "thing" with the concept of a symbol. And each symbol may carry multiple replacement rules that lead to transformations of expression in which the symbol occurs. $\endgroup$ Jul 17, 2019 at 19:49

2 Answers 2


The answer is that any head can be the head of a non-atomic expression. Thus, you cannot tell an atomic expression by its head, you must test it with AtomQ.

  • $\begingroup$ Good point. Here and example: SparseArray[f] is nonatomic false while SparseArray[{f}] is atomic. Both expression have SparseArray as their head. $\endgroup$ Jul 17, 2019 at 19:42
  • $\begingroup$ Well... damn. I'll create a new follow-up question that tries a more ends-focused approach, then. $\endgroup$ Jul 17, 2019 at 19:46

Indeed, it is impossible if you do not evaluate the full expression first. Here is an example:

bla /: Map[bla, _] := SparseArray[{56, 1}]

AtomQ[Map[bla, {56, 0}]]
AtomQ[Map[# &, {56, 0}]]



The problem here: SparseArrays are atomic, but lists are not.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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