CSci 1301: Problem Set 4
Due: Friday, October 10 in class or by email before the class time 10:30am
Problem 1: Written exercises
Written exercises can be submitted electronically or on paper, in one
of the
following ways:
- on paper in class on the due date or in my office (slide it under
the door if I am not there) at any point before the deadline,
- in an email message with the rest of your problem set,
- as an attachement to an email message with the rest of your
problem set,
- as a google doc shared with me. Please give me permissions to
re-share so that I can share it with the TA, and do not make any
changes after the submission deadline.
Book exercises for this part are given
in the
section Intermezzo:
BSL
-
(3 points) Exercises 108 (question 3 only), 109 (questions 2,3)
- (5 points) For each of the following expressions and definitions indicate if
they are legal or illegal. Explain your answers (otherwise you may
not get credit even for a correct answer)
(define cond 4)
(cond [true 1 false 0])
(define (f x)
(+ x (f x)))
(define (g "input")
(+ (string-length "input") 1))
(define (h InPuT)
(+ (string-length InPuT) 1))
- (4 points) Exercise 112 (questions 2,3 only)
- (8 points) Exercise 113, 115, 117 questions 1,2 (note:
evaluation of some
expressions may lead
to an error)
Problem 2: Traffic light (12 points)
Exercise 99
in Section
6.2. Start designing your solution by deciding on what your
world state will be. Make sure to describe your world state in
comments right before main. Include check-with
in your
big-bang to check that your world state is in a valid state, it is a
requied part of this problem.
CSci 1301
course web site.