db with prim hash - lookup method
This commit is contained in:
parent
e8c98e56ff
commit
389467c409
|
@ -28,13 +28,7 @@
|
|||
))
|
||||
|
||||
(define (lookup key)
|
||||
(let ((*result #f))
|
||||
(do ((i 0 (+ i 1)))
|
||||
((eq? i (length *db))
|
||||
*result)
|
||||
(if (eq? key (car (list-ref *db i)))
|
||||
(set! *result (cadr (list-ref *db i))))
|
||||
)))
|
||||
(cadr (list-ref *db (key->hash key))))
|
||||
|
||||
(define (key->hash key)
|
||||
(let ((*hash 0))
|
||||
|
|
|
@ -28,13 +28,7 @@
|
|||
))
|
||||
|
||||
(define (lookup key)
|
||||
(let ((*result #f))
|
||||
(do ((i 0 (+ i 1)))
|
||||
((eq? i (length *db))
|
||||
*result)
|
||||
(if (eq? key (car (list-ref *db i)))
|
||||
(set! *result (cadr (list-ref *db i))))
|
||||
)))
|
||||
(cadr (list-ref *db (key->hash key)))
|
||||
|
||||
(define (key->hash key)
|
||||
(let ((*hash 0))
|
||||
|
|
Loading…
Reference in New Issue