![Learning Functional Programming in Go](https://wfqqreader-1252317822.image.myqcloud.com/cover/487/36700487/b_36700487.jpg)
上QQ阅读APP看书,第一时间看更新
Programming CMOS with Unix pipes
Unix pipes can also be used to model the flow control of NAND gates of a CMOS device.
Assuming nil represents and electron then, /dev/zero (aka VSS) provides an infinite supply of electrons and /dev/null (aka VDD) will consume every electron sent to it.
![](https://epubservercos.yuewen.com/6176FA/19470400908922906/epubprivate/OEBPS/Images/Chapter_39.jpg?sign=1739545219-3MBirpKfscvYrWGLGsUeT9mk3NvmEOxK-0-5f492f344532640507f3aeaff2daf69c)
CMOS NAND gate
In our model, the UNIX pipe acts like a wire. When the pipe is connected to Vss, its buffer fills up with nil-bytes and the pipe acts like a negatively charged metal plate. When it is connected to Vdd, the pipe's buffer is drained, and the pipe acts like a positively charged metal plate. Unix pipes are used to model flow control in our NAND logic gate.
For more details, see http://www.linusakesson.net/programming/pipelogic/index.php.