# How can I ask the Wolfram Language to tell me if a hypothetical expression with a particular head would be atomic or not?

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.

• It is nearly impossible if you do not evaluate the full expression first. Jul 17, 2019 at 19:30
• @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'. Jul 17, 2019 at 19:31
• The problem with your approach: Even in everyday English, "map" can be both a noun and a verb. There is no either or. Jul 17, 2019 at 19:35
• @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 "botanytree". Jul 17, 2019 at 19:43
• "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. Jul 17, 2019 at 19:49

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.

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


True

False

The problem here: SparseArray`s are atomic, but lists are not.