summaryrefslogtreecommitdiff
path: root/scheme
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-03 01:21:03 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-03 01:21:03 +0200
commit53f1b00552be4057af7c0ef19d708bb2bbf86952 (patch)
tree535ce4228de18544e1aa521d20bc986ca7dbb8df /scheme
parentbfcb656cd2f17b6cfc90afa0c535c95294863558 (diff)
downloadgeiser-guile-53f1b00552be4057af7c0ef19d708bb2bbf86952.tar.gz
geiser-guile-53f1b00552be4057af7c0ef19d708bb2bbf86952.tar.bz2
PLT: simple macroexpand.
Diffstat (limited to 'scheme')
-rw-r--r--scheme/plt/geiser.ss2
-rw-r--r--scheme/plt/geiser/eval.ss7
2 files changed, 9 insertions, 0 deletions
diff --git a/scheme/plt/geiser.ss b/scheme/plt/geiser.ss
index dd6b7c3..bbb083d 100644
--- a/scheme/plt/geiser.ss
+++ b/scheme/plt/geiser.ss
@@ -29,6 +29,7 @@
geiser/compile
geiser/load-file
geiser/compile-file
+ geiser/macroexpand
geiser/completions
geiser/symbol-location
geiser/autodoc
@@ -44,6 +45,7 @@
(define (geiser/autodoc . x) #f)
(define geiser/completions completions)
(define geiser/symbol-location symbol-location)
+ (define geiser/macroexpand macroexpand)
(define (geiser/make-repl-reader)
(compose (make-repl-reader (current-prompt-read)) current-namespace)))
diff --git a/scheme/plt/geiser/eval.ss b/scheme/plt/geiser/eval.ss
index 0490c1e..2345e14 100644
--- a/scheme/plt/geiser/eval.ss
+++ b/scheme/plt/geiser/eval.ss
@@ -30,6 +30,7 @@
compile-in
load-file
compile-file
+ macroexpand
make-repl-reader)
(require scheme/enter srfi/13)
@@ -115,6 +116,12 @@
(define compile-file load-file)
+(define (macroexpand form . all)
+ (let ((all (and (not (null? all)) (car all))))
+ (with-output-to-string
+ (lambda ()
+ (pretty-print (syntax->datum ((if all expand expand-once) form)))))))
+
(define (make-repl-reader builtin-reader)
(lambda (ns)
(last-namespace ns)