# Multiple functions used for solving a question?

If your solution for a question requires, say, two functions, that should be called one after another, is it acceptable to define the two functions, with it being expected that the user will invoke the two in sequence?

That is, if you define two functions f(x) and g(x), with the intention being that the user would call them as f(g(x)), is this an acceptable solution, or does the solution need to have a h(x)=f(g(x)) definition or equivalent, so that the user would simply call h(x)?

What is the community's position on this?

The answer must provide a single function to call, i.e. the h(x)=f(g(x)) case, otherwise it would outsource the function composition f(g(x)) to the caller. It also prevents misusing this mechanism, e.g.
Task: take the 4th element of a list. Haskell answer: head;tail, call it like head.tail.tail.tail
• To me, "write a program or function" means write a self-contained function that requires only a single call. g(x) can be defined and called within f(x) or h(x) but it can't be defined outside of it. – Alex A. Nov 8 '15 at 22:00
• @AlexA. Ummm... I think it's common practice to do so. I don't think we have any rules against function submissions using global state (as long as they don't break themselves), and defining a function g outside of f or h is just a global function that is being called. – Martin Ender Nov 10 '15 at 9:10