table.scm 448 B

1234567891011121314151617
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees
  3. (define (make-table . hash-procedure-option) (list 'table))
  4. (define (table-ref table key)
  5. (let ((probe (assq key (cdr table))))
  6. (if probe (cdr probe) #f)))
  7. (define (table-set! table key value)
  8. (let ((probe (assq key (cdr table))))
  9. (if probe
  10. (set-cdr! probe value)
  11. (set-cdr! table (cons (cons key value) (cdr table))))))