implementation
- notes
represent each entry as a cons cell
represent buffer as a cons cell whose car (cdr) is the cell to the left (right) of the bar
- code
(define (make-cb v)
(let ((cell (cons v nil)))
(set-cdr! cell cell)
(cons cell cell)))
(define (insert! b v)
(let ((new-cell (cons v (cdr b))))
(set-cdr! (car b) new-cell)
(set-cdr! b new-cell)))
(define (remove! b)
(let ((old-cell (cdr b)))
(set-cdr! (car b) (cdr old-cell))
(set-cdr! b (cdr old-cell))
(car old-cell)))