@Chemistry You can, of course, view the expression $S = \int L(x(t),\dot{x}(t),t)\mathrm{d}t$ as a functional in
both $L$ and $x$, i.e. $S[L(q,v),x(t)]$, which becomes a number only when fed
both a concrete $L$ and a concrete $x$. This is the same as your "function of a function of a function", the equivalence between "function of two functions" and "function of a function and a function" is called
currying.