Skip to content

Commit 9793622

Browse files
author
Quarto GHA Workflow Runner
committed
Built site for gh-pages
1 parent 4161fdd commit 9793622

24 files changed

Lines changed: 570 additions & 552 deletions

.nojekyll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ec6a2e56
1+
c71fea8b

civitas/repl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ <h2 class="anchored" data-anchor-id="wrapping-up">Wrapping Up</h2>
576576
<p><strong>Ready to contribute?</strong> Add your own namespace under <code>src/</code> and it becomes a new post automatically.</p>
577577
<p><strong>Join the conversation:</strong> The best place to discuss this feature, share improvements, or ask questions is the <a href="https://clojurians.zulipchat.com/#narrow/channel/422115-clay-dev">Zulip: clay-dev channel</a></p>
578578
<p>Give it a try and let us know what you think! 🚀</p>
579-
<script type="application/x-scittle">(require (quote [reagent.core :as r]))</script><div id="id3"><script type="application/x-scittle">(reagent.dom/render [(fn [] (let [output-ref (atom nil) editor-ref (atom nil) show-editor? (r/atom true) layout (r/atom :right) repl-output (r/atom []) scroll-to-bottom! (fn* [] (when (clojure.core/deref output-ref) (js/setTimeout (fn [] (set! (.-scrollTop (clojure.core/deref output-ref)) (.-scrollHeight (clojure.core/deref output-ref)))) 10))) eval-code! (fn [code] (let [captured-output (atom []) result (binding [*print-fn* (fn* [p1__35842#] (swap! captured-output conj p1__35842#)) *print-err-fn* (fn* [p1__35843#] (swap! captured-output conj (str "ERR: " p1__35843#)))] (try (pr-str (js/scittle.core.eval_string code)) (catch :default e (str "Error: " (.-message e))))) output-str (when (seq (clojure.core/deref captured-output)) (clojure.string/join "" (clojure.core/deref captured-output)))] (swap! repl-output into (cond-> [(str "> " code)] output-str (conj output-str) :always (conj result))) (scroll-to-bottom!)))] (.addEventListener js/document "click" (fn [e] (when (clojure.core/deref editor-ref) (when-let [code-container (.. e -target (closest ".sourceCode"))] (when-let [code-element (.querySelector code-container "code")] (let [code-text (.-textContent code-element)] (set! (.-value (clojure.core/deref editor-ref)) code-text) (.focus (clojure.core/deref editor-ref)))))))) (fn [] (let [collapsed? (not (clojure.core/deref show-editor?)) is-bottom? (= (clojure.core/deref layout) :bottom) toggle! (fn* [] (swap! show-editor? not)) switch-layout! (fn* [] (reset! layout (if (= (clojure.core/deref layout) :right) :bottom :right))) collapsed-size "40px" full-size "350px"] [:<> [:div#scittle-sidebar.card.shadow-sm {:style (merge {:position "fixed", :z-index "1200", :display "flex", :flex-direction "column"} (if is-bottom? {:left "0", :right "0", :bottom "0", :height (if collapsed? collapsed-size full-size)} {:top "0", :right "0", :width (if collapsed? collapsed-size full-size), :height "100vh", :padding-top "77px"}))} (when (not collapsed?) [:div.d-flex.justify-content-between.align-items-center {:style {:flex "0 0 auto", :order "0"}} [:div.btn-group [:button.btn.btn-outline-primary.btn-sm {:on-click toggle!} (if is-bottom? [:i.bi.bi-chevron-bar-down] [:i.bi.bi-chevron-bar-right]) " Hide"] [:button.btn.btn-outline-secondary.btn-sm {:on-click switch-layout!} " Switch Layout"]] [:small.text-muted "Ctrl+Enter to eval"]]) (when collapsed? [:button.btn.btn-outline-primary.w-100.h-100 {:on-click toggle!} (if is-bottom? [:i.bi.bi-chevron-bar-up] [:i.bi.bi-chevron-bar-left])]) (when (not collapsed?) [:div.card-body.p-0 {:style {:flex "1 1 auto", :order "1", :display "flex", :flex-direction (if is-bottom? "row" "column")}} [:div.position-relative {:style {:flex "1 1 0", :overflow "hidden"}} [:textarea.form-control.border-0 {:ref (fn* [p1__35844#] (reset! editor-ref p1__35844#)), :on-key-down (fn [e] (when (and (.-ctrlKey e) (= (.-key e) "Enter")) (eval-code! (.. e -target -value)))), :placeholder "Type Clojure code here...\nCtrl+Enter to evaluate\nClick copy buttons in code blocks to paste here", :style {:resize "none", :width "100%", :height "100%", :box-sizing "border-box", :font-family "var(--bs-font-monospace)", :font-size "0.875rem", :border-radius "0", :overflow-y "auto"}}]] [:div.position-relative {:style {:flex "1 1 0", :overflow "hidden"}} [:div.position-absolute.top-0.end-0.badge.bg-secondary.m-2 {:style {:font-size "0.65rem", :z-index "10"}} "Output"] [:div#repl-output.sourceCode.border-start {:ref (fn* [p1__35845#] (reset! output-ref p1__35845#)), :class (if is-bottom? "border-start" "border-top"), :style {:height "100%", :padding "0.75rem", :overflow-y "auto", :font-family "var(--bs-font-monospace)", :font-size "0.8125rem", :line-height "1.4"}} (for [[i output] (map-indexed vector (clojure.core/deref repl-output))] [:div.mb-1 {:key i} output])]]]) [:style (str (when (clojure.core/deref show-editor?) (if is-bottom? (str ".content { margin-bottom: " full-size " !important; }") (str ".content { margin-right: " full-size " !important; }"))))]]]))))] (js/document.getElementById "id3"))</script></div>
579+
<script type="application/x-scittle">(require (quote [reagent.core :as r]))</script><div id="id3"><script type="application/x-scittle">(reagent.dom/render [(fn [] (let [output-ref (atom nil) editor-ref (atom nil) show-editor? (r/atom true) layout (r/atom :right) repl-output (r/atom []) scroll-to-bottom! (fn* [] (when (clojure.core/deref output-ref) (js/setTimeout (fn [] (set! (.-scrollTop (clojure.core/deref output-ref)) (.-scrollHeight (clojure.core/deref output-ref)))) 10))) eval-code! (fn [code] (let [captured-output (atom []) result (binding [*print-fn* (fn* [p1__36073#] (swap! captured-output conj p1__36073#)) *print-err-fn* (fn* [p1__36074#] (swap! captured-output conj (str "ERR: " p1__36074#)))] (try (pr-str (js/scittle.core.eval_string code)) (catch :default e (str "Error: " (.-message e))))) output-str (when (seq (clojure.core/deref captured-output)) (clojure.string/join "" (clojure.core/deref captured-output)))] (swap! repl-output into (cond-> [(str "> " code)] output-str (conj output-str) :always (conj result))) (scroll-to-bottom!)))] (.addEventListener js/document "click" (fn [e] (when (clojure.core/deref editor-ref) (when-let [code-container (.. e -target (closest ".sourceCode"))] (when-let [code-element (.querySelector code-container "code")] (let [code-text (.-textContent code-element)] (set! (.-value (clojure.core/deref editor-ref)) code-text) (.focus (clojure.core/deref editor-ref)))))))) (fn [] (let [collapsed? (not (clojure.core/deref show-editor?)) is-bottom? (= (clojure.core/deref layout) :bottom) toggle! (fn* [] (swap! show-editor? not)) switch-layout! (fn* [] (reset! layout (if (= (clojure.core/deref layout) :right) :bottom :right))) collapsed-size "40px" full-size "350px"] [:<> [:div#scittle-sidebar.card.shadow-sm {:style (merge {:position "fixed", :z-index "1200", :display "flex", :flex-direction "column"} (if is-bottom? {:left "0", :right "0", :bottom "0", :height (if collapsed? collapsed-size full-size)} {:top "0", :right "0", :width (if collapsed? collapsed-size full-size), :height "100vh", :padding-top "77px"}))} (when (not collapsed?) [:div.d-flex.justify-content-between.align-items-center {:style {:flex "0 0 auto", :order "0"}} [:div.btn-group [:button.btn.btn-outline-primary.btn-sm {:on-click toggle!} (if is-bottom? [:i.bi.bi-chevron-bar-down] [:i.bi.bi-chevron-bar-right]) " Hide"] [:button.btn.btn-outline-secondary.btn-sm {:on-click switch-layout!} " Switch Layout"]] [:small.text-muted "Ctrl+Enter to eval"]]) (when collapsed? [:button.btn.btn-outline-primary.w-100.h-100 {:on-click toggle!} (if is-bottom? [:i.bi.bi-chevron-bar-up] [:i.bi.bi-chevron-bar-left])]) (when (not collapsed?) [:div.card-body.p-0 {:style {:flex "1 1 auto", :order "1", :display "flex", :flex-direction (if is-bottom? "row" "column")}} [:div.position-relative {:style {:flex "1 1 0", :overflow "hidden"}} [:textarea.form-control.border-0 {:ref (fn* [p1__36075#] (reset! editor-ref p1__36075#)), :on-key-down (fn [e] (when (and (.-ctrlKey e) (= (.-key e) "Enter")) (eval-code! (.. e -target -value)))), :placeholder "Type Clojure code here...\nCtrl+Enter to evaluate\nClick copy buttons in code blocks to paste here", :style {:resize "none", :width "100%", :height "100%", :box-sizing "border-box", :font-family "var(--bs-font-monospace)", :font-size "0.875rem", :border-radius "0", :overflow-y "auto"}}]] [:div.position-relative {:style {:flex "1 1 0", :overflow "hidden"}} [:div.position-absolute.top-0.end-0.badge.bg-secondary.m-2 {:style {:font-size "0.65rem", :z-index "10"}} "Output"] [:div#repl-output.sourceCode.border-start {:ref (fn* [p1__36076#] (reset! output-ref p1__36076#)), :class (if is-bottom? "border-start" "border-top"), :style {:height "100%", :padding "0.75rem", :overflow-y "auto", :font-family "var(--bs-font-monospace)", :font-size "0.8125rem", :line-height "1.4"}} (for [[i output] (map-indexed vector (clojure.core/deref repl-output))] [:div.mb-1 {:key i} output])]]]) [:style (str (when (clojure.core/deref show-editor?) (if is-bottom? (str ".content { margin-bottom: " full-size " !important; }") (str ".content { margin-right: " full-size " !important; }"))))]]]))))] (js/document.getElementById "id3"))</script></div>
580580
<div style="background-color:grey;height:2px;width:100%;"></div>
581581
<div><pre><small><small>source: <a href="https://github.com/ClojureCivitas/clojurecivitas.github.io/blob/main/src/civitas/repl.clj">src/civitas/repl.clj</a></small></small></pre></div>
582582

civitas/why/i_should_write_more.html

Lines changed: 13 additions & 18 deletions
Large diffs are not rendered by default.

clojure+/print/objects_and_protocols.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ <h1 class="title">Printing Objects and Protocols in Clojure</h1>
456456
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> (.getName))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
457457
</div>
458458
<div class="printedClojure">
459-
<div class="sourceCode" id="cb15"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure_PLUS_.print.objects_and_protocols$eval72372$_PERCENT__PERCENT___72373$_PERCENT__PERCENT__PERCENT___72374"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
459+
<div class="sourceCode" id="cb15"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure_PLUS_.print.objects_and_protocols$eval72602$_PERCENT__PERCENT___72603$_PERCENT__PERCENT__PERCENT___72604"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
460460
</div>
461461
<p>Whoa, that’s pretty gross. We’d prefer to demunge the names at least.</p>
462462
<div class="sourceClojure">
@@ -469,7 +469,7 @@ <h1 class="title">Printing Objects and Protocols in Clojure</h1>
469469
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a> (class-name))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
470470
</div>
471471
<div class="printedClojure">
472-
<div class="sourceCode" id="cb18"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure+.print.objects-and-protocols/eval72379/%%--72380/%%%--72381"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
472+
<div class="sourceCode" id="cb18"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure+.print.objects-and-protocols/eval72609/%%--72610/%%%--72611"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
473473
</div>
474474
<p>Notice the <code>/evalNNNNN/</code> part? To create a function, Clojure creates a new class. The <code>/evalNNNNN/</code> counts every time it evaluates. This is useful in the sense that it identifies the class for that evaluation. But we almost never care for that detail (more on that later). For the same reason our strangely named functions have <code>--NNNNN</code> appended to them, because they are sub evaluations of the top-level evaluation.</p>
475475
<p>Let’s do away with that noise for the moment:</p>

clojure/print_object/remove_extraneous.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ <h1 class="title">Clean object printing by removing extraneous</h1>
458458
<div class="printedClojure">
459459
<div class="sourceCode" id="cb13"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>[[clojure.lang.Numbers add <span class="st">"Numbers.java"</span> <span class="dv">155</span>]</span>
460460
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> [clojure.lang.Numbers add <span class="st">"Numbers.java"</span> <span class="dv">3747</span>]</span>
461-
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> [clojure.print_object.remove_extraneous$caesar_cipher$add2__72652 invoke <span class="st">"NO_SOURCE_FILE"</span> <span class="dv">50</span>]</span>
461+
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> [clojure.print_object.remove_extraneous$caesar_cipher$add2__72882 invoke <span class="st">"NO_SOURCE_FILE"</span> <span class="dv">50</span>]</span>
462462
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> [clojure.core$mapv$fn__8569 invoke <span class="st">"core.clj"</span> <span class="dv">7059</span>]]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
463463
</div>
464464
<p>See that part <code>caesar_cipher$add2</code>? That is <strong>very</strong> useful information. It tells us that the exception was inside <code>add2</code>, which is inside <code>caesar-cipher</code>. The stack trace doesn’t print functions as objects, but it illustrates that the thing that we care about is that they are a function, what their name is, and whether they were created from inside another function.</p>
@@ -472,7 +472,7 @@ <h1 class="title">Clean object printing by removing extraneous</h1>
472472
<div class="sourceCode" id="cb15"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>(class-name ((<span class="kw">fn</span> [] (<span class="kw">fn</span> [y] y))))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
473473
</div>
474474
<div class="printedClojure">
475-
<div class="sourceCode" id="cb16"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure.print-object.remove-extraneous/eval72658/fn--72659/fn--72660"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
475+
<div class="sourceCode" id="cb16"><pre class="sourceCode clojure code-with-copy"><code class="sourceCode clojure"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="st">"clojure.print-object.remove-extraneous/eval72888/fn--72889/fn--72890"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
476476
</div>
477477
<p>Next, we don’t need the eval identities.</p>
478478
<div class="sourceClojure">

clojure/transducers/what_if.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ <h1 class="title">What if… we were taught transducers first?</h1>
491491
<div class="callout-body-container callout-body">
492492
<pre><code> clojure.core/eval core.clj: 3232
493493
...
494-
clojure.transducers.what-if/eval72743 REPL Input:
494+
clojure.transducers.what-if/eval72973 REPL Input:
495495
clojure.core/transduce core.clj: 7025
496496
...
497497
clojure.core/map/fn{x2} core.clj: 2759
@@ -513,19 +513,19 @@ <h1 class="title">What if… we were taught transducers first?</h1>
513513
<i class="callout-icon"></i>
514514
</div>
515515
<div class="callout-title-container flex-fill">
516-
Wrong number of args (1) passed to: clojure.transducers.what-if/eval72745/fn–72746
516+
Wrong number of args (1) passed to: clojure.transducers.what-if/eval72975/fn–72976
517517
</div>
518518
<div class="callout-btn-toggle d-inline-block border-0 py-1 ps-1 pe-0 float-end"><i class="callout-toggle"></i></div>
519519
</div>
520520
<div id="callout-2" class="callout-2-contents callout-collapse collapse">
521521
<div class="callout-body-container callout-body">
522522
<pre><code> clojure.core/eval core.clj: 3232
523523
...
524-
clojure.transducers.what-if/eval72745 REPL Input:
524+
clojure.transducers.what-if/eval72975 REPL Input:
525525
clojure.core/transduce core.clj: 7027
526526
clojure.core/map/fn{x2} core.clj: 2757
527527
...
528-
clojure.lang.ArityException: Wrong number of args (1) passed to: clojure.transducers.what-if/eval72745/fn--72746
528+
clojure.lang.ArityException: Wrong number of args (1) passed to: clojure.transducers.what-if/eval72975/fn--72976
529529

530530
</code></pre>
531531
</div>

0 commit comments

Comments
 (0)