MathGroup Archive 2005

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

Search the Archive

Re: enumerating list items


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

Is this what you want?

In[1]:= a = {"id", "gender", "status", "odag"}
        b = Range@Length@a
        MapThread[#1 <> " = " <> ToString@#2 &, {a,b}]

Out[1]= {id, gender, status, odag}
Out[2]= {1, 2, 3, 4}
Out[3]= {id = 1, gender = 2, status = 3, odag = 4}


  • Prev by Date: Font problems!
  • Next by Date: Re: enumerating list items
  • Previous by thread: Re: enumerating list items
  • Next by thread: Re: enumerating list items