X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment1.mdwn;h=cc535c2bc24edca5bb2b46f0e152f2a0dce3956b;hp=2b6b300be06e999474abca1fcee80b8693061bf6;hb=96bd066e0d1adcd0cacb08a55b6aa6c20541952a;hpb=0af7aed995f388d7c152140dc8f2ea0248f3d99c diff --git a/assignment1.mdwn b/assignment1.mdwn index 2b6b300b..cc535c2b 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -26,7 +26,8 @@ In Racket, these can be defined like this: (define true (lambda (t) (lambda (f) t))) (define false (lambda (t) (lambda (f) f))) -* [8] Define a "neg" operator that negates "true" and "false". + 8. Define a "neg" operator that negates "true" and "false". + Expected behavior: (((neg true) 10) 20) @@ -37,19 +38,23 @@ evaluates to 20, and evaluates to 10. -* [9] Define an "and" operator. + 9. Define an "and" operator. + + 10. Define an "xor" operator. -* [10] Define an "xor" operator. (If you haven't seen this term before, here's a truth table: +(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: