compose an arbitrary number of functions from right to left