MathGroup Archive 2001

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

Search the Archive

RE: Variables from Lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26788] RE: [mg26751] Variables from Lists
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 24 Jan 2001 04:18:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

James,

You can't do it. You end up with a recursive definition. You must use a
unique symbol.

You could use a scheme like this:

definelist[list_] := (mylists[First[list]] = list)

definelist /@ {{bd, 1, 2, 3, 4}, {cc, 3, 4, 5, 6}};

?mylists
Global`mylists
mylists[bd] = {bd, 1, 2, 3, 4}
mylists[cc] = {cc, 3, 4, 5, 6}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



> From: James Jones [mailto:j.k.jones at dl.ac.uk]
To: mathgroup at smc.vnet.net
> Hi,
>
> I have a list of data, but I want to assign a variable to that list, where
> the variable name is part of the list.
>
> i.e.   List = {bd, SBEND,L,1.5,K,-1.2}
>
>         bd = {bd,SBEND,1.5,-1.2}
>
> Obviously its trivial here, but I need to do it within a function so that
> Part[List,1] is assigned to List, without reassigning Part[List,1] within
> List, if that makes sense :-)
>
> i.e bd =!= { {bd, SBEND,L,1.5,K,-1.2}, SBEND, 1.5, -1.2}
>
> Any help much appreciated,
>
> James Jones
> Daresbury Lab.
>
>
>



  • Prev by Date: Re: Q: Factor with Polynominals?
  • Next by Date: Statistics functions in packages
  • Previous by thread: Re: Rewriting of Trigonometric Functions
  • Next by thread: Re: Variables from Lists