MathGroup Archive 2011

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

Search the Archive

Re: Converting a list to arguments for a function --- How?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118667] Re: Converting a list to arguments for a function --- How?
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Sat, 7 May 2011 07:29:21 -0400 (EDT)

Virgil,

use Apply:

In[1]:= Apply[f, {4, 1, 1}]

Out[1]= f[4, 1, 1]

It also has an abbreviation: @@

In[2]:= f @@ {4, 1, 1}

Out[2]= f[4, 1, 1]

Regards,
Leonid


On Fri, May 6, 2011 at 3:24 PM, Virgil Stokes <vs at it.uu.se> wrote:

> Suppose I have a list,
>
> list = {4,1,1}
>
> and I wish to use it as follows
>
> f[4,1,1]
>
> Is there a simple way (without looping through the elements list) to
> transfer
> the elements of list to the arguments for f?
>


  • Prev by Date: Re: Converting a list to arguments for a function --- How?
  • Next by Date: Re: and color via PlotStyle
  • Previous by thread: Re: Converting a list to arguments for a function --- How?
  • Next by thread: Re: Converting a list to arguments for a function --- How?