MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: extra data in expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53390] Re: [mg53367] extra data in expressions
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 9 Jan 2005 23:03:41 -0500 (EST)
  • References: <200501080739.CAA17766@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 8 Jan 2005, at 08:39, joshuahorowitz at comcast.net wrote:

> 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.

Well, not necessarily. Things like 2 or "dog" are atoms:


AtomQ/@{2,"dog"}

{True,True}

and Heads of atoms are basically just type specifications, and quite 
different form heads of non-atoms. IN particular, head's of atoms can't 
be changed so

String @@ 1

does completely nothing, which explains why Head[String @@ 1] returns 
Integer.
Note also that contrary to most people's expectations:

AtomQ[Complex[2,3]]


True


so


List @@ (Complex[2, 3])


2 + 3*I

has no effect.

Andrzej Kozlowski



>
> 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.
>


  • Prev by Date: Re: Function Show[]
  • Next by Date: Re: easy question about random numbers
  • Previous by thread: Re: extra data in expressions
  • Next by thread: Re: extra data in expressions