Skip to content

Commit

Permalink
Merge pull request #211 from jeff303/fix-last-code-critic
Browse files Browse the repository at this point in the history
Fixing last occurence of code-critic macro
  • Loading branch information
flyingmachine authored Mar 22, 2022
2 parents c29df14 + a065efd commit 7995343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/cftbat/writing-macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ <h2>Refactoring a Macro and Unquote Splicing</h2>
<p class="Body">Unquote splicing unwraps a seqable data structure, placing its contents directly within the enclosing syntax-quoted data structure. It’s like the <code>~@</code> 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.</p>
<p class="Body">Anyway, if you use unquote splicing in your code critic, then everything will work great:</p>
<div class="listingblock"><div class="content"><pre class="pygments highlight"><code data-lang="clojure" class="block"><span class="tok-p">(</span><span class="tok-kd">defmacro </span><span class="tok-nv">code-critic</span>
<span class="tok-p">[{</span><span class="tok-ss">:keys</span> <span class="tok-p">[</span><span class="tok-nv">good</span> <span class="tok-nv">bad</span><span class="tok-p">]}]</span>
<span class="tok-p">[</span><span class="tok-nv">bad</span> <span class="tok-nv">good</span><span class="tok-p">]</span>
<span class="tok-o">`</span><span class="tok-p">(</span><span class="tok-k">do </span><span class="tok-o">~@</span><span class="tok-p">(</span><span class="tok-nb">map </span><span class="tok-o">#</span><span class="tok-p">(</span><span class="tok-nb">apply </span><span class="tok-nv">criticize-code</span> <span class="tok-nv">%</span><span class="tok-p">)</span>
<span class="tok-p">[[</span><span class="tok-s">"Sweet lion of Zion, this is bad code:"</span> <span class="tok-nv">bad</span><span class="tok-p">]</span>
<span class="tok-p">[</span><span class="tok-s">"Great cow of Moscow, this is good code:"</span> <span class="tok-nv">good</span><span class="tok-p">]])))</span>
Expand Down

0 comments on commit 7995343

Please sign in to comment.