...
- 18.2.2
- In this problem, simply annotate each definition by attaching identifying
subscripts (written in line such as x1 for "x sub 1" and y4 for "y sub 4")
to _all_variable occurrences so that all of the uses of each defining
occurrence are identified. A good way to choose a subscript value for a
variable is to use
the lexical nesting level of the binding occurrence.
For example,
becomesCode Block (define (my-max lon) (cond [(empty? lon) (error 'my-max "applied to no arguments")] [(empty? (rest lon)) (first lon)] [else (local [(define head (first lon)) (define max-tail (my-max (rest lon)))] (if (>= head max-tail) head max-tail))]))
Code Block (define (my-max1 lon1) (cond [(empty? lon1) (error 'my-max "applied to no arguments")] [(empty? (rest lon1)) (first lon1)] [else (local [(define head2 (first lon1)) (define max-tail2 (my-max1 (rest lon1)))] (if (>= head2 max-tail2) head2 max-tail2))]))
- In this problem, simply annotate each definition by attaching identifying
- 20.1.1
- 21.1.2
- 21.2.1
- 21.2.3
- "Lists of names" just means "lists of symbols."
- 22.2.2
- Name your function
make-sort
. make-sort
produces functions. Test these results by applying them to a
few different arguments.
- Name your function
- 23.3.9
- The series represented by
greg
is (4, -4/3, 4/5, -4/7, ...).
- The series represented by
- 24.0.8
- Instead of drawing arrows from the underlined occurrences, simply annotate
each expression by attaching
subscripts (written in line such as x1 for "x sub 1" and y4 for "y sub 4")
to all variable occurrences so that all of the uses of each defining
occurrence are identified. For example,
becomesCode Block (lambda (f g x) (f x (lambda (x) (g (g x)))))
Code Block (lambda (f1 g1 x1) (f1 x1 (lambda (x2) (g1 (g1 x2)))))
- Instead of drawing arrows from the underlined occurrences, simply annotate
...