I dont know much about functional programming, but what stops you defining int readInt(string prompt, validator_t validator) { ... } as a free standing function and just call it from both parts of your code? What is the benefit of indirection that you create when passing function pointer?