All variables are natural numbers.
f(x,~) denotes the function ( y -> f(x,y) ), and likewise for other positions of "~".
---
Let f(0,0,n) = n+1.
Let f(j,k+1,n) = (f(j,k,~)^n)(n).
Let f(j+1,0,n) = f(j,n,n).
Let f(0,0,0,n) = n+1.
Let f(i,j,k+1,n) = (f(i,j,k,~)^n)(n).
Let f(i,j+1,0,n) = f(i,j,n,n).
Let f(i+1,0,0,n) = f(i,n,n,n).
And so on.
---
We can describe the generalization using Python syntax for lists.
Let f([0]*k,n) = n+1.
[If the list is all zeros, the output is just n+1.]
Let f(x+[k+1],n) = (f(x+[k],~)^n)(n).