diff options
author | michele.simionato <devnull@localhost> | 2009-05-19 05:47:23 +0000 |
---|---|---|
committer | michele.simionato <devnull@localhost> | 2009-05-19 05:47:23 +0000 |
commit | 9e7fdbcffed8551be5df74c394fc58a1a24ee0db (patch) | |
tree | b9cbc180c623d2d886d71a55463ce80e995769e5 /artima | |
parent | 39ad55da678aba3d62b1f1810a2352bccf33a6cb (diff) | |
download | micheles-9e7fdbcffed8551be5df74c394fc58a1a24ee0db.tar.gz |
Added a couple of missing files
Diffstat (limited to 'artima')
-rw-r--r-- | artima/scheme/Makefile | 2 | ||||
-rw-r--r-- | artima/scheme/repeat-benchmark.ss | 4 | ||||
-rw-r--r-- | artima/scheme/repeat-macro.sls | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/artima/scheme/Makefile b/artima/scheme/Makefile index 1f455e4..925e8bc 100644 --- a/artima/scheme/Makefile +++ b/artima/scheme/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -PAPER = +PAPER = a4 # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 diff --git a/artima/scheme/repeat-benchmark.ss b/artima/scheme/repeat-benchmark.ss new file mode 100644 index 0000000..2247d99 --- /dev/null +++ b/artima/scheme/repeat-benchmark.ss @@ -0,0 +1,4 @@ +(import (rnrs) (repeat-macro) (repeat) (only (ikarus) time)) +(define n (string->number (car (reverse (command-line))))) +(time (call 10000000 + 1 n)) +(time (repeat 10000000 (+ 1 n))) diff --git a/artima/scheme/repeat-macro.sls b/artima/scheme/repeat-macro.sls new file mode 100644 index 0000000..e44db91 --- /dev/null +++ b/artima/scheme/repeat-macro.sls @@ -0,0 +1,8 @@ +(library (repeat-macro) +(export repeat) +(import (rnrs) (sweet-macros)) + +(def-syntax (repeat n body body* ...) + #'(let loop ((i 0)) + (when (< i n) body body* ... (loop (+ 1 i))))) +) |