Example #1
0
 def plus2(x, y):
     h1 = handle(x)
     h2 = handle(y)
     increment(h1)
     increment(h2)
     increment(h1)
     increment(h2)
     return handle_get(h1), handle_get(h2)
Example #2
0
 def plus(x, y):
     h = handle(x)
     i = y
     while i > 0:
         increment(h)
         i = i - 1
     return handle_get(h)
Example #3
0
 def plus4(x):
     h = handle(x)
     increment(h)
     increment(h)
     increment(h)
     increment(h)
     return handle_get(h)
Example #4
0
 def length(h, xs):
     if not isinstance(xs, Empty):
         increment(h)
         length(h, xs.tail)
     return handle_get(h)
Example #5
0
def increment(h):
    return handle_set(h, add_one(handle_get(h)))
Example #6
0
 def plus(h, y):
     i = y
     while i > 0:
         increment(h)
         i = i - 1
     return handle_get(h)