MathGroup Archive 2001

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

Search the Archive

Re: List Assignment Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31813] Re: [mg31801] List Assignment Question
  • From: BobHanlon at aol.com
  • Date: Mon, 3 Dec 2001 01:45:03 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 12/2/01 4:54:09 AM, jpurdy at home.com writes:

<< 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.
 >>

assign[x_List] := 
    ToExpression[ToString[First[x]] <> "=" <> ToString[Rest[x]]];

Clear[abc];
data={abc,1,2.3,3,4};
assign[data];

abc

{1, 2.3, 3, 4}


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: coloring everything outside a circle
  • Next by Date: Re: List Assignment Question
  • Previous by thread: Re: List Assignment Question
  • Next by thread: Re: List Assignment Question