I'm searching for a way to define the function this wikipedia article call Primitive Recursion. It should have two functions as argument and it should return a function. I need this as helping in studying mathematical recursion theory. I need another help with a similar problem; this time i want a "primitive minimization", that is a function called primMin a try i made inspired by @Rojo is.
primMin[f_] := Module[{h},
h[x___Integer] := Module[{}, For[i = 0, f[x, i] != 0, i++,]; i];
h]
this take f a two argument function and return a one argument function that given x as an argument and search for the first second argument so that f[x,#] == 0. this code work but i couldn't find a way to substitute the For with a Map or something similar. I need that given x there is no y so that f[x,y] == 0 then program will crash or continue to run forever. thank