Skip to content

Instantly share code, notes, and snippets.

@emacdona
Last active January 17, 2022 01:13
Show Gist options
  • Save emacdona/b497b9a551caf3f68049736c64b989de to your computer and use it in GitHub Desktop.
Save emacdona/b497b9a551caf3f68049736c64b989de to your computer and use it in GitHub Desktop.
(defmacro code-generator-caller-1 (code-generator)
`(quote ,(funcall code-generator)))
(defmacro code-generator-caller-2 (code-generator)
`(quote ,(funcall (eval code-generator))))
(defmacro run-example (symbol)
`(,symbol (lambda () 'hello)))
;; (run-example funcall)
;; yields:
;; HELLO
;;
;; (run-example code-generator-caller-2)
;; yields:
;; HELLO
;;
;; (run-example code-generator-caller-1)
;; yields:
;; The value
;; (LAMBDA () 'HELLO)
;; is not of type
;; (OR FUNCTION SYMBOL)
;; [Condition of type TYPE-ERROR]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment