Created
January 11, 2021 06:51
-
-
Save altbodhi/ffcf5b5ead2ac062798a2ec85f5da55c to your computer and use it in GitHub Desktop.
macro for generete same writeln as in pascal
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 writeln (&rest args) | |
`(progn | |
(loop for e in '(,@args) | |
do | |
(format t "~A" e)) | |
(format t "~%"))) | |
(defstruct person name) | |
(defgeneric hello (obj) | |
(:documentation "Say hello to object.")) | |
(defmethod hello ((obj person)) | |
(writeln "Hello, " (person-name obj) "!")) | |
(defvar p1 (make-person | |
:name "Alice")) | |
(hello p1) | |
;;печатает символы вместо значений | |
;;c:\tmp>sbcl --script mac.lisp | |
;;sbcl --script mac.lisp | |
;;Hello, (PERSON-NAME OBJ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment