Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created June 19, 2012 02:23
Show Gist options
  • Save legumbre/2951963 to your computer and use it in GitHub Desktop.
Save legumbre/2951963 to your computer and use it in GitHub Desktop.
(defmacro lif (COND THEN &rest ELSE)
`(if ,COND
(progn
(message (format "(then) %s is true" (prin1-to-string (quote ,COND))))
,THEN)
(message (format "(else): %s is false" (prin1-to-string (quote ,COND))))
,@ELSE))
(lif (< 8 9)
"yay"
"nay") ;;
;; macroexpanded con M-x pp-macroexpand-last-sexp
(if
(< 8 9)
(progn
(message
(format "(then) %s is true"
(prin1-to-string
'(< 8 9))))
"yay")
(message
(format "(else): %s is false"
(prin1-to-string
'(< 8 9))))
"nay")
(defmacro lif (COND THEN &rest ELSE)
`(if ,COND
(progn
(message (format "(then) %s is true" (prin1-to-string (quote ,COND))))
,THEN)
(message (format "(else): %s is false" (prin1-to-string (quote ,COND))))
,@ELSE))
(lif (< 8 9)
"yay"
"nay") ;;
;; macroexpanded con M-x pp-macroexpand-last-sexp
(if
(< 8 9)
(progn
(message
(format "(then) %s is true"
(prin1-to-string
'(< 8 9))))
"yay")
(message
(format "(else): %s is false"
(prin1-to-string
'(< 8 9))))
"nay")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment