add tail-call test

This commit is contained in:
Yuichi Nishiwaki 2014-02-04 14:35:42 +09:00
parent 2ed2b503a6
commit d3a3c78829
1 changed files with 13 additions and 0 deletions

13
t/tail-call.scm Normal file
View File

@ -0,0 +1,13 @@
(import (scheme base))
;;; always returns zero
(define (zero n)
(if (zero? n)
0
(zero (- n 1))))
;;; using apply
(define (zero-2 n)
(if (zero? n)
0
(apply zero-2 (list (- n 1)))))