Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: Symbols and Lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39871] Re: Symbols and Lists
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Sun, 9 Mar 2003 05:29:21 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 3/8/03 at 2:49 AM, H.Goyder at rmcs.cranfield.ac.uk (Goyder Dr HGD)
wrote:

>If I have a list of symbols and a list of data such as

>ss = {a, b, c, d, e}

>dd = {1, 5, {3, 4}, 7, abc, {0.1, 0.001}, 3.1415}

>how do I take a symbol from the list ss and associated it with data
>from the list dd?

>What I need is an assignment so that, in this case, the symbol c is
>associated with the data. Equivalent to writing

>c = dd[[4]]

>so that c could then be used in subsequent expressions and the list ss
>is unchanged.

I see the two example lists you've given are two different lengths. That makes it unclear as to which elements of dd you want assigned to which elements of ss. If the two lists were the same length and both ordered so that corresponding elements of each list were in the same positions in their respective lists the following would do what you want

MapThread[Set[#1, #2] &, {list1, list2}]


  • Prev by Date: Re: Fwd: Antiderivatives and Definite Integrals
  • Next by Date: RE: Help with FindRoot
  • Previous by thread: Re: Symbols and Lists
  • Next by thread: Re: Symbols and Lists