Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: List arguments to functions

  • To: mathgroup at
  • Subject: [mg45566] Re: List arguments to functions
  • From: "Peltio" <peltio at>
  • Date: Wed, 14 Jan 2004 01:26:18 -0500 (EST)
  • References: <bu0cnm$aib$>
  • Reply-to: "Peltio" <peltioNOSP at>
  • Sender: owner-wri-mathgroup at

"Chris Rozell" wrote

    myfunc[x_, y_] = Apply[Plus, x + y];
    myfunc[{1, 2, 3}, {4, 5, 6}]

        {5, 7, 9}

>When what I would really like is the number 21

I guess your problem resides in the immediate assignement, and not in the
Flat attribute of Plus. Try using

    myfunc[x_, y_] := Apply[Plus, x + y]

So that you have the whole 'procedure' Apply[Plus... etc] associated to
myfunc, and not the result of its immediate evaluation, i.e., x+y.

Invalid address in reply-to. Crafty demunging required to mail me.

  • Prev by Date: Wolfram Functions Site
  • Next by Date: typesetting fractions
  • Previous by thread: Re: List arguments to functions
  • Next by thread: Re: List arguments to functions