Implement till 2.76
This commit is contained in:
11
util.scm
11
util.scm
@@ -34,3 +34,14 @@
|
||||
(if (> low high)
|
||||
nil
|
||||
(cons low (enumerate-interval (+ low 1) high))))
|
||||
|
||||
; Put and get functions. We could have implemented this via a list of
|
||||
; three-tuples, but I don't know how to create global variables yet so we just
|
||||
; use this code from SO. Doesn't look too complicated.
|
||||
; https://stackoverflow.com/questions/5499005/how-do-i-get-the-functions-put-and-get-in-sicp-scheme-exercise-2-78-and-on
|
||||
(define *op-table* (make-hash-table))
|
||||
(define (put op type proc)
|
||||
(hash-table/put! *op-table* (list op type) proc))
|
||||
(define (get op type)
|
||||
(hash-table/get *op-table* (list op type) #f))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user