Ackermann with currying.
Corrected the order of parameters to phi.