Writing a function with two functions as arguments

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"

• 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? – Mr.Wizard Sep 3 '15 at 20:43

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.