1
$\begingroup$

I am trying to write a function of two functions. A function of one function works as in

h[f___, x_, y_] := Integrate[f, x]  
h[x^2 + y, x, y]

and this function of two functions also works

h[f___, g___, x_, y_] := f + g  
h[x^2 + y, x^3, x, y]

however, this does not work

h[f___, g___, x_, y_] := Integrate[f, x]  
h[x^2 + y, x^3, x, y]

Returning the error msg: "Integrate::argmu: Integrate called with 1 argument; 2 or more arguments are expected"

$\endgroup$
1
  • $\begingroup$ It is not clear to me why you are using ___ (BlankNullSequence) at all. It may be simply a misunderstanding, and you can use _ (Blank) instead. Or do you need some kind of optional argument behavior? $\endgroup$
    – Mr.Wizard
    Commented Sep 3, 2015 at 20:43

1 Answer 1

5
$\begingroup$

The reason is that you are using ___ instead of _. ___ is a pattern-matcher which can match zero or more sequences of arguments. In this example, it parses as follows: f = Null, g = Sequence[x^2 + y, x^3], x = x, y = y.

This can be prevented if you use _ instead of ___ throughout.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.