From 810fe75fa1f282838c77c247c73b2dc63724a976 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Sat, 11 Apr 2009 21:39:53 +0300 Subject: [PATCH] - hashtable-hash-function used to return an incorrect hash function that the one supplied to make-hashtable; fixed. - div and mod raise an error, rather than an assertion when given zero second argument; fixed. --- scheme/ikarus.hash-tables.ss | 15 ++++++++------- scheme/ikarus.numerics.ss | 4 ++-- scheme/last-revision | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scheme/ikarus.hash-tables.ss b/scheme/ikarus.hash-tables.ss index 01f6270..7f71e63 100644 --- a/scheme/ikarus.hash-tables.ss +++ b/scheme/ikarus.hash-tables.ss @@ -15,7 +15,7 @@ (library (ikarus hash-tables) - (export make-eq-hashtable make-eqv-hashtable make-hashtable + (export make-eq-hashtable make-eqv-hashtable make-hashtable hashtable-ref hashtable-set! hashtable? hashtable-size hashtable-delete! hashtable-contains? hashtable-update! hashtable-keys hashtable-mutable? @@ -36,7 +36,7 @@ hashtable-equivalence-function hashtable-hash-function string-hash string-ci-hash symbol-hash)) - (define-struct hasht (vec count tc mutable? hashf equivf)) + (define-struct hasht (vec count tc mutable? hashf equivf hashf0)) ;;; directly from Dybvig's paper (define tc-pop @@ -337,7 +337,8 @@ (define (dup-hasht h mutable? n) (let* ([hashf (hasht-hashf h)] [tc (and (not hashf) (let ([x (cons #f #f)]) (cons x x)))]) - (make-hasht (make-base-vec n) 0 tc mutable? hashf (hasht-equivf h)))) + (make-hasht (make-base-vec n) 0 tc mutable? + hashf (hasht-equivf h) (hasht-hashf0 h)))) (let ([v (hasht-vec h)] [n (hasht-count h)]) (let ([r (dup-hasht h mutable? (vector-length v))]) (let f ([i ($fxsub1 n)] [j ($fxsub1 (vector-length v))] [r r] [v v]) @@ -363,7 +364,7 @@ [() (let ([x (cons #f #f)]) (let ([tc (cons x x)]) - (make-hasht (make-base-vec 32) 0 tc #t #f eq?)))] + (make-hasht (make-base-vec 32) 0 tc #t #f eq? #f)))] [(k) (if (and (or (fixnum? k) (bignum? k)) (>= k 0)) (make-eq-hashtable) @@ -374,7 +375,7 @@ [() (let ([x (cons #f #f)]) (let ([tc (cons x x)]) - (make-hasht (make-base-vec 32) 0 tc #t #f eqv?)))] + (make-hasht (make-base-vec 32) 0 tc #t #f eqv? #f)))] [(k) (if (and (or (fixnum? k) (bignum? k)) (>= k 0)) (make-eqv-hashtable) @@ -402,7 +403,7 @@ (unless (procedure? equivf) (die who "equivalence function is not a procedure" equivf)) (if (and (or (fixnum? k) (bignum? k)) (>= k 0)) - (make-hasht (make-base-vec 32) 0 #f #t (wrap hashf) equivf) + (make-hasht (make-base-vec 32) 0 #f #t (wrap hashf) equivf hashf) (die who "invalid initial capacity" k))])) (define hashtable-ref @@ -495,7 +496,7 @@ (define (hashtable-hash-function h) (if (hasht? h) - (hasht-hashf h) + (hasht-hashf0 h) (die 'hashtable-hash-function "not a hash table" h))) (define (string-hash s) diff --git a/scheme/ikarus.numerics.ss b/scheme/ikarus.numerics.ss index abcee7d..c15a826 100644 --- a/scheme/ikarus.numerics.ss +++ b/scheme/ikarus.numerics.ss @@ -3378,7 +3378,7 @@ (cond [(and (fixnum? n) (fixnum? m)) (cond - [(eq? m 0) (error 'div "division by 0")] + [(eq? m 0) (die 'div "division by 0")] [(eq? m -1) (- n)] [else (let ([d0 ($fxquotient n m)]) @@ -3396,7 +3396,7 @@ (cond [(and (fixnum? n) (fixnum? m)) (cond - [(eq? m 0) (error 'mod "division by 0")] + [(eq? m 0) (die 'mod "division by 0")] [else (let ([d0 ($fxquotient n m)]) (let ([m0 ($fx- n ($fx* d0 m))]) diff --git a/scheme/last-revision b/scheme/last-revision index 76aca5d..fdd3a56 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1764 +1765