├── .gitignore ├── LICENSE ├── README.md ├── package.lisp ├── trivial-macroexpand-all.asd └── trivial-macroexpand-all.lisp /.gitignore: -------------------------------------------------------------------------------- 1 | *.FASL 2 | *.fasl 3 | *.lisp-temp 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # trivial-macroexpand-all 2 | 3 | Provides a macroexpand-all function that calls the implementation specific equivalent. 4 | 5 | Supports: `abcl`, `allegro`, `ccl`, `clisp`, `cmucl`, `corman`, `lispworks`, `mkcl`, `sbcl`, `ecl` & `scl` 6 | 7 | If you the function from a supported implementation then the three return values are: 8 | - the expanded form 9 | - t 10 | - t, if the implementation specific equivalent accepts an environment 11 | 12 | If you the function from an usupported implementation then the three return values are: 13 | - the original form 14 | - nil 15 | - nil 16 | 17 | ## Example 18 | 19 | ``` 20 | CL-USER> (trivial-macroexpand-all:macroexpand-all '(or 1 2 3 4)) 21 | 22 | (LET ((#:G622 1)) 23 | (IF #:G622 24 | #:G622 25 | (LET ((#:G623 2)) 26 | (IF #:G623 27 | #:G623 28 | (LET ((#:G624 3)) 29 | (IF #:G624 30 | #:G624 31 | 4))))) 32 | ``` 33 | 34 | ## Trivial..again? 35 | 36 | Yup another library using the `trivial-*` naming convention`, `but look at the source.. it's pretty damn trivial 37 | -------------------------------------------------------------------------------- /package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; package.lisp 2 | 3 | (defpackage #:trivial-macroexpand-all 4 | (:use #:cl) 5 | (:export :macroexpand-all)) 6 | -------------------------------------------------------------------------------- /trivial-macroexpand-all.asd: -------------------------------------------------------------------------------- 1 | ;;;; trivial-macroexpand-all.asd 2 | 3 | (asdf:defsystem #:trivial-macroexpand-all 4 | :description "Call each implementation's macroexpand-all equivalent" 5 | :author "Chris Bagley " 6 | :license "Unlicense" 7 | :serial t 8 | #+sbcl :depends-on 9 | #+sbcl (:sb-cltl2) 10 | :components ((:file "package") 11 | (:file "trivial-macroexpand-all"))) 12 | -------------------------------------------------------------------------------- /trivial-macroexpand-all.lisp: -------------------------------------------------------------------------------- 1 | (in-package #:trivial-macroexpand-all) 2 | 3 | #+abcl 4 | (defun macroexpand-all (form &optional env) 5 | (values (ext:macroexpand-all form env) t t)) 6 | 7 | #+allegro 8 | (defun macroexpand-all (form &optional env) 9 | (declare (ignore env)) 10 | #+(and allegro-version>= (version>= 8 0)) 11 | (values (excl::walk-form form) t nil) 12 | #-(and allegro-version>= (version>= 8 0)) 13 | (values (excl::walk form) t nil)) 14 | 15 | #+ccl 16 | (defun macroexpand-all (form &optional env) 17 | (values (ccl:macroexpand-all form env) t t)) 18 | 19 | #+clisp 20 | (defun macroexpand-all (form &optional env) 21 | (declare (ignore env)) 22 | (values (ext:expand-form form) t nil)) 23 | 24 | #+cmucl 25 | (defun macroexpand-all (form &optional env) 26 | (values (walker:macroexpand-all form env) t t)) 27 | 28 | #+corman 29 | (defun macroexpand-all (form &optional env) 30 | (declare (ignore env)) 31 | (values (ccl:macroexpand-all form) t nil)) 32 | 33 | #+ecl 34 | (defun macroexpand-all (form &optional env) 35 | (values (walker:macroexpand-all form env) t t)) 36 | 37 | #+lispworks 38 | (defun macroexpand-all (form &optional env) 39 | (declare (ignore env)) 40 | (values (walker:walk-form form) t nil)) 41 | 42 | #+mkcl 43 | (defun macroexpand-all (form &optional env) 44 | (declare (ignore env)) 45 | (values (walker:macroexpand-all form) t nil)) 46 | 47 | #+sbcl 48 | (defun macroexpand-all (form &optional env) 49 | (values (sb-cltl2:macroexpand-all form env) t t)) 50 | 51 | #+scl 52 | (defun macroexpand-all (form &optional env) 53 | (declare (ignore env)) 54 | (values (macroexpand form) t nil)) 55 | 56 | #-(or abcl allegro ccl clisp cmucl corman ecl lispworks mkcl sbcl scl) 57 | (defun macroexpand-all (form &optional env) 58 | (declare (ignore env)) 59 | (values form nil nil)) 60 | --------------------------------------------------------------------------------