-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters