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: [mg118668] Re: Converting a list to arguments for a function --- How?
  • From: "E. Martin-Serrano" <eMartinSerrano at telefonica.net>
  • Date: Sat, 7 May 2011 07:29:32 -0400 (EDT)

Is this what you want?

list = {1, 2, 3};

f[a_, b_, c_] := Print[a, ", ", b, ", ", c]

f[Sequence @@ list]


-----Mensaje original-----
De: Virgil Stokes [mailto:vs at it.uu.se] 
Enviado el: viernes, 06 de mayo de 2011 13:25
Para: mathgroup at smc.vnet.net
Asunto: Converting a list to arguments for a function --- How?

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: Converting a list to arguments for a function --- How?
  • 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?