<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://clojure-diary.gitlab.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://clojure-diary.gitlab.io/" rel="alternate" type="text/html" /><updated>2026-09-12T17:29:49+05:30</updated><id>https://clojure-diary.gitlab.io/feed.xml</id><title type="html">Clojure Diary</title><subtitle>Hello, I am Karthikeyan A K, a software architect, for some reason I am getting hooked up with Clojure, and these writings are my experience with this language. One may contact me @ +91 8428050777 for Clojure consolation in weekends.</subtitle><entry><title type="html">def Is Not a Function. It’s Not Even a Macro.</title><link href="https://clojure-diary.gitlab.io/2026/09/12/def-is-not-a-function-it-s-not-even-a-macro.html" rel="alternate" type="text/html" title="def Is Not a Function. It’s Not Even a Macro." /><published>2026-09-12T16:45:00+05:30</published><updated>2026-09-12T16:45:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/09/12/def-is-not-a-function-it-s-not-even-a-macro</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/09/12/def-is-not-a-function-it-s-not-even-a-macro.html"><![CDATA[<p>Every so often a question comes along that seems too basic to be interesting, and turns out to be exactly the opposite. “Is <code class="language-plaintext highlighter-rouge">def</code> a function or a macro?” is one of those questions. The honest answer is: neither. And once you sit with <em>why</em>, you end up staring straight at the floor Clojure is built on.</p>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/b_dI_mA28k8" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<h2 id="the-trap-of-the-obvious-answer">The trap of the obvious answer</h2>

<p>If you’ve been writing Clojure for a while, your instinct probably says “macro.” After all, <code class="language-plaintext highlighter-rouge">def</code> looks like it’s doing something at compile time — it takes a raw symbol, <code class="language-plaintext highlighter-rouge">x</code>, and doesn’t evaluate it the way a normal function would evaluate its arguments. That’s macro-like behavior, right?</p>

<p>Except it isn’t, and here’s the tell: macros are things you can <em>expand</em>. Try it:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="nb">macroexpand</span><span class="w"> </span><span class="o">'</span><span class="p">(</span><span class="k">def</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="mi">1</span><span class="p">))</span><span class="w">
</span><span class="c1">;=&gt; (def x 1)</span><span class="w">
</span></code></pre></div></div>

<p>Nothing happens. You get the same form back, unchanged. A real macro — <code class="language-plaintext highlighter-rouge">when</code>, <code class="language-plaintext highlighter-rouge">-&gt;</code>, <code class="language-plaintext highlighter-rouge">defn</code> — rewrites itself into something else when you expand it. <code class="language-plaintext highlighter-rouge">def</code> refuses to rewrite into anything, because there’s nowhere lower to go. It’s already at the bottom.</p>

<p>That bottom has a name: <strong>special form</strong>.</p>

<h2 id="three-categories-not-two">Three categories, not two</h2>

<p>It’s tempting to think of Clojure code as just “functions and macros,” but there’s a third, smaller, more fundamental category sitting underneath both:</p>

<ul>
  <li><strong>Functions</strong> are ordinary values. You can pass them around, store them, <code class="language-plaintext highlighter-rouge">apply</code> them, take their <code class="language-plaintext highlighter-rouge">class</code>. Nothing about them is syntactically special — <code class="language-plaintext highlighter-rouge">map</code> is a value like <code class="language-plaintext highlighter-rouge">5</code> or <code class="language-plaintext highlighter-rouge">"hello"</code> is a value.</li>
  <li><strong>Macros</strong> are code-rewriting rules. They exist <em>in terms of</em> other code. Every macro, when you peel back the expansion, eventually bottoms out in function calls and special forms. <code class="language-plaintext highlighter-rouge">when</code> is a macro; expand it and you’ll find <code class="language-plaintext highlighter-rouge">if</code> waiting underneath.</li>
  <li><strong>Special forms</strong> are the primitives the evaluator itself understands. They’re not defined in Clojure — they’re hardcoded into the compiler. <code class="language-plaintext highlighter-rouge">def</code>, <code class="language-plaintext highlighter-rouge">if</code>, <code class="language-plaintext highlighter-rouge">do</code>, <code class="language-plaintext highlighter-rouge">quote</code>, <code class="language-plaintext highlighter-rouge">fn*</code>, <code class="language-plaintext highlighter-rouge">let*</code>, <code class="language-plaintext highlighter-rouge">loop*</code>, <code class="language-plaintext highlighter-rouge">recur</code>, <code class="language-plaintext highlighter-rouge">throw</code>, <code class="language-plaintext highlighter-rouge">try</code>, <code class="language-plaintext highlighter-rouge">var</code>, <code class="language-plaintext highlighter-rouge">new</code>, <code class="language-plaintext highlighter-rouge">set!</code>, the dot special form — this is the closed, small set everything else is built from.</li>
