3.3.1. Mutable List Structure
Exercise 3.13

Make-cycle procedure

Consider the following make-cycle procedure, which uses the last-pair procedure defined in exercise 3.12 :

(define (make-cycle x)
  (set-cdr! (last-pair x) x)
  x)

Draw a box-and-pointer diagram that shows the structure z created by

(define z (make-cycle (list 'a 'b 'c)))

What happens if we try to compute (last-pair z) ?


Nobody's finished this exercise yet. You'll be the first!


There are no comments yet.

Authentication required

You must log in to post a comment.

Login