MathGroup Archive 2005

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

Search the Archive

Re: enumerating list items

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56028] Re: enumerating list items
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 14 Apr 2005 08:54:20 -0400 (EDT)
  • References: <d3g96u$t4i$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Søren
First you store your variables and the corresponding values in two 
lists. Then you use "Set" and Thread or MapThread to set each variable 
to its value. The following will do the trick:

id =.; gender =.; status =.; odag =.; (*make sure symbols are empty*)
a = {id, gender, status, odag}
b = Range@Length@a
MapThread[Set, {a, b}]

instead of MapThread you may also use the equivalent: Thread[Set[a,b]]

SIncerely, Daniel

Søren Merser wrote:
> hi
> 
> is there a way to make each item in the list 'assignable', i.e. i want to 
> enumerate the items like id=1, gender=2 etc.
> 
> a={"id", "gender", "status", "odag"}
> 
> b=Range@Length@a
> 
> a=b
> 
> regards soren
> 
> 


  • Prev by Date: Re: Infinite sum of gaussians
  • Next by Date: Re: Mandrake 10.1 and Mathematica 5.0?
  • Previous by thread: Re: Re: enumerating list items
  • Next by thread: Re: Re: enumerating list items