<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged knuth</title>
<link>https://ask.clojure.org/index.php/tag/knuth</link>
<description></description>
<item>
<title>is It possible to implement a label/goto mechanism in clojure</title>
<link>https://ask.clojure.org/index.php/10547/is-it-possible-to-implement-label-goto-mechanism-in-clojure</link>
<description>&lt;p&gt;Apparently the JVM has a &lt;code&gt;label/goto&lt;/code&gt; mechanism.  Would it be possible to add such a capability to the Clojure language?&lt;/p&gt;
&lt;p&gt;I suppose there are two questions which could be addressed 100% independently. &lt;br&gt;
1. whether it is theoretically possible.  i.e., to the JVM instructions really permit such a Clojure primitive at all.  Perhaps I'm mistaken, and it is really not possible.&lt;br&gt;
2. whether the core Clojure maintainers can be convinced of the merits of the request.&lt;/p&gt;
&lt;p&gt;In general &lt;code&gt;goto&lt;/code&gt; is useful in machine generated code, not so much in human written code.&lt;/p&gt;
&lt;p&gt;I have at least three use cases where I'd like to have such a mechanism.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;serialization of deterministic finite automata&lt;/li&gt;
&lt;li&gt;serialization of discrimination nets&lt;/li&gt;
&lt;li&gt;translation of Knuth style algorithms into Clojure from Art of Computer Programming.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I know that lots of people might respond with philosophical arguments about why you shouldn't use goto.   I hope to avoid such a discussion here.&lt;/p&gt;
&lt;p&gt;One possibility which seems reasonable to me would be a Clojure primitive similar to the  &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.lispworks.com/documentation/HyperSpec/Body/m_prog_.htm&quot;&gt;Common Lisp prog&lt;/a&gt; although the ability to bind variables is not really necessary, as it could easily be implemented by the user by using &lt;code&gt;let&lt;/code&gt; with some macrology.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10547/is-it-possible-to-implement-label-goto-mechanism-in-clojure</guid>
<pubDate>Fri, 30 Apr 2021 08:49:38 +0000</pubDate>
</item>
</channel>
</rss>