[Date Index] [Thread Index] [Author Index]
extra data in expressions
Here's a rather abstract foundations question: I once unthinkingly assumed that an expression was determined by its head and parts. This is of course very wrong: any two expressions with head Real, no matter how different, have head Real and no parts. Same goes for Symbol, Integer, String, and all other "atomic" expression heads. This means that certain expressions can (and must) hold hidden extra data. My question is whether there are any consistent, logical semantics for this extra data. Can an expression contain both parts AND extra data? Which built-in symbols (or rather, expressions with head one of these built-in symbols) contain extra data; is there a list somewhere? Can user-defined symbols contain user-defined extra data? Why does Head[String @@ 1] return Integer? What else could it possibly return? I'm starting to suspect that "everything is an expression" involves some pretty ugly exceptions.