(define q1 (make-queue))
(insert-queue! q1 a> ((a) a)
(insert-queue! q1 b> ((a b) b)
(delete-queue! q1> ((b) b)
(delete-queue! q1() b)
define print-q.....
Procedure objects in the global frame.
Result of evaluating (define x (cons 1 2)).
Result of evaluating (define z (cons x x)).
Result of evaluating (s.....
define cycle? x define iter slow fast cond or null? slow null? fast #f eq? slow fast #t else if or null? cdr slow null? cddr fast #f iter cdr slow cddr fast if or null? x null? cdr x #f iter x cdr x I think the very clever idea me.....
define count-pairs x let nodes-checked ' define check item set! nodes-checked cons item nodes-checked define checked? item memq item nodes-checked define iter x if not pair? x 0 if checked? car x + iter car x iter cdr x begin chec.....
The count-pair procedure returns 3.
The count-pair procedure returns 4.
The count-pair procedure return 7.
The count-pair procedure never returns at a.....
Solution)
Lists x: (a b) and y: (c d).
Effect of (define z (append x y))
So, the first is (b).
Effect of (define w (append! x y))
The second is (b c.....
Result of defining make-account in the global environment.
Result of evaluating (define acc (make-account 50))
Environments created by applying ((acc .....
Result of defining make-account in the global environment.
Result of evaluating (define acc (make-account 50))
Environments created by applying ((acc .....
Solution)
Result of defining make-withdraw in the global environment.
Result of evaluating (define W1 (make-withdraw 100))
Environments created by app.....
Result of defining make-withdraw in the global environment.
Result of evaluating (define W1 (make-withdraw 100))
Environments created by applying the .....
Solution)
Recursive Version
Procedure object in the global frame
Environments created by evaluating (factorial 6)
Iterative Version
Procedure object .....
Recursive Version
Procedure object in the global frame
Environments created by evaluating (factorial 6)
Iterative Version
Procedure object in the glo.....
Solution)
define make-joint account password new-password
define dispatch p m
if eq? p new-password account password m lambda amount Incorrect password
dispatch
...
Solution)
define rand
let x random-init
define generate begin set! x rand-update x x
define reset set! x random-init
define dispatch m cond eq? m 'generate generate eq? m 'reset reset else error Unk.....