bidicalc: a bidirectional calculator

56 points by victorpoughon


jackdk

You might be interested in an abstraction called "propagators". They're like hypergraphs where the nodes are bounded join semilattices holding information, and the edges are monotone functions from the input nodes to an output node. If you're careful you can make e.g. your arithmetic operations build propagator networks so you have a shot at running computations "backwards" and deriving "inputs" from "outputs".

halosghost

For some useful prior art in this space, see relational language( familie)s like miniKanren.

“Hello, declarative world,” by Tom Stuart is a pretty useful introduction, and includes a reasonably-complete implementation of microKanren.

All the best,

-HG

jcspencer

Excel has Goal Seek and Solver which work similarly, with a variable recalculation iteration limit.

I remember using Excel in university to design a glow stick factory, where the goal was to recycle unused reactants to maximise efficiency - you could route the “byproduct” cells back into the “input” cells and recursively calculate the maximal output!

Was my first introduction to “constraint” programming (later got introduced to MiniZinc) and never looked back :)