a functional version of anonymous function before trying to implement
callcc