</ul>

<p><code class="language-plaintext highlighter-rouge">def</code> has to be in that third bucket because of what it does: it creates a Var and binds it into a namespace, using the symbol <em>itself</em>, unevaluated, as the name — with full knowledge of which namespace you’re currently compiling in. No ordinary function can do that, because ordinary functions evaluate all their arguments before they ever get a look at them. By the time a function saw <code class="language-plaintext highlighter-rouge">x</code>, it’d already have been evaluated to whatever <code class="language-plaintext highlighter-rouge">x</code> currently means (or it’d throw, since <code class="language-plaintext highlighter-rouge">x</code> isn’t defined yet — that’s the whole point of <code class="language-plaintext highlighter-rouge">def</code>).</p>

<p>You can ask Clojure directly, instead of reasoning it out:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="nb">special-symbol?</span><span class="w"> </span><span class="ss">'def</span><span class="p">)</span><span class="w">  </span><span class="c1">;=&gt; true</span><span class="w">
</span></code></pre></div></div>

<h2 id="so-how-do-you-tell-the-other-two-apart">So how do you tell the other two apart?</h2>

<p>Once you accept that special forms are their own thing, a natural follow-up shows up: fine, but how do I check whether some <em>other</em> symbol is a function or a macro? Is there a <code class="language-plaintext highlighter-rouge">macro?</code> to go with <code class="language-plaintext highlighter-rouge">special-symbol?</code></p>

