From 25bd680141bcdc53a937128019958d10d4abb48d Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Thu, 15 Oct 2009 23:38:19 +0000 Subject: [PATCH] add example syntax-rules honu macro svn: r16334 --- collects/tests/honu/macros.ss | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 collects/tests/honu/macros.ss diff --git a/collects/tests/honu/macros.ss b/collects/tests/honu/macros.ss new file mode 100644 index 0000000000..f21cc61607 --- /dev/null +++ b/collects/tests/honu/macros.ss @@ -0,0 +1,32 @@ +#lang honu + +/* +=> + +x = function(q){ + print q; + if (q < end){ + x(q+1); + } +} +x(start); +*/ + +macro (to do end) {{ for looper:id = first:expr to last:expr do + body +end +}} +{{ + /* display(2); */ + var x = function(looper){ + display(body); newline(); + if (looper < last){ + x(looper+1); + } + }; + x(first); +}} + +for x = 1 to 10 do + x +end