summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaggers <chris.bagley@gmail.com>2017-03-30 13:13:52 +0200
committerBaggers <chris.bagley@gmail.com>2017-03-30 13:13:52 +0200
commite63727ffad2412ab002740d935981820dd8ef548 (patch)
tree0dd5fd2cdf8df5bfa8943174139416f44b7922fb
parent5d0f24489baf96d618946f0eb390ac45b1d0a32f (diff)
Change the macroexpand-all api
We now return the form and whether the form was expanded.
-rw-r--r--README.md8
-rw-r--r--trivial-macroexpand-all.lisp27
2 files changed, 20 insertions, 15 deletions
diff --git a/README.md b/README.md
index f32c97f..187c867 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,13 @@ Provides a macroexpand-all function that calls the implementation specific equiv
Supports: `abcl`, `allegro`, `ccl`, `clisp`, `cmucl`, `corman`, `lispworks`, `mkcl`, `sbcl`, `ecl` & `scl`
-On unsupported implementations it returns the form unchanged and emits a warning.
+If you the function from a supported implementation then the two return values are:
+- the expanded form
+- t
+
+If you the function from an usupported implementation then the two return values are:
+- the original form
+- nil
## Trivial..again?
diff --git a/trivial-macroexpand-all.lisp b/trivial-macroexpand-all.lisp
index e2c7064..9d5a2bc 100644
--- a/trivial-macroexpand-all.lisp
+++ b/trivial-macroexpand-all.lisp
@@ -2,59 +2,58 @@
#+abcl
(defun macroexpand-all (form &optional env)
- (ext:macroexpand-all form env))
+ (values (ext:macroexpand-all form env) t))
#+allegro
(defun macroexpand-all (form &optional env)
(declare (ignore env))
#+(and allegro-version>= (version>= 8 0))
- (excl::walk-form form)
+ (values (excl::walk-form form) t)
#-(and allegro-version>= (version>= 8 0))
- (excl::walk form))
+ (values (excl::walk form) t))
#+ccl
(defun macroexpand-all (form &optional env)
- (ccl:macroexpand-all form env))
+ (values (ccl:macroexpand-all form env) t))
#+clisp
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (ext:expand-form form))
+ (values (ext:expand-form form) t))
#+cmucl
(defun macroexpand-all (form &optional env)
- (walker:macroexpand-all form env))
+ (values (walker:macroexpand-all form env) t))
#+corman
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (ccl:macroexpand-all form))
+ (values (ccl:macroexpand-all form) t))
#+ecl
(defun macroexpand-all (form &optional env)
- (walker:macroexpand-all form env))
+ (values (walker:macroexpand-all form env) t))
#+lispworks
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (walker:walk-form form))
+ (values (walker:walk-form form) t))
#+mkcl
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (walker:macroexpand-all form))
+ (values (walker:macroexpand-all form) t))
#+sbcl
(defun macroexpand-all (form &optional env)
- (sb-cltl2:macroexpand-all form env))
+ (values (sb-cltl2:macroexpand-all form env) t))
#+scl
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (macroexpand form))
+ (values (macroexpand form) t))
#-(or abcl allegro ccl clisp cmucl corman ecl lispworks mkcl sbcl scl)
(defun macroexpand-all (form &optional env)
(declare (ignore env))
- (warn "trivial-macroexpand-all is not currently available for this implementation")
- form)
+ (values form nil))