<p>There isn’t one built into <code class="language-plaintext highlighter-rouge">clojure.core</code> — which surprised me a little — but it’s a one-liner, because macro-ness is just metadata on the Var:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="no">:macro</span><span class="w"> </span><span class="p">(</span><span class="nb">meta</span><span class="w"> </span><span class="o">#</span><span class="ss">'when</span><span class="p">))</span><span class="w">  </span><span class="c1">;=&gt; true</span><span class="w">
</span><span class="p">(</span><span class="no">:macro</span><span class="w"> </span><span class="p">(</span><span class="nb">meta</span><span class="w"> </span><span class="o">#</span><span class="ss">'map</span><span class="p">))</span><span class="w">   </span><span class="c1">;=&gt; nil</span><span class="w">
</span></code></pre></div></div>

<p>That’s the whole trick. Wrap it in a function if you want a name for it:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="k">defn</span><span class="w"> </span><span class="n">macro?</span><span class="w"> </span><span class="p">[</span><span class="n">sym</span><span class="p">]</span><span class="w">
  </span><span class="p">(</span><span class="no">:macro</span><span class="w"> </span><span class="p">(</span><span class="nb">meta</span><span class="w"> </span><span class="p">(</span><span class="nb">resolve</span><span class="w"> </span><span class="n">sym</span><span class="p">))))</span><span class="w">
</span></code></pre></div></div>

<p>Functions are checked differently, and the difference matters conceptually: macros are a property of the <em>symbol</em>/Var, but functions are a property of the <em>value</em> the symbol resolves to. So you resolve first, then ask the value what it is:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="nf">fn?</span><span class="w"> </span><span class="o">@</span><span class="p">(</span><span class="nb">resolve</span><span class="w"> </span><span class="ss">'map</span><span class="p">))</span><span class="w">  </span><span class="c1">;=&gt; true</span><span class="w">
</span></code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">fn?</code> is the direct check. There’s also <code class="language-plaintext highlighter-rouge">ifn?</code>, which is broader — it’s true for anything invocable, including keywords and sets used as lookup functions, not just genuine <code class="language-plaintext highlighter-rouge">fn</code> values.</p>

<h2 id="putting-the-whole-picture-together">Putting the whole picture together</h2>

<p>Every top-level symbol in Clojure falls into exactly one of three buckets, and you can check each one explicitly:</p>

<table>
  <thead>
    <tr>
      <th>Category</th>
      <th>Check</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Special form</td>
      <td><code class="language-plaintext highlighter-rouge">(special-symbol? sym)</code></td>
    </tr>
    <tr>
      <td>Macro</td>
      <td><code class="language-plaintext highlighter-rouge">(:macro (meta (resolve sym)))</code></td>
    </tr>
    <tr>
      <td>Function (or other value)</td>
      <td><code class="language-plaintext highlighter-rouge">(fn? @(resolve sym))</code></td>
    </tr>
  </tbody>
</table>

<p>Which gives you a nice little classifier:</p>

<div class="language-clojure highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="k">defn</span><span class="w"> </span><span class="n">classify</span><span class="w"> </span><span class="p">[</span><span class="n">sym</span><span class="p">]</span><span class="w">
  </span><span class="p">(</span><span class="k">cond</span><span class="w">
    </span><span class="p">(</span><span class="nb">special-symbol?</span><span class="w"> </span><span class="n">sym</span><span class="p">)</span><span class="w"> </span><span class="no">:special-form</span><span class="w">
    </span><span class="p">(</span><span class="no">:macro</span><span class="w"> </span><span class="p">(</span><span class="nb">meta</span><span class="w"> </span><span class="p">(</span><span class="nb">resolve</span><span class="w"> </span><span class="n">sym</span><span class="p">)))</span><span class="w"> </span><span class="no">:macro</span><span class="w">
    </span><span class="p">(</span><span class="nf">fn?</span><span class="w"> </span><span class="o">@</span><span class="p">(</span><span class="nb">resolve</span><span class="w"> </span><span class="n">sym</span><span class="p">))</span><span class="w"> </span><span class="no">:function</span><span class="w">
    </span><span class="no">:else</span><span class="w"> </span><span class="no">:value</span><span class="p">))</span><span class="w">

</span><span class="p">(</span><span class="nf">classify</span><span class="w"> </span><span class="ss">'def</span><span class="p">)</span><span class="w">   </span><span class="c1">;=&gt; :special-form</span><span class="w">
</span><span class="p">(</span><span class="nf">classify</span><span class="w"> </span><span class="ss">'when</span><span class="p">)</span><span class="w">  </span><span class="c1">;=&gt; :macro</span><span class="w">
</span><span class="p">(</span><span class="nf">classify</span><span class="w"> </span><span class="ss">'map</span><span class="p">)</span><span class="w">   </span><span class="c1">;=&gt; :function</span><span class="w">
</span><span class="p">(</span><span class="nf">classify</span><span class="w"> </span><span class="ss">'nil</span><span class="p">)</span><span class="w">   </span><span class="c1">;=&gt; :value (resolve fails here actually, since nil isn't a var)</span><span class="w">
</span></code></pre></div></div>

<p>One honest caveat: <code class="language-plaintext highlighter-rouge">resolve</code> only works on symbols that name Vars in some namespace. Local bindings, literals, and destructured names will throw or return <code class="language-plaintext highlighter-rouge">nil</code>. This classifier is for top-level, namespace-resident names — not arbitrary forms you might type at a REPL.</p>

<h2 id="why-this-is-worth-caring-about">Why this is worth caring about</h2>

<p>It would be easy to file this under trivia. I don’t think it is. The three-tier structure — special forms at the bottom, macros built on top of them, functions as ordinary values sitting alongside — is the whole reason Clojure’s syntax stays so small while its expressive power doesn’t. <code class="language-plaintext highlighter-rouge">defn</code>, <code class="language-plaintext highlighter-rouge">let</code>, <code class="language-plaintext highlighter-rouge">-&gt;&gt;</code>, <code class="language-plaintext highlighter-rouge">cond</code>, nearly everything you reach for daily, is a macro that eventually expands down into that tiny, closed set of nineteen-ish special forms. Understanding where the floor is — and that <code class="language-plaintext highlighter-rouge">def</code> lives on it — is understanding why the language holds together at all.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Every so often a question comes along that seems too basic to be interesting, and turns out to be exactly the opposite. “Is def a function or a macro?” is one of those questions. The honest answer is: neither. And once you sit with why, you end up staring straight at the floor Clojure is built on.]]></summary></entry><entry><title type="html">cljrs - first steps</title><link href="https://clojure-diary.gitlab.io/2026/08/22/cljrs-first-steps.html" rel="alternate" type="text/html" title="cljrs - first steps" /><published>2026-08-22T22:28:00+05:30</published><updated>2026-08-22T22:28:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/08/22/cljrs-first-steps</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/08/22/cljrs-first-steps.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/8tnZx2itAE8" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<p>Installs cljrs (<a href="https://rustup.rs/">needs Rust to be installed first</a>)</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cargo <span class="nb">install </span>cljrs
</code></pre></div></div>

<p>Start repl</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cljrs repl
</code></pre></div></div>

<p>Run a <code class="language-plaintext highlighter-rouge">.cljrs</code> file</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cljrs run somefile.cljrs
</code></pre></div></div>

<p>Start nrepl</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cljrs nrepl
</code></pre></div></div>

<p>Clojurust project structure</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>myproj/
├── cljrs.edn
└── src/
    └── myproj/
        └── core.cljrs
</code></pre></div></div>

<p>Start nrepl</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cljrs nrepl
</code></pre></div></div>

<p>Compile project</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cljrs compile <span class="nt">--src-path</span> ./src <span class="nt">--main</span> cljrs-project.core <span class="nt">--out</span> ./target/hello_cljrs_project
</code></pre></div></div>

<ul>
  <li><a href="https://clj.rs/">cljrs</a></li>
  <li><a href="https://towardsdatascience.com/rust-the-next-big-thing-in-data-science-319a03305883/">Data Science With Rust</a></li>
</ul>

<p><strong>Code</strong></p>

<ul>
  <li><a href="https://gitlab.com/clojure-diary/code/cljrs_first_steps">cljrs first steps</a></li>
  <li><a href="https://gitlab.com/clojure-diary/code/cljrs_poject">Clojure Rust Project</a></li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Clojure Vs Rust - Waiting for clj.rs</title><link href="https://clojure-diary.gitlab.io/2026/08/20/clojure-vs-rust-waiting-for-clj-rs.html" rel="alternate" type="text/html" title="Clojure Vs Rust - Waiting for clj.rs" /><published>2026-08-20T18:42:00+05:30</published><updated>2026-08-20T18:42:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/08/20/clojure-vs-rust-waiting-for-clj-rs</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/08/20/clojure-vs-rust-waiting-for-clj-rs.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/EMnYN61kz5Y" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<ul>
  <li>Clojure Vs Rust - Waitiing for <a href="https://clj.rs">https://clj.rs</a>
    <ul>
      <li>Special case
        <ul>
          <li>The problem
            <ul>
              <li><img src="https://archive.org/download/waiting-for-clj.rs/Waiting%20for%20clj.rs.svg" alt="" /></li>
            </ul>
          </li>
        </ul>
      </li>
      <li>.jar
        <ul>
          <li>loading</li>
          <li>unloading</li>
          <li>thousands of times</li>
          <li>GNU Parallel https://www.gnu.org/software/parallel/</li>
          <li>If there way to spawn lot of threads in Clojure / Java?
            <ul>
              <li>No idea</li>
              <li>Maybe my ignorance</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>GraalVM
        <ul>
          <li>Oracle
            <ul>
              <li>I hate it</li>
              <li>Litigation, not a tech company
                <ul>
                  <li>Who like lawsuites once when one is succesful?</li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </li>
      <li>Rust
        <ul>
          <li>ups
            <ul>
              <li>No memory leaks</li>
              <li>Fast</li>
              <li>More compute per watt</li>
              <li>Saves time</li>
            </ul>
          </li>
          <li>downs
            <ul>
              <li>Complex code</li>
              <li>Not at all terse</li>
              <li>Checks data for dimensions
                <ul>
                  <li>So many columns in a spreadsheet
                    <ul>
                      <li>Maybe A.I way of understanding it
                        <ul>
                          <li>Humans should correct it</li>
                        </ul>
                      </li>
                    </ul>
                  </li>
                  <li>In Clojure its just a sequence of maps</li>
                </ul>
              </li>
              <li>Shipping
                <ul>
                  <li>Binary for each platform</li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </li>
      <li>How was the port
        <ul>
          <li>Clojure
            <ul>
              <li>A.I understood clojure well</li>
              <li>Code might be better than strings typed by human
                <ul>
                  <li>Well designed code is understood by AI well</li>
                  <li>
                    <pre><code class="language-Shell">docs/
  requirements/
  	2026_08_20_01_do_a_clojure_vs_rust_video.md
</code></pre>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li>File to file port</li>
          <li>A.I took less than 30 minutes, just one shot</li>
          <li>I was able to make A.I to debug stuff
            <ul>
              <li>The bug was due to bad data fed</li>
            </ul>
          </li>
          <li>Was cool, bit unbeliveable</li>
        </ul>
      </li>
      <li>clj.rs
        <ul>
          <li>-ve
            <ul>
              <li>1 person project :(</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>Other things to explore
        <ul>
          <li>Does clj.rs have a repl that calva can work with?</li>
          <li>jolt https://jolt-lang.net/</li>
          <li>jank https://jank-lang.org/</li>
        </ul>
      </li>
      <li>Speed gains
        <ul>
          <li>70X in Single file performance</li>
          <li>2.3X project perfomance
            <ul>
              <li>Project contains Python code</li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Clojure Book, Massive Quality Update</title><link href="https://clojure-diary.gitlab.io/2026/08/05/clojure-book-massive-quality-update.html" rel="alternate" type="text/html" title="Clojure Book, Massive Quality Update" /><published>2026-08-05T00:35:00+05:30</published><updated>2026-08-05T00:35:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/08/05/clojure-book-massive-quality-update</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/08/05/clojure-book-massive-quality-update.html"><![CDATA[<table>
  <thead>
    <tr>
      <th style="text-align: center">![](https://clojure-book.gitlab.io/images/clojure-book-cover-2001-space-odyssey-10_small.png)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: center">It’s infectious</td>
    </tr>
  </tbody>
</table>

<p>I am very happy to announce that my <a href="https://clojure-book.gitlab.io/">Clojure book</a> has received a massive update. Every line of my book was proofread and corrected by AI, and I read it to make sure that the AI corrections were right.</p>

<p>English is not my native language. Hence, before the AI era, the book I released had many grammatical errors. Now that AI has corrected them, my book is really good to read. In many places, AI has made my book terse and to the point. I’m very happy about it.</p>

<p>This AI proofread also prompted me to proofread the book myself so that no errors would slip by. I have done my best. What was done by AI in less than two hours took me more than three weeks to proofread. There were only a very small number of mistakes that AI made, which I corrected. The book is now far, far better.</p>

<p>I’m sure even Western / English audiences will find my book very enjoyable to read now.</p>

<p>Highlights of this new release are:</p>

<ul>
  <li>The book is completely proofread twice, once by AI and then by me.</li>
  <li>I have released a video for the section “<a href="https://youtu.be/QWhpISM-d5Q">Creating Your Own Libraries</a>.”</li>
  <li>The book is available in all formats: <a href="https://clojure-book.gitlab.io/book.html">online</a>, <a href="https://archive.org/download/clojure_book_2026_08_04/clojure_book_2026_08_04.pdf">PDF</a>, <a href="https://archive.org/download/clojure_book_2026_08_04/clojure_book_2026_08_04.epub">EPUB</a>, and on <a href="https://www.amazon.com/dp/B0BZC7RW6Q">Amazon</a>.</li>
</ul>

<p>I hope you all read my book. Please suggest corrections. And please tell me what material I could add so that my book becomes much better.</p>

<p>I thank all those who have suggested things to improve my book. Clojure has given me a lot, and I’m ready to give back as much as I can. This book is one tiny effort.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[![](https://clojure-book.gitlab.io/images/clojure-book-cover-2001-space-odyssey-10_small.png) It’s infectious]]></summary></entry><entry><title type="html">Introduction To honeysql - Clojure SQL Library</title><link href="https://clojure-diary.gitlab.io/2026/07/29/introduction-to-honeysql-clojure-sql-library.html" rel="alternate" type="text/html" title="Introduction To honeysql - Clojure SQL Library" /><published>2026-07-29T10:50:00+05:30</published><updated>2026-07-29T10:50:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/07/29/introduction-to-honeysql-clojure-sql-library</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/07/29/introduction-to-honeysql-clojure-sql-library.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/1Qdmn3ncQQI" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<ul>
  <li><a href="https://gitlab.com/clojure-diary/code/pg-demo/-/tree/honey-sql">Code</a></li>
  <li><a href="https://github.com/seancorfield/honeysql">honeysql</a></li>
  <li><a href="/2026/07/28/starting-postgres-with-clojure.html">Postgres and Clojure</a></li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Postgres and Clojure</title><link href="https://clojure-diary.gitlab.io/2026/07/28/starting-postgres-with-clojure.html" rel="alternate" type="text/html" title="Postgres and Clojure" /><published>2026-07-28T15:04:00+05:30</published><updated>2026-07-28T15:04:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/07/28/starting-postgres-with-clojure</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/07/28/starting-postgres-with-clojure.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/M3FuCYpLQc8" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<ul>
  <li><a href="https://gitlab.com/clojure-diary/code/pg-demo#">Code</a></li>
  <li><a href="https://en.wikipedia.org/wiki/SQL_injection">SQL Injection</a></li>
  <li><a href="https://postgresapp.com/">Postgres App for Mac</a></li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Finding The Next Working Day, With Clojure</title><link href="https://clojure-diary.gitlab.io/2026/07/10/finding-the-next-working-day-with-clojure.html" rel="alternate" type="text/html" title="Finding The Next Working Day, With Clojure" /><published>2026-07-10T14:23:00+05:30</published><updated>2026-07-10T14:23:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/07/10/finding-the-next-working-day-with-clojure</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/07/10/finding-the-next-working-day-with-clojure.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/5sa-OhOzkuw" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Code:</strong></p>

<ul>
  <li><a href="https://gitlab.com/clojure-diary/code/miscellaneous/-/raw/master/next_working_day.clj">next_working_day.clj</a></li>
  <li><a href="https://gitlab.com/clojure-diary/code/miscellaneous/-/raw/master/next_working_day_2.clj">next_working_day_2.clj</a></li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">libl.in, &amp;amp; Injee, Thanks To Clojure Community. Updates in Clojure Book.</title><link href="https://clojure-diary.gitlab.io/2026/07/07/libl-in-injee-thanks-to-clojure-community-updates-in-clojure-book.html" rel="alternate" type="text/html" title="libl.in, &amp;amp; Injee, Thanks To Clojure Community. Updates in Clojure Book." /><published>2026-07-07T20:29:00+05:30</published><updated>2026-07-07T20:29:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/07/07/libl-in-injee-thanks-to-clojure-community-updates-in-clojure-book</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/07/07/libl-in-injee-thanks-to-clojure-community-updates-in-clojure-book.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/uGu7vNhQCDE" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<ul>
  <li>Injee
    <ul>
      <li><a href="https://tossconf26.kaniyam.com/">https://tossconf26.kaniyam.com/</a></li>
      <li>Tamil Linux
        <ul>
          <li>Telegram
            <ul>
              <li><a href="https://t.me/tamillinux">https://t.me/tamillinux</a></li>
            </ul>
          </li>
          <li>ilugc
            <ul>
              <li><a href="https://ilugc.in/">https://ilugc.in/</a></li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
  <li>https://libl.in
    <ul>
      <li><a href="https://clojure-book.gitlab.io/book.html#_installing_stuff">https://clojure-book.gitlab.io/book.html#_installing_stuff</a>
        <ul>
          <li><a href="https://yu7.in/clj-installing-stuff">https://yu7.in/clj-installing-stuff</a>
            <ul>
              <li>Now it’s fixed :D</li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Clojure Book
    <ul>
      <li>Proof read with A.I
        <ul>
          <li><a href="https://gitlab.com/clojure-book/clojure-book.gitlab.io/-/tree/proof_read">https://gitlab.com/clojure-book/clojure-book.gitlab.io/-/tree/proof_read</a></li>
        </ul>
      </li>
      <li>Release in all human languages</li>
    </ul>
  </li>
  <li>-ve’s
    <ul>
      <li>Video series about ring is stalled</li>
      <li>Stats with Clojure book is stalled
        <ul>
          <li><a href="https://scicloj.github.io/stats_with_clojure/">https://scicloj.github.io/stats_with_clojure/</a></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Deploying Ring App on Ubuntu 26.04</title><link href="https://clojure-diary.gitlab.io/2026/06/15/deploying-ring-app-on-ubuntu-26-04.html" rel="alternate" type="text/html" title="Deploying Ring App on Ubuntu 26.04" /><published>2026-06-15T13:42:00+05:30</published><updated>2026-06-15T13:42:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/06/15/deploying-ring-app-on-ubuntu-26-04</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/06/15/deploying-ring-app-on-ubuntu-26-04.html"><![CDATA[<p>Once you have coded a Ring app,</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>lein ring uberjar
</code></pre></div></div>

<p>This will create a standalone JAR file in the <code class="language-plaintext highlighter-rouge">target</code> directory. Let’s renameit to <code class="language-plaintext highlighter-rouge">my-app.jar</code> for convenience.</p>

<p>Here’s how to host your Clojure Ring app on an Ubuntu VPS:</p>

<h2 id="1-install-java">1. Install Java</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt update
<span class="nb">sudo </span>apt <span class="nb">install </span>openjdk-25-jre-headless
java <span class="nt">-version</span>  <span class="c"># verify</span>
</code></pre></div></div>

<h2 id="2-upload-the-jar">2. Upload the JAR</h2>

<p>From your local machine:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>scp my-app.jar user@your-vps-ip:/home/user/
</code></pre></div></div>

<h2 id="3-run-it-manually-first-sanity-check">3. Run it manually first (sanity check)</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>java <span class="nt">-jar</span> my-app.jar
</code></pre></div></div>

<p>Your app likely starts on port 3000 by default. You can override it:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">PORT</span><span class="o">=</span>8080 java <span class="nt">-jar</span> my-app.jar
</code></pre></div></div>

<p>You can use browser to test your app at <code class="language-plaintext highlighter-rouge">http://your-vps-ip:3000</code>, or <code class="language-plaintext highlighter-rouge">http://your-vps-ip:8080</code> if you set a custom port.</p>

<h2 id="4-set-up-a-systemd-service-so-it-runs-forever">4. Set up a systemd service (so it runs forever)</h2>

<p>Create a service file:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /etc/systemd/system/my-app.service
</code></pre></div></div>

<p>Paste this:</p>

<div class="language-ini highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">[Unit]</span>
<span class="py">Description</span><span class="p">=</span><span class="s">My Clojure Ring App</span>
<span class="py">After</span><span class="p">=</span><span class="s">network.target</span>

<span class="nn">[Service]</span>
<span class="py">User</span><span class="p">=</span><span class="s">user</span>
<span class="py">WorkingDirectory</span><span class="p">=</span><span class="s">/home/user</span>
<span class="py">ExecStart</span><span class="p">=</span><span class="s">/usr/bin/java -jar /home/user/my-app.jar</span>
<span class="py">Restart</span><span class="p">=</span><span class="s">always</span>
<span class="py">RestartSec</span><span class="p">=</span><span class="s">5</span>
<span class="py">Environment</span><span class="p">=</span><span class="s">PORT=3000</span>

<span class="nn">[Install]</span>
<span class="py">WantedBy</span><span class="p">=</span><span class="s">multi-user.target</span>
</code></pre></div></div>

<p>Enable and start it:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>systemctl daemon-reload
<span class="nb">sudo </span>systemctl <span class="nb">enable </span>my-app
<span class="nb">sudo </span>systemctl start my-app
<span class="nb">sudo </span>systemctl status my-app
</code></pre></div></div>

<h2 id="5-set-up-nginx-as-a-reverse-proxy">5. Set up Nginx as a reverse proxy</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install</span> <span class="nt">-y</span> nginx
</code></pre></div></div>

<p>Create a config:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /etc/nginx/sites-available/my-app
</code></pre></div></div>

<div class="language-nginx highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">server</span> <span class="p">{</span>
    <span class="kn">listen</span> <span class="mi">80</span><span class="p">;</span>
    <span class="kn">server_name</span> <span class="s">your-domain.com</span><span class="p">;</span>  <span class="c1"># or your VPS IP</span>

    <span class="kn">location</span> <span class="n">/</span> <span class="p">{</span>
        <span class="kn">proxy_pass</span> <span class="s">http://localhost:3000</span><span class="p">;</span>
        <span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$host</span><span class="p">;</span>
        <span class="kn">proxy_set_header</span> <span class="s">X-Real-IP</span> <span class="nv">$remote_addr</span><span class="p">;</span>
        <span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
        <span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-Proto</span> <span class="nv">$scheme</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<p>Enable it:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo ln</span> <span class="nt">-s</span> /etc/nginx/sites-available/my-app /etc/nginx/sites-enabled/
<span class="nb">sudo </span>nginx <span class="nt">-t</span>
<span class="nb">sudo </span>systemctl reload nginx
</code></pre></div></div>

<h2 id="6-open-the-firewall">6. Open the firewall</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>ufw allow <span class="s1">'Nginx Full'</span>
<span class="nb">sudo </span>ufw allow OpenSSH
<span class="nb">sudo </span>ufw <span class="nb">enable</span>
</code></pre></div></div>

<h2 id="7-add-https-with-lets-encrypt-optional-but-recommended">7. Add HTTPS with Let’s Encrypt (optional but recommended)</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>snap <span class="nb">install</span> <span class="nt">--classic</span> certbot <span class="c"># install certbot</span>
<span class="nb">sudo ln</span> <span class="nt">-s</span> /snap/bin/certbot /usr/local/bin/certbot <span class="c"># Prepare the Certbot command </span>
<span class="nb">sudo </span>certbot <span class="nt">--nginx</span> <span class="c"># follow the prompts to set up HTTPS</span>
</code></pre></div></div>

<p>Certbot will auto-edit your Nginx config and set up auto-renewal.</p>

<hr />

<p><strong>Useful commands after deployment:</strong></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>systemctl restart my-app       <span class="c"># restart after uploading new jar</span>
<span class="nb">sudo </span>journalctl <span class="nt">-u</span> my-app <span class="nt">-f</span>        <span class="c"># tail logs</span>
<span class="nb">sudo </span>systemctl status my-app        <span class="c"># check status</span>
</code></pre></div></div>

<p>When you deploy a new version, just <code class="language-plaintext highlighter-rouge">scp</code> the new jar over and <code class="language-plaintext highlighter-rouge">sudo systemctl restart my-app</code>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Once you have coded a Ring app,]]></summary></entry><entry><title type="html">clj.rs Clojure implemented on Rust</title><link href="https://clojure-diary.gitlab.io/2026/06/07/clj-rs-clojure-implemented-on-rust.html" rel="alternate" type="text/html" title="clj.rs Clojure implemented on Rust" /><published>2026-06-07T15:09:00+05:30</published><updated>2026-06-07T15:09:00+05:30</updated><id>https://clojure-diary.gitlab.io/2026/06/07/clj-rs-clojure-implemented-on-rust</id><content type="html" xml:base="https://clojure-diary.gitlab.io/2026/06/07/clj-rs-clojure-implemented-on-rust.html"><![CDATA[<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/WXTGL6v23Ew" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<p><strong>Notes</strong></p>

<ul>
  <li><a href="https://clj.rs/">clj.rs</a> could be a big thing
    <ul>
      <li><a href="https://clofer.codeberg.page/">Clofer</a>
collapsed:: true
        <ul>
          <li>Why it started
            <ul>
              <li>file -&gt; jar -&gt; output
                <ul>
                  <li>Lot’s of files
                    <ul>
                      <li><a href="https://www.gnu.org/software/parallel/">GNU Parallel</a></li>
                      <li><a href="https://www.graalvm.org/">GraalVM</a>
                        <ul>
                          <li>NOOOOOOOOO</li>
                          <li>Oracle</li>
                        </ul>
                      </li>
                    </ul>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
          <li><a href="https://github.com/clojure-rs/ClojureRS">clojurers</a></li>
          <li>I don’t know a lot
collapsed:: true
            <ul>
              <li><a href="https://kanipaan.codeberg.page/">Kanipaan</a></li>
            </ul>
          </li>
          <li><a href="https://www.reddit.com/r/Clojure/comments/1txohat/comment/opzal8j/?screen_view_count=2">Reddit comment</a></li>
        </ul>
      </li>
      <li>clj.rs
        <ul>
          <li>Gives me breathing space</li>
          <li>https://clj.rs</li>
          <li><a href="https://mstdn.social/@rsdio@me.dm">Casey Marshall</a>
            <ul>
              <li><img src="https://avatars.githubusercontent.com/u/39441?v=4" alt="" /></li>
              <li><img src="https://media.mstdn.social/cache/accounts/headers/110/040/885/465/558/228/original/7a6c6ed3545c61dc.jpeg" alt="" /></li>
            </ul>
          </li>
          <li>Freedom from Java / Oracle</li>
          <li>Actively Maintained!!
            <ul>
              <li>Will Clojure community will ensure active maintenance?</li>
            </ul>
          </li>
          <li><a href="https://jank-lang.org/">Jank</a>
            <ul>
              <li>Clojure on C++</li>
              <li>LLVM</li>
              <li>Pointers</li>
            </ul>
          </li>
          <li>The Garbage collection
            <ul>
              <li>In Ruby it was a big topic</li>
            </ul>
          </li>
          <li>Fast</li>
          <li>Huge set of libraries</li>
          <li>GPU!
            <ul>
              <li><a href="https://rust-gpu.github.io/">Rust GPU</a></li>
            </ul>
          </li>
          <li>No more JavaScript?
            <ul>
              <li>I hate JavaScript</li>
            </ul>
          </li>
          <li>Embedded Systems</li>
          <li>OS programming</li>
          <li>Data Science</li>
          <li>Clojure on <a href="https://zed.dev/">Zed</a> editor?
            <ul>
              <li><a href="https://jupyter.org/">Jpyter Lab</a></li>
              <li>VSCode is slow
                <ul>
                  <li>Take up resources</li>
                </ul>
              </li>
              <li>M$ - common who really trusts them?</li>
            </ul>
          </li>
          <li>Less nightmare for Rust dev’s
            <ul>
              <li>Imagine the productivity gain!!!!</li>
            </ul>
          </li>
          <li>Please rally behind this project</li>
          <li>No more Clofer, grow, and long live https://clj.rs/</li>
          <li>-ve’s
            <ul>
              <li>Claude is used
                <ul>
                  <li>A closed model</li>
                </ul>
              </li>
              <li>Only 1 person project</li>
              <li>Maybe the world does not know</li>
              <li>Underwhelming reaction</li>
            </ul>
          </li>
          <li>What I will do
            <ul>
              <li>Try to write some Clojure programs with clojurust</li>
              <li><img src="https://codeberg.org/rustforbeginners/design/raw/branch/main/Rust%20for%20beginners.png" alt="" />
                <ul>
                  <li>Learn Rust, make it learnable.</li>
                </ul>
              </li>
              <li>Watch https://clj.rs , report about it
                <ul>
                  <li>Contribute to it if I can (it’s a big if)</li>
                </ul>
              </li>
              <li>Update my <a href="https://clojure-book.gitlab.io/">Clojure Book</a>
                <ul>
                  <li><img src="https://clojure-book.gitlab.io/images/clojure-book-cover-2001-space-odyssey-10_small.png" alt="" /></li>
                </ul>
              </li>
              <li>Write a Lisp compiler in Rust, just for Hobby</li>
              <li>Contribute to <a href="https://scicloj.github.io/stats_with_clojure/">Stats With Clojure</a>
                <ul>
                  <li><img src="https://scicloj.github.io/stats_with_clojure/notebooks/images/stats_with_clojure.png" alt="" /></li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </li>
      <li>Clojure should keep moving
collapsed:: true
        <ul>
          <li>Rust is a great idea now</li>
          <li>Who knows what next?</li>
          <li>Clojure foundation
            <ul>
              <li>Official Clojure implementation on various runtimes</li>
              <li>Standard Clojure API</li>
              <li>Target many platforms
                <ul>
                  <li>Migrate / compile to many platforms</li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry></feed>