2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,4 @@
(do ((i 2 (+ i 2))) ; list of variables, initials and steps -- you can iterate over several at once
((>= i 9)) ; exit condition
(display i) ; body
(newline))

View file

@ -0,0 +1,5 @@
(let loop ((i 2)) ; function name, parameters and starting values
(cond ((< i 9)
(display i)
(newline)
(loop (+ i 2)))))) ; tail-recursive call, won't create a new stack frame

View file

@ -0,0 +1,11 @@
(define-syntax for-loop
(syntax-rules ()
((for-loop index start end step body ...)
(let ((evaluated-end end) (evaluated-step step))
(let loop ((i start))
(if (< i evaluated-end)
((lambda (index) body ... (loop (+ i evaluated-step))) i)))))))
(for-loop i 2 9 2
(display i)
(newline))