For a comprehensive overview of computation on a foundational level, see Feynman's lectures on computation:<p><a href="https://theswissbay.ch/pdf/Gentoomen%20Library/Extra/Richard_P._Feynman-Feynman_Lectures_on_Computation__-Addison-Wesley%281996%29.pdf" rel="nofollow">https://theswissbay.ch/pdf/Gentoomen%20Library/Extra/Richard...</a><p>I've been implementing the flip flop gates using SICP wires:<p><a href="https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-22.html#%_sec_3.3.4" rel="nofollow">https://mitpress.mit.edu/sites/default/files/sicp/full-text/...</a><p>It was neat seeing the concept of "feedback" (logic gate output gets fed in as an input) then seeing it actually work in the SICP simulator. It immediately went into an infinite loop, but that's correct behavior. The solution was to add a clock line (a wire which goes 0 to 1 and back to 0 over a specific time interval), then update the simulation until the clock line changes. Presto, I had my own flip flops.<p>Ended up implementing some shift registers (thanks to Feynman). Lots of fun, and it clarifies the concept of a "cycle" -- I found it really hard to understand what a "cycle" actually meant till implementing the gates.<p>The reversible computation is cool: NOT, Controlled NOT (CN), and Controlled Controlled NOT (CCN) gives you everything you need to make a reversible universal computer.<p>It turns out that reversible computation is far more energy efficient than normal computation. You can understand with an analogy. Think of a pool table. Imagine the cue ball hitting the 8 ball. When the cue ball is in motion (and ignoring friction), then <i>no energy</i> needs to be spent -- it's already in motion, so you don't need to do anything to cause the situation to "keep going". It just keeps going on its own.<p>When the cue ball hits the 8 ball, part of that energy is transferred. In the ideal case, the cue ball stops moving and the 8 ball starts at the same speed.<p>By arranging pool balls in specific ways, you can mimic an AND gate and an OR gate. The outputs are the directions that the balls end up going. And the truth table for AND and OR is simple, so you just need to represent the truth table using "directions" instead of volts.<p>If you have two inputs, you'll want two outputs, because otherwise you need to <i>stop a ball entirely</i> (energy is lost) which is very costly in comparison. The best outcome is for the second ball to carry along the energy of the second input, even though you don't directly need the answer just to represent AND or OR gates.<p>The result is that you can run the simulation, and then reverse the entire thing to get back your original inputs. :)