MathGroup Archive 2001

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

Search the Archive

RE: List Assignment Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31811] RE: [mg31801] List Assignment Question
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 3 Dec 2001 01:45:00 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Jim,

Attributes[Set]
{HoldFirst, Protected, SequenceHold}

So, when you are using Mathematica code to generate the lhs of a Set
(assignment) statement you have to evaluate the lhs yourself to obtain the
desired Set statement.

Evaluate[First[data]] = Rest[data];

abc
{1, 2.3, 3, 4}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


> From: Jim Purdy [mailto:jpurdy at home.com]
To: mathgroup at smc.vnet.net
>
> Hello,
>
> I want to do the following:
>
> Given the list ,
>
> data={abc, 1, 2.3, 3, 4}
>
> do this:
>
> First[data]=Rest[data]  (wont work)
>
> basically creating a variable named for the first element in the list
> and assigning it to the remainder.
>
> abc={1,2.3,3,4} would be the result.
>
> There probably is a simple answer, but I can't find it.
>
> Thanks in advance
>
> Jim
>



  • Prev by Date: Re: List Assignment Question
  • Next by Date: Re: Bessel Function Zeros at 0 Not Given?
  • Previous by thread: Re: List Assignment Question
  • Next by thread: plot on Alpha Linux not working