From a065efdfddc421ff72780e7db168c4473ba98b94 Mon Sep 17 00:00:00 2001 From: Jeff Evans Date: Tue, 23 Mar 2021 09:16:47 -0500 Subject: [PATCH] Fixing last occurence of code-critic macro to match the others (this one seemingly switches to associative destructuring out of nowhere, and doesn't work as written). --- content/cftbat/writing-macros.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/cftbat/writing-macros.html b/content/cftbat/writing-macros.html index 32346791..ecf00a68 100644 --- a/content/cftbat/writing-macros.html +++ b/content/cftbat/writing-macros.html @@ -331,7 +331,7 @@

Refactoring a Macro and Unquote Splicing

Unquote splicing unwraps a seqable data structure, placing its contents directly within the enclosing syntax-quoted data structure. It’s like the ~@ is a sledgehammer and whatever follows it is a piñata, and the result is the most terrifying and awesome party you’ve ever been to.

Anyway, if you use unquote splicing in your code critic, then everything will work great:

(defmacro code-critic
-  [{:keys [good bad]}]
+  [bad good]
   `(do ~@(map #(apply criticize-code %)
               [["Sweet lion of Zion, this is bad code:" bad]
                ["Great cow of Moscow, this is good code:" good]])))