You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clojure+/print/objects_and_protocols.html
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -456,7 +456,7 @@ <h1 class="title">Printing Objects and Protocols in Clojure</h1>
456
456
<spanid="cb14-3"><ahref="#cb14-3" aria-hidden="true" tabindex="-1"></a> (.getName))</span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
457
457
</div>
458
458
<divclass="printedClojure">
459
-
<divclass="sourceCode" id="cb15"><preclass="sourceCode clojure code-with-copy"><codeclass="sourceCode clojure"><spanid="cb15-1"><ahref="#cb15-1" aria-hidden="true" tabindex="-1"></a><spanclass="st">"clojure_PLUS_.print.objects_and_protocols$eval73196$_PERCENT__PERCENT___73197$_PERCENT__PERCENT__PERCENT___73198"</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
459
+
<divclass="sourceCode" id="cb15"><preclass="sourceCode clojure code-with-copy"><codeclass="sourceCode clojure"><spanid="cb15-1"><ahref="#cb15-1" aria-hidden="true" tabindex="-1"></a><spanclass="st">"clojure_PLUS_.print.objects_and_protocols$eval73226$_PERCENT__PERCENT___73227$_PERCENT__PERCENT__PERCENT___73228"</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
460
460
</div>
461
461
<p>Whoa, that’s pretty gross. We’d prefer to demunge the names at least.</p>
462
462
<divclass="sourceClojure">
@@ -469,7 +469,7 @@ <h1 class="title">Printing Objects and Protocols in Clojure</h1>
469
469
<spanid="cb17-2"><ahref="#cb17-2" aria-hidden="true" tabindex="-1"></a> (class-name))</span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
470
470
</div>
471
471
<divclass="printedClojure">
472
-
<divclass="sourceCode" id="cb18"><preclass="sourceCode clojure code-with-copy"><codeclass="sourceCode clojure"><spanid="cb18-1"><ahref="#cb18-1" aria-hidden="true" tabindex="-1"></a><spanclass="st">"clojure+.print.objects-and-protocols/eval73203/%%--73204/%%%--73205"</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
472
+
<divclass="sourceCode" id="cb18"><preclass="sourceCode clojure code-with-copy"><codeclass="sourceCode clojure"><spanid="cb18-1"><ahref="#cb18-1" aria-hidden="true" tabindex="-1"></a><spanclass="st">"clojure+.print.objects-and-protocols/eval73233/%%--73234/%%%--73235"</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
473
473
</div>
474
474
<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>
475
475
<p>Let’s do away with that noise for the moment:</p>
<spanid="cb13-4"><ahref="#cb13-4" aria-hidden="true" tabindex="-1"></a> [clojure.core$mapv$fn__8569 invoke <spanclass="st">"core.clj"</span><spanclass="dv">7059</span>]]</span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
463
463
</div>
464
464
<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>
class code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_SINGLEQUOTE_\)</span>fn__73367 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_SINGLEQUOTE_\)</span>fn__73367 is in unnamed module of loader clojure.lang.DynamicClassLoader <spanclass="citation" data-cites="2fc3417e">@2fc3417e</span>; clojure.lang.IPersistentCollection is in unnamed module of loader ‘app’)
514
+
class code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_SINGLEQUOTE_\)</span>fn__73398 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_SINGLEQUOTE_\)</span>fn__73398 is in unnamed module of loader clojure.lang.DynamicClassLoader <spanclass="citation" data-cites="57d37eac">@57d37eac</span>; clojure.lang.IPersistentCollection is in unnamed module of loader ‘app’)
java.lang.ClassCastException: class code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_SINGLEQUOTE_$fn__73367 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_SINGLEQUOTE_$fn__73367 is in unnamed module of loader clojure.lang.DynamicClassLoader @2fc3417e; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')
525
+
java.lang.ClassCastException: class code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_SINGLEQUOTE_$fn__73398 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_SINGLEQUOTE_$fn__73398 is in unnamed module of loader clojure.lang.DynamicClassLoader @57d37eac; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')
class code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_LOGIC\)</span>fn__73377 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_LOGIC\)</span>fn__73377 is in unnamed module of loader clojure.lang.DynamicClassLoader <spanclass="citation" data-cites="5b2cba5f">@5b2cba5f</span>; clojure.lang.IPersistentCollection is in unnamed module of loader ‘app’)
611
+
class code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_LOGIC\)</span>fn__73408 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit<spanclass="math inline">\(REV_LOGIC\)</span>fn__73408 is in unnamed module of loader clojure.lang.DynamicClassLoader <spanclass="citation" data-cites="39cc52b5">@39cc52b5</span>; clojure.lang.IPersistentCollection is in unnamed module of loader ‘app’)
java.lang.ClassCastException: class code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_LOGIC$fn__73377 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_LOGIC$fn__73377 is in unnamed module of loader clojure.lang.DynamicClassLoader @5b2cba5f; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')
622
+
java.lang.ClassCastException: class code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_LOGIC$fn__73408 cannot be cast to class clojure.lang.IPersistentCollection (code_interview.beating.with_stupid_stuff.z_combinator_gambit$REV_LOGIC$fn__73408 is in unnamed module of loader clojure.lang.DynamicClassLoader @39cc52b5; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')
0 commit comments