MathGroup Archive 1999

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

Search the Archive

Re: List of function-heads

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17082] Re: List of function-heads
  • From: tobiasoed at my-dejanews.com
  • Date: Sat, 17 Apr 1999 03:34:52 -0400
  • Organization: Deja News - The Leader in Internet Discussion
  • Sender: owner-wri-mathgroup at wolfram.com

Peter Breitfeld wrote:
>
> I want to create a List of function-heads like this:
> {a[1][x_],a[2][x_],...,a[n][x_]}
> (to keep this message short I'll use n=2 in the following) to assign
> these to a list of Functions, e.g
>
> {a[1][x_],a[2][x_]}={x^2,x-1}
>
> I can do that with the following command:
>
> In[1]:=fl=Table[a[i][x_],{i,2}]
> Out[1]={{a[1][x_],a[2][x_]}
>
> But then I can't write:
>
> ll={x^2,x-1}
>

Set has attribute HoldFirst, so you need to force
the evaluation of fl to get the assignement to the a's:

In[20]:=  fl=Table[a[i][x_],{i,2}]

Out[20]= {a[1][x_], a[2][x_]}

In[21]:= Evaluate[fl]={x, x^2}

              2
Out[21]= {x, x }

In[22]:=
In[22]:= ??a
Global`a

a[1][x_] = x

a[2][x_] = x^2

cheers, Tobias

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


  • Prev by Date: Printing error w/MacOS8.5.1
  • Next by Date: Re: ParametricPlot help please
  • Previous by thread: Re: List of function-heads
  • Next by thread: Re: List of function-heads