From d3a3c788292963d50d226dd9bc70beff0934afa5 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 4 Feb 2014 14:35:42 +0900 Subject: [PATCH] add tail-call test --- t/tail-call.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 t/tail-call.scm diff --git a/t/tail-call.scm b/t/tail-call.scm new file mode 100644 index 00000000..7eb67383 --- /dev/null +++ b/t/tail-call.scm @@ -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)))))