Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: From list to list of arguments

  • To: mathgroup at
  • Subject: [mg113308] Re: From list to list of arguments
  • From: Roger Wilson <rogerhw999 at>
  • Date: Sat, 23 Oct 2010 07:04:55 -0400 (EDT)
  • References: <i9r803$hp1$>

Answer to your aux. question...

f[x___] x can be anything including nothing and including any number
of things (x is a Sequence which in mathematica is a kind of naked

So f[x___]:=Print[{x}] will do the following...

f[] will print {}
f[1] will print {1}
f[1,2] will print {1,2}
f[1,a,"Hello"] will print {1,a,"Hello"} (Quotes will not show up when
printed but they're there)

I use f[x___]=$Failed a lot, its a catchall definition of x which
means I have called it with the wrong parameters.

On 22 Oct, 06:38, Sam Takoy <sam.ta... at> wrote:
> Hi,
> Suppose I have a list of arrays, say g = {a, b, c} where a, b, and c are
> arrays, and I would like to calculate
> Outer[Times, a, b, c]
> how do I do it?
> I tried
> Apply[Outer[Times,#]&, g], as in Apply[Outer[Times, #] &, {{1}, {1}}],
> but that does not yield the right answer. So the question is: how does
> one convert a list {a, b, c} into arguments to a function of variable
> number of arguments? Thanks!
> An auxiliary question: within the function f[x__] := ... what kind of
> object is x? It's not a list, but what is it?
> Many thanks in advance,
> Sam

  • Prev by Date: Re: Fitting the solution of a differential equation to a data set
  • Next by Date: any thoughts on how to nondimensionlize my set of equations?
  • Previous by thread: Re: From list to list of arguments
  • Next by thread: Speeding up InterpolatingFunction