Skip to content

Instantly share code, notes, and snippets.

@oskarth
Created November 1, 2012 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oskarth/3995448 to your computer and use it in GitHub Desktop.
Save oskarth/3995448 to your computer and use it in GitHub Desktop.
chipper.long-form.gates
(defn nand* [a b]
(let [[out] (if (= 2 (+ a b)) [0] [1])
out))
(defn not* [in]
(let [[out] (nand* in in)]
out))
(defn and* [a b]
(let [[w] (nand* a b)
[out] (not* w)]
out))
(defn dmux* [in sel]
(let [[nsel] (not* sel)
[a] (and* in nsel)
[b] (and* in sel)
[out] [a b]]
out))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment