From a70c25e912437e55c87f2ece465e55a95d72ee5e Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 17 Aug 2017 14:11:59 +0100 Subject: [PATCH] [functional tests] start a (loops) library Contains upto. --- functional-tests/loops.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 functional-tests/loops.scm diff --git a/functional-tests/loops.scm b/functional-tests/loops.scm new file mode 100644 index 0000000..ad9447d --- /dev/null +++ b/functional-tests/loops.scm @@ -0,0 +1,13 @@ +(library + (loops) + (export upto) + (import (rnrs)) + + (define-syntax upto + (syntax-rules () + ((_ (var count) body ...) + (let loop ((var 0)) + (when (< var count) + (begin body ...) + (loop (+ 1 var)))))))) +