learning-sicp

My embarrassing half assed SICP run.
Log | Files | Refs

front-deque.scm (537B)


      1 (define-library (sicp solutions 3_23 front-deque)
      2   (import (scheme base))
      3 
      4   (import (sicp solutions 3_23 empty-deque))
      5   (import (sicp solutions 3_23 front-ptr))
      6   (import (prefix (sicp solutions 3_23 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))))))