The base function returns the unchanged starting value. The step receives the previous recursion index , previous result , and parameter :
Thus starts at and takes predecessor steps. These steps subtract one while the result is positive and leave unchanged. The final argument swap gives in the usual subtraction order.
Example
Subtracting beyond zero
Keep the starting value fixed and increase the number of predecessor steps: