MathGroup Archive 2001

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

Search the Archive

Re: List Assignment Question


Jim:

The reason why  First[data]=Rest[data] won't work is because Set has the
HoldFirst Attribute.  To get around it use Evaluate:

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

Ken Levasseur
Math. Sci.
UMass Lowell

Jim Purdy wrote:

> 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: List Assignment Question
  • Previous by thread: List Assignment Question
  • Next by thread: Re: List Assignment Question