diff options
author | David Robillard <d@drobilla.net> | 2009-06-18 20:22:10 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-18 20:22:10 +0000 |
commit | 545b524bda45f2087ac92cf58f6eaa78499332cf (patch) | |
tree | 71043cffd2b64da7420d2840a6be666b9fef037a /test | |
parent | 4e34e229beb12164ea49b1121785dc71eb7c3566 (diff) | |
download | resp-545b524bda45f2087ac92cf58f6eaa78499332cf.tar.gz resp-545b524bda45f2087ac92cf58f6eaa78499332cf.tar.bz2 resp-545b524bda45f2087ac92cf58f6eaa78499332cf.zip |
Primitive internal macro system (for implementing sugar).
(def (f x) ...) sugar.
git-svn-id: http://svn.drobilla.net/resp/tuplr@119 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'test')
-rw-r--r-- | test/ack.tpr | 9 | ||||
-rw-r--r-- | test/fac.tpr | 6 |
2 files changed, 7 insertions, 8 deletions
diff --git a/test/ack.tpr b/test/ack.tpr index 1fe38d5..76fb397 100644 --- a/test/ack.tpr +++ b/test/ack.tpr @@ -1,8 +1,7 @@ -(def ack - (fn (m n) - (if (= 0 m) (+ n 1) - (= 0 n) (ack (- m 1) 1) - (ack (- m 1) (ack m (- n 1)))))) +(def (ack m n) + (if (= 0 m) (+ n 1) + (= 0 n) (ack (- m 1) 1) + (ack (- m 1) (ack m (- n 1))))) (ack 3 10) diff --git a/test/fac.tpr b/test/fac.tpr index 77e4776..0fb687c 100644 --- a/test/fac.tpr +++ b/test/fac.tpr @@ -1,7 +1,7 @@ ; Factorial -(def fac (fn (n) +(def (fac n) (if (= 0 n) 1 - (* n (fac (- n 1)))))) + (* n (fac (- n 1))))) -(fac 5) +(fac 6) |