Created
July 26, 2017 17:12
-
-
Save markomanninen/ab556dad0ccecbc5846097f8e92888dc to your computer and use it in GitHub Desktop.
Macro to call other macro and recursively passing parameters one by one
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
; singular variable setter | |
(defmacro defproposition [symbol] | |
; this is simplified here for demonstration | |
`(setv ~symbol None)) | |
; multiple variable setter | |
(defmacro defpropositions [&rest args] | |
(if (len args) | |
`(do | |
(defproposition ~(get args 0)) | |
(defpropositions ~@(cut args 1))))) | |
; should create all variables at once | |
(defpropositions P Q R) | |
(print P Q R) ; -> None None None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment