Logical operations: Difference between revisions

Content added Content deleted
m (→‎{{header|Common Lisp}}: remove XOR and add note about availability in CLISP)
Line 980: Line 980:
(mapcar (lambda (op)
(mapcar (lambda (op)
(format t "~a ~a ~a is ~a~%" a op b (eval (list op a b))))
(format t "~a ~a ~a is ~a~%" a op b (eval (list op a b))))
'(and or xor)))
'(and or)))


(loop for a in '(nil t) do
(loop for a in '(nil t) do
Line 991: Line 991:
NIL AND NIL is NIL
NIL AND NIL is NIL
NIL OR NIL is NIL
NIL OR NIL is NIL
NIL XOR NIL is NIL


NIL AND T is NIL
NIL AND T is NIL
NIL OR T is T
NIL OR T is T
NIL XOR T is T


NOT T is NIL
NOT T is NIL
T AND NIL is NIL
T AND NIL is NIL
T OR NIL is T
T OR NIL is T
T XOR NIL is T


T AND T is T
T AND T is T
T OR T is T
T OR T is T</pre>

T XOR T is NIL</pre>
CLISP has <tt>xor</tt>, which can be added to the list of ops in <tt>demo-logic</tt> if using that implementation, but it's not part of the standard.


=={{header|D}}==
=={{header|D}}==