Professional Documents
Culture Documents
Lecture 3: Introduction To Racket: CMSC 15100 - Winter 2018 University of Chicago
Lecture 3: Introduction To Racket: CMSC 15100 - Winter 2018 University of Chicago
January 8, 2018
Review
Recall from the last lecture that Typed Racket has a uniform syntactic
structure, where a term is either an identifier or constant, or it is an
operator with zero or more arguments (or subterms):
of a triangle.
b
of a triangle.
b
of a triangle.
b
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
where
I f is the name of the function
I ty1 · · · tyn -> ty is the type (or signature) of the function
I the variables x1 , . . . , xn are the parameters of the function
I the expression exp is the body of the function.
I The parameter xi has type tyi in its scope exp.
I the function’s body exp has type ty.
The invocation of test is usually placed at the end of the source file. It
causes the tests to be run.
The invocation of test is usually placed at the end of the source file. It
causes the tests to be run.
The invocation of test is usually placed at the end of the source file. It
causes the tests to be run.
(test)
The invocation of test is usually placed at the end of the source file. It
causes the tests to be run.
(test)
The invocation of test is usually placed at the end of the source file. It
causes the tests to be run.
;; check that lo e hi
(check-range e lo hi )
(and #t · · · ) ⇒ (and · · · )
(and #f · · · ) ⇒ #f
(and) ⇒ #t
(or #f · · · ) ⇒ (or · · · )
(or #t · · · ) ⇒ #t
(or) ⇒ #f