MathGroup Archive 2004

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

Search the Archive

Re: List arguments to functions


"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.

Cheers,
Peltio
--
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