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