Add and use a mkFunction utility function.