-**Reduction**
+Reduction
+---------
Find "normal forms" for the following (that is, reduce them as far as it's possible to reduce
them):
7. (\x (x x x)) (\x (x x x))
-**Booleans**
+Booleans
+--------
Recall our definitions of true and false.
(define true (lambda (t) (lambda (f) t)))
(define false (lambda (t) (lambda (f) f)))
-(8). Define a "neg" operator that negates "true" and "false".
-Expected behavior: (((neg true) 10) 20) evaluates to 20,
-(((neg false) 10) 20) evaluates to 10.
+ 8. Define a "neg" operator that negates "true" and "false".
-(9). Define an "and" operator.
+Expected behavior:
-10. Define an "xor" operator. (If you haven't seen this term before, here's a truth table:
+ (((neg true) 10) 20)
+
+evaluates to 20, and
+
+ (((neg false) 10) 20)
+
+evaluates to 10.
+
+ 9. Define an "and" operator.
+
+ 10. Define an "xor" operator.
+
+(If you haven't seen this term before, here's a truth table:
+
+ true xor true = false
+ true xor false = true
+ false xor true = true
+ false xor false = false
- true xor true = false
- true xor false = true
- false xor true = true
- false xor false = false
)
-11. Inspired by our definition of boolean values, propose a data structure
-capable of representing one of the two values "black" or "white". If we have
+ 11. Inspired by our definition of boolean values, propose a data structure
+ capable of representing one of the two values "black" or "white".
+
+If we have
one of those values, call it a black-or-white-value, we should be able to
write: