4 ms·
Here, adding a 'unless' statement: (defmacro unless [expr & body] `(if ~expr nil (do ~@body))) Taken from: http://stackoverflow.com/questions/2977882/defi
by Kototama 15y ago
Here, adding a 'unless' statement:
(defmacro unless [expr & body] `(if ~expr nil (do ~@body)))
Taken from:
http://stackoverflow.com/questions/2977882/defining-clojure-macro-syntax http://stackoverflow.com/questions/2977882/defining-clojure-...
Macro in Lisp are essentially functions taking code as argument and returning code, but they are executed at compile-time.
Edit: replaced with the correct version, sorry for the error.
- roryokane 15y agoAccording to that question's answer and comments, that definition is buggy (making it not quite a fair comparison). Here is a less buggy, more flexible version, taken from a comment: (defmacro unless [expr & body] `(if ~expr nil (do ~@body)))