docs: add example scheme programs

This commit is contained in:
dualfroz committed 2026-08-28 14:30:00 +02:00
1 parent 5e1aec0f78
commit 5649b7bad8
6 files changed
+151

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
; Tail-recursive factorial using a named let accumulator.
(define (factorial n)
(let loop ((i n) (acc 1))
(if (= i 0)
acc
(loop (- i 1) (* acc i)))))
(display "10! = ")
(display (factorial 10))
(newline)
(display "20! = ")
(display (factorial 20))
(newline)