summaryrefslogtreecommitdiffstats
path: root/hash.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:38 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:38 -0800
commit64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34 (patch)
tree1b23b8e8005328194e2fb4bf653806c85050933f /hash.scm
parent5bea21e81ed516440e34e480f2c33ca41aa8c597 (diff)
downloadslib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.tar.gz
slib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.zip
Import Upstream version 3a5upstream/3a5
Diffstat (limited to 'hash.scm')
-rw-r--r--hash.scm37
1 files changed, 19 insertions, 18 deletions
diff --git a/hash.scm b/hash.scm
index fbee264..c2d8f5c 100644
--- a/hash.scm
+++ b/hash.scm
@@ -17,24 +17,6 @@
;promotional, or sales literature without prior written consent in
;each case.
-(define (hash:hash-symbol sym n)
- (hash:hash-string (symbol->string sym) n))
-
-;;; This can overflow on implemenatations where inexacts have a larger
-;;; range than exact integers.
-(define hash:hash-number
- (if (provided? 'inexact)
- (lambda (num n)
- (if (integer? num)
- (modulo (if (exact? num) num (inexact->exact num)) n)
- (hash:hash-string-ci
- (number->string (if (exact? num) (exact->inexact num) num))
- n)))
- (lambda (num n)
- (if (integer? num)
- (modulo num n)
- (hash:hash-string-ci (number->string num) n)))))
-
(define (hash:hash-string-ci str n)
(let ((len (string-length str)))
(if (> len 5)
@@ -57,6 +39,25 @@
h)))))
(define hash:hash-string hash:hash-string-ci)
+
+(define (hash:hash-symbol sym n)
+ (hash:hash-string (symbol->string sym) n))
+
+;;; This can overflow on implemenatations where inexacts have a larger
+;;; range than exact integers.
+(define hash:hash-number
+ (if (provided? 'inexact)
+ (lambda (num n)
+ (if (integer? num)
+ (modulo (if (exact? num) num (inexact->exact num)) n)
+ (hash:hash-string-ci
+ (number->string (if (exact? num) (exact->inexact num) num))
+ n)))
+ (lambda (num n)
+ (if (integer? num)
+ (modulo num n)
+ (hash:hash-string-ci (number->string num) n)))))
+
;@
(define (hash obj n)
(let hs ((d 10) (obj obj))