MathGroup Archive 2003

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

Search the Archive

Re: Re: Changing the head of the elements of an Imported list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40703] Re: [mg40683] Re: [mg40650] Changing the head of the elements of an Imported list
  • From: Dr Bob <majort at cox-internet.com>
  • Date: Mon, 14 Apr 2003 04:02:26 -0400 (EDT)
  • References: <200304120709.DAA21282@smc.vnet.net> <200304130618.CAA27362@smc.vnet.net>
  • Reply-to: majort at cox-internet.com
  • Sender: owner-wri-mathgroup at wolfram.com

>> Apply[f, expr] or f @@ expr replaces the head of expr by f.

Would that work in this case?

"Cuboid[{3,3,3}]";
Cuboid @@ % // FullForm

"Cuboid[{3,3,3}]"

I guess not.  It's still a string.

"Cuboid[{3,3,3}]";
% // ToExpression // FullForm

Cuboid[List[3, 3, 3]]

Much better.

Bobby

On Sun, 13 Apr 2003 02:18:43 -0400 (EDT), Tomas Garza 
<tgarza01 at prodigy.net.mx> wrote:

>
> Apply[f, expr] or f @@ expr replaces the head of expr by f.
>
>
>
> Tomas Garza
>
> Mexico City
>
> ----- Original Message ----- From: "feleki" <feleki at hbt.arch.ethz.ch>
To: mathgroup at smc.vnet.net
> To: mathgroup at smc.vnet.net
> Subject: [mg40703] [mg40683] [mg40650] Changing the head of the elements of an 
> Imported list
>
>
>>
>> Hello Mathgroup!
>>
>> I have a problem:
>>
>> I need a list of Cuboids to be represented with the
>> Graphics3D procedure.
>> I would like to import this list of Cuboids from
>> a text file generated by another program, the text file looks like:
>>
>> Cuboid[{3,3,3}]
>> Cuboid[{3,1,3}]
>> Cuboid[{3,2,3}]
>> Cuboid[{1,3,1}]
>>
>>
>> and so on...
>>
>> The problem is however that after importing
>> the text file into a list in Mathematica, all the elements
>> of the list have the head String while the
>> Graphics3D requires them to have the head of Cuboid.
>>
>> Is it possible to change the head of the
>> elements of this list from Sting to Cuboid?
>>
>> Best regards,
>> Zsolt Feleki
>> Phd Student
>> Chair of Building Physics
>> ETH H=F6nggerberg HIL E46.1, 8093 Z=FCrich
>> Tel: 01-633 28 77/ 633 36 32
>> Fax: 01-633 10 41
>> http://www.bph.hbt.arch.ethz.ch
>>
>>
>>
>
>
>



-- 
majort at cox-internet.com
Bobby R. Treat



  • Prev by Date: Re: Re: Changing the head of the elements of an Imported list
  • Next by Date: Re: Weird Problem on an old Macintosh
  • Previous by thread: Re: Changing the head of the elements of an Imported list
  • Next by thread: FullSimplify