Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2179

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

From Leonid Shifrin <lshifr@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Converting a list to arguments for a function --- How?
Date 2011-05-07 11:29 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iq3aef$fbc$1@smc.vnet.net> (permalink)

Show all headers | View raw


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@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?
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Converting a list to arguments for a function --- How? Leonid Shifrin <lshifr@gmail.com> - 2011-05-07 11:29 +0000

csiph-web