AM Posted June 4, 2018 Share Posted June 4, 2018 complementation to OR/AND/NOT! i hope everything is correct... https://de.wikipedia.org/wiki/Logikgatter (defun nand (&rest rest) (flet ((every-truep (x) (equal x t))) (not (every #'every-truep rest)))) (nand nil nil nil) => t (nand t t t t t t) => nil (nand nil t t t nil t) => t ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun nor (&rest rest) (contain-itemp 'nil rest)) (nor t t t t) => nil (nor nil t nil) => t (nor t nil nil nil) => t ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun xor (&rest rest) (oddp (car (count-item t rest)))) (xor t nil t t nil nil nil) => t (xor t t nil) => nil (xor nil t) => t ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun xnor (&rest rest) (evenp (car (count-item t rest)))) (xnor t nil t t nil nil nil) => nil (xnor t t nil) => t (xnor nil t) => nil (xnor t nil t t nil nil t nil) => t ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; loopyc 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.