1
$\begingroup$

This question follows from this one I made earlier.

If you ask for FullForm[4] you will get back 4, and that's fine. 4 is supposed to be an atomic object. And if you do AtomQ[4], you will get back True, confirming that 4 is an atom.

But there's a problem. If you do Head[4], you get Integer. And this doesn't make sense. The whole meaning of the word atomic is "Unable to be split or made any smaller".

And yet apparently we can split a head off of an unsplittable thing.

Why is this? I don't mean teleologically--obviously its useful to be able to test whether a thing is an integer or a real or whatever. But why or how is this consistent inside the Wolfram Language?

$\endgroup$
4
  • 4
    $\begingroup$ You are just complaining that features of the language do not fit your expections, so how should this be answered? Are you confused in the same way by the fact that atoms in nature can actually be split (en.wikipedia.org/wiki/Nuclear_fission)? $\endgroup$ Commented Jul 16, 2019 at 0:50
  • 2
    $\begingroup$ Here's a puzzle for you, then: 52[[All]] $\endgroup$
    – Michael E2
    Commented Jul 16, 2019 at 3:31
  • $\begingroup$ @HenrikSchumacher Not complaining. Just articulating my expectations so that people can see their reasoning and correct them. Happily I am not confused by physical atoms because I am aware of how understanding of them has historically progressed. But atoms are objects of nature. The Wolfram Language is intelligently designed. So when the word "atomic" is used, it's reasonable to expect it to mean that. When that expectation that words actually mean things is broken, it's reasonable to ask what's going on. $\endgroup$ Commented Jul 17, 2019 at 1:25
  • $\begingroup$ @MichaelE2 according to my new understanding described in my answer below, this should be happening because the Wolfram Language maintains an illusion, and for the reason I gave. There is no actual deeper truth. It's just special cases that are exceptionally useful, so we tolerate them being special. $\endgroup$ Commented Jul 17, 2019 at 1:28

3 Answers 3

5
$\begingroup$

I ended up finding my answer in a roundabout way while pursuing another issue.

According to https://reference.wolfram.com/language/tutorial/BasicObjects.html:

All expressions in the Wolfram Language are ultimately made up from a small number of basic or atomic types of objects.

These objects have heads that are symbols that can be thought of as "tagging" their types. The objects contain "raw data", which can usually be accessed only by functions specific to the particular type of object. You can extract the head of the object using Head, but you cannot directly extract any of its other parts.

This language explicitly admits that atoms have "other parts" besides their head.

But it also makes clear that this is all just an illusion. Atoms don't actually have heads or even other parts. The Wolfram Language just sort of pretends that atoms have heads for the sake of people's convenience and sanity.

$\endgroup$
2
  • $\begingroup$ Reluctant to upvote this--whether an atom "actually" has a head is vague unless you define precisely what a head is. However there is support for this interpretation-- Heads->True does not search within "heads" of atoms, for instance: Try it online! $\endgroup$
    – lirtosiast
    Commented Jul 26, 2019 at 6:10
  • $\begingroup$ Well an Integer atom and something like Image (which is also treated as AtomQ) are fundamentally different things. Head of the former just tells you it’s a raw Integer object and helps with pattern matching. Head on the latter tells you it’s a thing of type Image which is treated as atomic for performance reasons. It’s a subtle but important distinction. $\endgroup$
    – b3m2a1
    Commented Jul 27, 2019 at 1:47
0
$\begingroup$

How low do you go? I think that part of the issue may be with considering, say, an integer as an "atomic" entity, rather than representing it via an expression tree, which would reflect its actual construction, say in decimal, binary or unary. A list has an expression tree, reflecting its actual construction.

An integer does not. The name "atom" bothered me as well when learning about the head. I interpreted the head as a type of the atom (as pointed out above).

The "arbitrary" cut-off makes sense when I think of the choice of an atom as deciding a "limit" at which point expression trees are no longer used to represent the construction of an item from more basic parts, such as integers.

So in a sense an atom still is a "smallest" element, no longer divided into parts by an expression tree (aside from its type-head--admittedly a little confusing when first encountering it, but making more sense when realizing this head is not part of the actual "construction" of the integer, which is not ``divisible'' (into smaller parts that would be combined via an expression tree into the integer).

$\endgroup$
0
$\begingroup$

It's like real atoms. Atoms are indivisible by chemical processes, but physical machinery like particle accelerators can divide them. In Mathematica, atoms are indivisible by Part and related processes, but more specialized machinery can extract data from them.

$\endgroup$

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.