picrin/t/tailcall.scm

7 lines
102 B
Scheme
Raw Normal View History

2013-10-29 21:06:59 -04:00
(define (sum k acc)
(if (zero? k)
acc
(sum (- k 1) (+ k acc))))
(display (sum 1000 0))