Firstly, this is about a homework problem.
I've got a data structure representing a natural number as:
NUM = zero
double(NUM)
double_plus_one(NUM)
Eg, 6 = double(double_plus_one(double_plus_one(zero))). I've got the algorithm to convert a number into or from this representation fine. But now I'm expected to come up with algorithms to add and subtract two numbers in this format. I'm not seeing any patterns in how this can be done (and I can only assume that I'm not supposed to convert it to a regular number, add that, and convert back to this form).
Any advice?