Created
December 8, 2018 23:06
-
-
Save lagagain/2d2af368a50dfd5b65a17a0aad681edf to your computer and use it in GitHub Desktop.
example for read macro
This file contains 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
(set-dispatch-macro-character #\# #\o | |
(lambda (s c1 c2) | |
(declare (ignore c1 c2)) | |
(let* ((form (read s)) | |
(obj (car form)) | |
(method (cadr form)) | |
(args (cddr form))) | |
`(,method ,obj ,@args)))) | |
(defmethod run ((name string)) | |
(format t "~&~A is runing.~%" name)) | |
(run "john") | |
#o("john" run) | |
#o("John" . (run)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment