Add nor and nand operators
This commit is contained in:
parent
51f99a87ab
commit
5a0371ae15
@ -128,12 +128,14 @@ line."))
|
||||
'((open-paren "(")
|
||||
(close-paren ")")
|
||||
(and "/\\" "and" "&&" "&" "∧" ".")
|
||||
(nand "nand" "↑" "⊼")
|
||||
(or "\\/" "or" "||" "|" "∥" "+" "∨")
|
||||
(nor "nor" "↓" "⊽")
|
||||
(xor "xor" "⊕" "⊻" "↮" "≢" "^" "!=")
|
||||
(not "¬" "~" "!" "not")
|
||||
(implies "->" ">" "=>" "⇒" "⟹" "→" "⊃" "implies")
|
||||
(converse "<-" "<" "<=" "←" "⇐" "⟸" "⊂" "converse")
|
||||
(iff "<->" "<>" "<=>" "⇔" "↔" "≡" "iff" "=" "=="))
|
||||
(iff "<->" "<>" "<=>" "⇔" "↔" "≡" "iff" "=" "==" "xnor" "⊙"))
|
||||
"Alist table of operator symbols and their possible string representations.")
|
||||
|
||||
(defun operator-symbol (oper-str)
|
||||
@ -147,8 +149,10 @@ line."))
|
||||
(case oper
|
||||
(not 1)
|
||||
(and 2)
|
||||
(nand 2)
|
||||
(xor 3)
|
||||
(or 4)
|
||||
(nor 4)
|
||||
(implies 5)
|
||||
(converse 5)
|
||||
(iff 6)
|
||||
@ -166,6 +170,8 @@ and the maximum number (or nil for infinity) as a second value."
|
||||
(implies (values 2 2))
|
||||
(converse (values 2 2))
|
||||
(iff (values 2 2))
|
||||
(nand (values 2 nil))
|
||||
(nor (values 2 2))
|
||||
(t (error "unknown operator: ~S" oper))))
|
||||
|
||||
(defun interpret-operand (oper-str)
|
||||
@ -398,7 +404,9 @@ found variables."
|
||||
|
||||
(defconstant operator-ascii-lookup-alist
|
||||
'((and . "&")
|
||||
(nand . "nand")
|
||||
(or . "|")
|
||||
(nor . "nor")
|
||||
(xor . "^")
|
||||
(not . "~")
|
||||
(implies . "->")
|
||||
@ -412,7 +420,9 @@ found variables."
|
||||
|
||||
(defconstant operator-unicode-lookup-alist
|
||||
'((and . "∧")
|
||||
(nand . "⊼")
|
||||
(or . "∨")
|
||||
(nor . "⊽")
|
||||
(xor . "⊕")
|
||||
(not . "¬")
|
||||
(implies . "→")
|
||||
@ -426,7 +436,9 @@ found variables."
|
||||
|
||||
(defconstant operator-latex-lookup-alist
|
||||
'((and . "\\land")
|
||||
(nand . "\\uparrow")
|
||||
(or . "\\lor")
|
||||
(nor . "\\downarrow")
|
||||
(xor . "\\oplus")
|
||||
(not . "\\lnot ")
|
||||
(implies . "\\to")
|
||||
@ -589,8 +601,12 @@ NOTE: the second value does not include individual variables, literal values
|
||||
;; using `eval'
|
||||
(and
|
||||
(apply 'logical-and arg-values))
|
||||
(nand
|
||||
(not (apply 'logical-and arg-values)))
|
||||
(or
|
||||
(apply 'logical-or arg-values))
|
||||
(nor
|
||||
(not (apply 'logical-or arg-values)))
|
||||
(xor
|
||||
(apply 'logical-xor arg-values))
|
||||
(not
|
||||
|
Loading…
Reference in New Issue
Block a user