gscheme/examples/tail-recursion.scm

8 lines
111 B
Scheme

(define tailrec
(lambda (n)
(display n) (newline)
(if (= n 0) '()
(tailrec (- n 1)))))
(tailrec 5)