<story><title>Alchemist – A non-deterministic programming language based on chemical reactions</title><url>https://esolangs.org/wiki/Alchemist</url></story><parent_chain></parent_chain><comment><author>munk-a</author><text>If we have the rule&lt;p&gt;&lt;pre&gt;&lt;code&gt;    2H + O -&amp;gt; H2O
&lt;/code&gt;&lt;/pre&gt;
and the universe consists of 3 H and 2 O atoms, then the rule is applicable. After applying the rule our universe will contain 1 H2O, 1 H and 1 O atoms. At this point the rule would not be applicable anymore.&lt;p&gt;If we have the rule&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Alice + Bob + 0Eve -&amp;gt; AliceBob
&lt;/code&gt;&lt;/pre&gt;
and the universe contains 1 atom of each Alice, Bob and Eve. Then that rule is not applicable because it requires the universe to contain no atom of type Eve.&lt;p&gt;&amp;gt;&amp;gt;&amp;gt;&lt;p&gt;Oh man that is a disappointing definition, the fact that 2H + O can operate with 3H but 0H + O can&amp;#x27;t is extremely misleading and syntactically inconsistent.  I am not certain how it&amp;#x27;d be best to define a rule that predicates on an absence of a token but that syntax is terrible.&lt;p&gt;Also, assuming this language is meant to be chemistry minded I&amp;#x27;m sad that there is no support for the grouped sub-quantities that tend to be described... any chemist would probably be confused when O2 wasn&amp;#x27;t considered equivalent to 2O</text></comment>
<story><title>Alchemist – A non-deterministic programming language based on chemical reactions</title><url>https://esolangs.org/wiki/Alchemist</url></story><parent_chain></parent_chain><comment><author>andolanra</author><text>After poking around the site, I can&amp;#x27;t see any specific reference—which makes me suspect it was an independent discovery of a cool idea—but this is &lt;i&gt;very&lt;/i&gt; similar to a deliberately-constrained version of the Join Calculus &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.microsoft.com&amp;#x2F;en-us&amp;#x2F;research&amp;#x2F;wp-content&amp;#x2F;uploads&amp;#x2F;2017&amp;#x2F;01&amp;#x2F;join-tutorial.pdf&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.microsoft.com&amp;#x2F;en-us&amp;#x2F;research&amp;#x2F;wp-content&amp;#x2F;uploads&amp;#x2F;...&lt;/a&gt; which uses a similar chemical-ish model of computation. There&amp;#x27;s an implementation of the Join Calculus in an OCaml-like language called (of course) JoCaml. Where Alchemist would write&lt;p&gt;&lt;pre&gt;&lt;code&gt;    2H + O -&amp;gt; H2O
&lt;/code&gt;&lt;/pre&gt;
JoCaml would write&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def h() &amp;amp; h() &amp;amp; o() = h2o();;
&lt;/code&gt;&lt;/pre&gt;
One of the big differences is that JoCaml allows you to embed payloads inside your atoms, e.g.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def a(x) &amp;amp; b(b) = c(if b then x else 0);;
&lt;/code&gt;&lt;/pre&gt;
will consume an &lt;i&gt;a&lt;/i&gt; with an integer payload and a &lt;i&gt;b&lt;/i&gt; with a boolean payload, and produce a &lt;i&gt;c&lt;/i&gt; with an integer payload. It also lets you include computations as reactions happen, e.g.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    def a(x) = ( Printf.printf &amp;quot;Reacting!\n&amp;quot;; b(x + 1) );;
&lt;/code&gt;&lt;/pre&gt;
which lets you use this &amp;quot;chemical soup&amp;quot; model as the basis for concurrent programming.&lt;p&gt;There is a very detailed tutorial (which appears to have sadly half-broken formatting) which explains JoCaml in more detail here: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;sites.google.com&amp;#x2F;site&amp;#x2F;winitzki&amp;#x2F;tutorial-on-join-calculus-and-its-implementation-in-ocaml-jocaml&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;sites.google.com&amp;#x2F;site&amp;#x2F;winitzki&amp;#x2F;tutorial-on-join-calc...&lt;/a&gt;</text></comment>