This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A fun little experiment making boolean circuits with channels | |
// It's pretty slow (especially with GOMAXPROCS > 1), but neat | |
// Originally, I had made all the gates structs with methods, etc, | |
// but they can all be done as functions thanks to closures/gc. | |
package circ | |
func NAND(in1, in2 <-chan bool) <-chan bool { | |
out := make(chan bool) | |
go func() { | |
for { |