MathGroup Archive 2005

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

Search the Archive

'Raw Expressions'

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61624] 'Raw Expressions'
  • From: "Matt" <anonmous69 at netscape.net>
  • Date: Mon, 24 Oct 2005 01:44:07 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,
     Given this as input:

someArray = Array[r, {2, 2}, {2, 4}];
Level[someArray, {-1}]

which results in the following output:

{2, 4, 2, 5, 3, 4, 3, 5}

and the fact that a level specification of -1 is defined thusly:
"Level -1 contains all symbols and other objects that have no
subparts",

one would naively expect that this:

Apply[HeadNew, someArray, {-1}]

would change all the integers in someArray to have new heads of
NewHead.  However, on page 711 of Michael Trott's Programming
Guidebook, he states "The head of raw expressions does not get changed
by Apply."  I assume that by 'raw expression' he means fundamental
types such as Integers, Reals, Strings, etc.  This makes sense to me,
because it would be nonsensical to change the head of an integer to be
String or vice versa.  However, a question did occur to me in the
hypothetical.  Let's say that a function had been defined that had a
constraint upon a certain input, in that the input needed to be of
Integer type, but for some reason, I wanted to deal with the input
internally as a type of Real.  How would I do that?

Thanks,

Matt


  • Prev by Date: Re: Memory leak, once again.
  • Next by Date: Zero-based indexing option?
  • Previous by thread: Re: Re: Running the kernel command line with additional input files
  • Next by thread: Re: 'Raw Expressions'