Blame


1 665c255d 2023-08-04 jrmu ;; Exercise 3.22. Instead of representing a queue as a pair of pointers, we can build a queue as a procedure with local state. The local state will consist of pointers to the beginning and the end of an ordinary list. Thus, the make-queue procedure will have the form
2 665c255d 2023-08-04 jrmu
3 665c255d 2023-08-04 jrmu (define (make-queue)
4 665c255d 2023-08-04 jrmu (let ((front-ptr ...)
5 665c255d 2023-08-04 jrmu (rear-ptr ...))
6 665c255d 2023-08-04 jrmu <definitions of internal procedures>
7 665c255d 2023-08-04 jrmu (define (dispatch m) ...)
8 665c255d 2023-08-04 jrmu dispatch))
9 665c255d 2023-08-04 jrmu
10 665c255d 2023-08-04 jrmu ;; Complete the definition of make-queue and provide implementations of the queue operations using this representation.