learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

front-deque.scm (629B)


      1 (define-library (sicp solutions chapter-3 exercise-23-stuff front-deque)
      2   (import (scheme base))
      3 
      4   (import (sicp solutions chapter-3 exercise-23-stuff empty-deque))
      5   (import (sicp solutions chapter-3 exercise-23-stuff front-ptr))
      6   (import (prefix (sicp solutions chapter-3 exercise-23-stuff doubly-linked-list) dll:))
      7 
      8   (export front-deque)
      9 
     10   (begin
     11     (define (front-deque deque)
     12       "Returns the frontmost item if the deque is not empty.
     13 If deque is empty raises an error."
     14       (if (empty-deque? deque)
     15           (error "FRONT-DEQUE called with an empty deque" deque)
     16           (dll:link-item (front-ptr deque))))))