Use `modulo' instead of `remainder' to force ring indexes into the
authorChris Hanson <org/chris-hanson/cph>
Fri, 15 Mar 1991 23:30:49 +0000 (23:30 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 15 Mar 1991 23:30:49 +0000 (23:30 +0000)
right range.  `remainder' is incorrect if the argument is negative.

v7/src/edwin/ring.scm

index 5031ecb66d053a19adeed05bdcc00d7b6948b10c..31f17fd40adb2390b7931e065ed8492a05e2a91c 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/ring.scm,v 1.9 1989/04/28 22:52:56 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/ring.scm,v 1.10 1991/03/15 23:30:49 cph Exp $
 ;;;
-;;;    Copyright (c) 1984, 1989 Massachusetts Institute of Technology
+;;;    Copyright (c) 1984, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
 
 (set! ring-ref
 (named-lambda (ring-ref ring index)
-  (list-ref (vector-ref ring 2) (remainder index (ring-size ring)))))
+  (list-ref (vector-ref ring 2) (modulo index (ring-size ring)))))
 
 (set! ring-set!
 (named-lambda (ring-set! ring index object)
-  (list-set! (vector-ref ring 2) (remainder index (ring-size ring)) object)))
+  (list-set! (vector-ref ring 2) (modulo index (ring-size ring)) object)))
 
 )
\ No newline at end of file