問題3.24

(define (make-table same-key?)
  (let ((local-table (list '*table*)))
    (define (assoc2 key records test)
      (cond ((null? records) #f)
            ((test key (caar records)) (car records))
            (else (assoc2 key (cdr records) test))))
    (define (lookup key-1 key-2)
      (let ((subtable (assoc2 key-1 (cdr local-table) same-key?)))
        (if subtable
            (let ((record (assoc2 key-2 (cdr subtable) same-key?)))
              (if record
                  (cdr record)
                  #f))
            #f)))
    (define (insert! key-1 key-2 value)
      (let ((subtable (assoc2 key-1 (cdr local-table) same-key?)))
        (if subtable
            (let ((record (assoc2 key-2 (cdr subtable) same-key?)))
              (if record
                  (set-cdr! record value)
                  (set-cdr! subtable
                            (cons (cons key-2 value)
                                  (cdr subtable)))))
            (set-cdr! local-table
                      (cons (list key-1
                                  (cons key2 value))
                            (cdr local-table)))))
      'ok)
    (define (dispatch m)
      (cond ((eq? m 'lookup-proc) lookup)
            ((eq? m 'insert-proc!) insert!)
            (else (error "Unknown operation -- TABLE" m))))
    dispatch))


(define (lookup))
(define (insert!))