Created
September 19, 2021 10:24
-
-
Save lukego/830a787776b93d2cf9ff8fc6304598ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmacro def.wrapper (f args) | |
| "Make (.F ARGS...) a double-float version of (F ARGS...)." | |
| (flet ((coercer (x) `(coerce ,x 'double-float))) | |
| `(defun ,(symbolicate "." f) ,args | |
| ,(coercer `(,f ,@(mapcar #'coercer args)))))) | |
| (def.wrapper + (x y)) | |
| ==> | |
| (DEFUN .+ (X Y) | |
| (COERCE (+ (COERCE X 'DOUBLE-FLOAT) (COERCE Y 'DOUBLE-FLOAT)) 'DOUBLE-FLOAT)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment