Alchemist – A non-deterministic programming language based on chemical reactions
1–10 of 29 posts
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#2Re: Alchemist – A non-deterministic programming language based on chemical reactions
#3> Languages with significant operations (such as execution order) that are predominantly nondeterministic; the same answer cannot always be expected in the same circumstance.
What are the significant operations in this language that cannot always be expected to produce the same result?
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#4I don't understand the meaning of nondeterminism in this context. Definition of a nondeterministic language from the linked wiki: > Languages with significant operations (such as execution order) that are predominantly nondeterministic; the same answer cannot always be expected in the same circumstance. What are the significant operations in this language that cannot always be expected to produce the same result?
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#5 2H + O -> H2O
JoCaml would write def h() & h() & o() = h2o();;
One of the big differences is that JoCaml allows you to embed payloads inside your atoms, e.g. def a(x) & b(b) = c(if b then x else 0);;
will consume an a with an integer payload and a b with a boolean payload, and produce a c with an integer payload. It also lets you include computations as reactions happen, e.g. def a(x) = ( Printf.printf "Reacting!\n"; b(x + 1) );;
which lets you use this "chemical soup" model as the basis for concurrent programming.There is a very detailed tutorial (which appears to have sadly half-broken formatting) which explains JoCaml in more detail here: https://sites.google.com/site/winitzki/tutorial-on-join-calc...
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#6Alchemist looks fun, but only by looking over the Truth Machine page did I understand exactly what it is about.
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#7I don't understand the meaning of nondeterminism in this context. Definition of a nondeterministic language from the linked wiki: > Languages with significant operations (such as execution order) that are predominantly nondeterministic; the same answer cannot always be expected in the same circumstance. What are the significant operations in this language that cannot always be expected to produce the same result?
> "The program will continually pick rules at random from the set of applicable rules, until there are no such rules."
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#8 2H + O -> H2O
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.If we have the rule
Alice + Bob + 0Eve -> AliceBob
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.>>>
Oh man that is a disappointing definition, the fact that 2H + O can operate with 3H but 0H + O can't is extremely misleading and syntactically inconsistent. I am not certain how it'd be best to define a rule that predicates on an absence of a token but that syntax is terrible.
Also, assuming this language is meant to be chemistry minded I'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't considered equivalent to 2O
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#9If we have the rule 2H + O -> H2O 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. If we have the rule Alice + Bob + 0Eve -> AliceBob and the universe contains 1 atom of each Alice, Bob and Eve. Then that rule is not applicable because it requires the universe…
That would be pretty confusing. Instead, transitions can always be allowed to happen if the left hand side is satisfied and then the "don't transition if there's an Eve" semantics -- when necessary/desired -- can be made explicit by adding assertions to each nondeterministic transition.
For example, if you want 1 Adam and 1 Bob to transition to 1 AliceBob regardless of Eves then you write:
Alice + Bob -> AliceBob
but if you want to insist there are no Eves for this rule to hold, then you write: assert(0Eve);
Alice + Bob -> AliceBob
in which case there must be 0 Evens in order for the Alicebob transition to happen.These sorts of nondeterministic transitions with optional guards are expressible in dynamic logic; see see A3 + A8 in [0].
[0] https://en.wikipedia.org/wiki/Dynamic_logic_(modal_logic)
Re: Alchemist – A non-deterministic programming language based on chemical reactions
#10After poking around the site, I can't see any specific reference—which makes me suspect it was an independent discovery of a cool idea—but this is very similar to a deliberately-constrained version of the Join Calculus https://www.microsoft.com/en-us/research/wp-content/uploads/... which uses a similar chemical-ish model of computation. There's an implementation of the Join Calculus in an OCaml-like language called (…
I hadn't thought of the connection to the join calculus - that's pretty cool!