learning-sicp

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

exercise-23.scm (2135B)


      1 (define-library (sicp solutions chapter-3 exercise-23)
      2   (import (scheme base))
      3   (import (scheme write))
      4 
      5   (import (sicp solutions chapter-3 exercise-23-stuff deque-to-list))
      6   (import (sicp solutions chapter-3 exercise-23-stuff empty-deque))
      7   (import (sicp solutions chapter-3 exercise-23-stuff front-delete-deque))
      8   (import (sicp solutions chapter-3 exercise-23-stuff front-deque))
      9   (import (sicp solutions chapter-3 exercise-23-stuff front-insert-deque))
     10   (import (sicp solutions chapter-3 exercise-23-stuff front-ptr))
     11   (import (sicp solutions chapter-3 exercise-23-stuff make-deque))
     12   (import (sicp solutions chapter-3 exercise-23-stuff print-deque))
     13   (import (sicp solutions chapter-3 exercise-23-stuff rear-delete-deque))
     14   (import (sicp solutions chapter-3 exercise-23-stuff rear-deque))
     15   (import (sicp solutions chapter-3 exercise-23-stuff rear-insert-deque))
     16 
     17   (export
     18    deque->list
     19    empty-deque?
     20    front-delete-deque!
     21    front-deque
     22    front-insert-deque!
     23    make-deque
     24    print-deque
     25    rear-delete-deque!
     26    rear-deque
     27    rear-insert-deque!
     28    )
     29 
     30   (begin
     31     ;; Just a reminder, the API of the previous exercises:
     32 
     33     ;; (make-queue)
     34     ;;
     35     ;; returns a new queue object.
     36 
     37     ;; (empty-queue? queue)
     38     ;; returns either #t or #f.
     39 
     40     ;; (front-queue queue)
     41     ;;
     42     ;; if queue is empty raises an error or returns the earliest
     43     ;; element inserted still in existence.
     44 
     45     ;; (insert-queue! queue item)
     46     ;; inserts at the extremity.
     47 
     48     ;; (delete-queue! queue)
     49     ;;
     50     ;; if queue is empty raises an error or deletes that earliest item
     51     ;; inserted still in existence.
     52 
     53     ;; We'll implement:
     54 
     55     ;; Public:
     56     ;;
     57     ;; (make-deque)
     58     ;; (empty-deque? deque)
     59     ;; (front-deque deque)
     60     ;; (rear-deque deque)
     61     ;; (front-insert-deque! deque item)
     62     ;; (rear-insert-deque! deque item)
     63     ;; (front-delete-deque! deque item)
     64     ;; (rear-delete-deque! deque item)
     65     ;; (print-deque deque)
     66     ;;
     67     ;; Private:
     68     ;;
     69     ;; (front-ptr deque)
     70     ;; (rear-ptr deque)
     71     ;; (set-front-ptr! deque item)
     72     ;; (set-rear-ptr! deque item)
     73     ;; (deque->list deque)
     74 ))