From 05151c648c6f33a7288e57431c08b635f69dc94f Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 20 Dec 2017 08:31:17 +0000 Subject: [PATCH] [functional-tests] from-to loop macro --- functional-tests/loops.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/functional-tests/loops.scm b/functional-tests/loops.scm index f4d372b..adaf381 100644 --- a/functional-tests/loops.scm +++ b/functional-tests/loops.scm @@ -1,6 +1,6 @@ (library (loops) - (export upto while) + (export upto from-to while) (import (rnrs)) (define-syntax upto @@ -11,6 +11,14 @@ (begin body ...) (loop (+ 1 var))))))) + (define-syntax from-to + (syntax-rules () + ((_ (var f t step) b1 b2 ...) + (let loop ((var f)) + (unless (= var t) + b1 b2 ... + (loop (+ var step))))))) + (define-syntax while (syntax-rules () ((_ (var exp) body ...)