Re: 'Raw Expressions'
- To: mathgroup at smc.vnet.net
- Subject: [mg61638] Re: [mg61624] 'Raw Expressions'
- From: Chris Chiasson <chris.chiasson at gmail.com>
- Date: Mon, 24 Oct 2005 21:06:56 -0400 (EDT)
- References: <200510240544.BAA29081@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
use N ?
On 10/24/05, Matt <anonmous69 at netscape.net> wrote:
> 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
>
>
--
http://chrischiasson.com/contact/chris_chiasson
- References:
- 'Raw Expressions'
- From: "Matt" <anonmous69@netscape.net>
- 'Raw Expressions'