diff --git a/I - Fixed-Size Data/Exercise_120.rkt b/I - Fixed-Size Data/Exercise_120.rkt new file mode 100644 index 0000000..350860e --- /dev/null +++ b/I - Fixed-Size Data/Exercise_120.rkt @@ -0,0 +1,8 @@ +; (x) +;; This is not valid syntax for anything. It could be a variable x, if only it stood alone and not inside parentheses. + +; (+ 1 (not x)) +;; This is legal, I think. It is an expression that starts with a primitive expression, followed by a value, followed by another expression (not x). The inner expression is valid since it conforms to (primitive expr), and the outer expression has the valid format (primitive expr expr), where the second expr is that inner expression. + +; (+ 1 2 3) +;; This is legal, it matches the format (primitive expr expr expr), which is valid syntax for an expression, and each of its `expr`s is a valid expression that is just a value. diff --git a/I - Fixed-Size Data/Exercise_121.rkt b/I - Fixed-Size Data/Exercise_121.rkt new file mode 100644 index 0000000..c2bb470 --- /dev/null +++ b/I - Fixed-Size Data/Exercise_121.rkt @@ -0,0 +1,14 @@ +#lang racket + +(+ (* (/ 12 8) 2/3) + (- 20 (sqrt 4))) + +(cond + [(= 0 0) #false] + [(> 0 1) (string=? "a" "a")] + [else (= (/ 1 0) 9)]) + +(cond + [(= 2 0) #false] + [(> 2 1) (string=? "a" "a")] + [else (= (/ 1 2) 9)]) \ No newline at end of file diff --git a/I - Fixed-Size Data/Exercise_122.rkt b/I - Fixed-Size Data/Exercise_122.rkt new file mode 100644 index 0000000..0085767 --- /dev/null +++ b/I - Fixed-Size Data/Exercise_122.rkt @@ -0,0 +1,11 @@ +#lang racket + +(define (f x y) + (+ (* 3 x) (* y y))) + + +(+ (f 1 2) (f 2 1)) + +(f 1 (* 2 3)) + +(f (f 1 (* 2 3)) 19) diff --git a/README.md b/README.md index b11fbe6..1a5cb8c 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ | 7.10 | 3 | 117~119 | 6/25 | ... | ... | | | 7.11 | ... | ... | ... | ... | ... | | | 7.12 | 3 | ... | 9/25 | ... | 无练习 | | +| 7.13 | 3 | ... | 12/25 | ... | ... | | ----------------------------------------------------------------