Skip to content

Instantly share code, notes, and snippets.

@markomanninen
Created July 26, 2017 17:12
Show Gist options
  • Save markomanninen/ab556dad0ccecbc5846097f8e92888dc to your computer and use it in GitHub Desktop.
Save markomanninen/ab556dad0ccecbc5846097f8e92888dc to your computer and use it in GitHub Desktop.
Macro to call other macro and recursively passing parameters one by one
; 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