Paste number 79636: sum3

Paste number 79636: sum3
Pasted by: [bjoern]
When:2 years, 9 months ago
Share:Tweet this! | http://paste.lisp.org/+1PG4
Channel:#swhack
Paste contents:
Raw Source | XML | Display As
  sum3 = (R)(plus, (S)(succ, id_4,4))
                   ^^^^^^^^^^^^^^^^^

h(a,b,c,d) = succ(id_4,4(a,b,c,d))
           = succ(d)
           = d + 1

  sum3 = (R)(plus, (S)(succ, id_4,4))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

f(a, b,     0) = plus(a, b)
f(a, b, m + 1) = h(a, b, m, f(a, b, m))
               = f(a, b, m) + 1

Beispiel:

  sum3(3, 5, 7) = 3 + 5 + 7 = 15

f(3, 5, 7) = f(3, 5, 6) + 1   = 14 + 1     = 15
f(3, 5, 6) = f(3, 5, 5) + 1   = 13 + 1     = 14
f(3, 5, 5) = f(3, 5, 4) + 1   = 12 + 1     = 13
f(3, 5, 4) = f(3, 5, 3) + 1   = 11 + 1     = 12
f(3, 5, 3) = f(3, 5, 2) + 1   = 10 + 1     = 11
f(3, 5, 2) = f(3, 5, 1) + 1   =  9 + 1     = 10
f(3, 5, 1) = f(3, 5, 0) + 1   =  3 + 5 + 1 = 9
f(3, 5, 0) = 3 + 5 -----------^

This paste has no annotations.

Colorize as:
Show Line Numbers
Already requested for deletion.

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.