Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: enumerating list items

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56021] Re: enumerating list items
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 13 Apr 2005 01:11:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/12/05 at 5:26 AM, merser at image.dk (Søren Merser) wrote:

>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

Yes.

a = {"id", "gender", "status", "odag"}; 
Evaluate[ToExpression /@ a] = Range@Length@a; 
{id, gender, status, odag}

{1, 2, 3, 4}
--
To reply via email subtract one hundred and four


  • Prev by Date: Mandrake 10.1 and Mathematica 5.0?
  • Next by Date: rasterarray border?
  • Previous by thread: Re: enumerating list items
  • Next by thread: Re: enumerating list items