diff --git a/arrays/src/Data/Array.ss b/arrays/src/Data/Array.ss index b152234e..b5177916 100644 --- a/arrays/src/Data/Array.ss +++ b/arrays/src/Data/Array.ss @@ -35,21 +35,21 @@ (define rangeImpl (lambda (start end) - (let* ([step (if (> start end) -1 1)] + (let* ([step (if (fx>? start end) -1 1)] [result (srfi:214:make-flexvector (+ (* step (- end start)) 1))]) (let recur ([i start] [n 0]) - (if (not (= i end)) + (if (not (fx=? i end)) (begin (srfi:214:flexvector-set! result n i) - (recur (+ i step) (+ n 1))) + (recur (fx+ i step) (fx1+ n))) (begin (srfi:214:flexvector-set! result n i) result)))))) (define replicateImpl (lambda (count value) - (if (< count 1) + (if (fx= i (rt:array-length xs))) + (if (or (fx=? i (rt:array-length xs))) nothing (just (rt:array-ref xs i))))) @@ -78,11 +78,11 @@ (lambda (nothing isJust f xs) (let ([len (rt:array-length xs)]) (let recur ([i 0]) - (if (< i len) + (if (fx i (rt:array-length l))) + (if (or (fx? i (rt:array-length l))) nothing (let ([l1 (srfi:214:flexvector-copy l)]) (srfi:214:flexvector-add! l1 i a) @@ -109,7 +109,7 @@ (define _deleteAt (lambda (just nothing i l) - (if (or (< i 0) (>= i (rt:array-length l))) + (if (or (fx=? i (rt:array-length l))) nothing (let ([l1 (srfi:214:flexvector-copy l)]) (srfi:214:flexvector-remove! l1 i) @@ -117,7 +117,7 @@ (define _updateAt (lambda (just nothing i a l) - (if (or (< i 0) (>= i (rt:array-length l))) + (if (or (fx=? i (rt:array-length l))) nothing (let ([l1 (srfi:214:flexvector-copy l)]) (srfi:214:flexvector-set! l1 i a) @@ -147,22 +147,22 @@ [out (srfi:214:make-flexvector len)]) (let recur ([i 0] [acc b]) - (if (< i len) + (if (fx= i 0) + (if (fx>=? i 0) (let ([next ((f (rt:array-ref xs i)) acc)]) (srfi:214:flexvector-set! out i next) - (recur (- i 1) next)) + (recur (fx1- i) next)) out))))) ;;------------------------------------------------------------------------------ @@ -173,7 +173,7 @@ (lambda (compare fromOrdering xs) (let ([tmp (srfi:214:flexvector->vector xs)]) (vector-sort! - (lambda (x y) (> (fromOrdering ((compare y) x)) 0)) + (lambda (x y) (fx>? (fromOrdering ((compare y) x)) 0)) tmp) (srfi:214:vector->flexvector tmp)))) @@ -184,7 +184,7 @@ (define sliceImpl (lambda (s e l) - (if (> s e) + (if (fx>? s e) (rt:make-array) (srfi:214:flexvector-copy l s e)))) diff --git a/arrays/src/Data/Array/ST.ss b/arrays/src/Data/Array/ST.ss index 8d431aec..e521133c 100644 --- a/arrays/src/Data/Array/ST.ss +++ b/arrays/src/Data/Array/ST.ss @@ -27,19 +27,19 @@ (define pokeImpl (lambda (i a xs) - (let ([ret (and (>= i 0) (< i (rt:array-length xs)))]) + (let ([ret (and (fx>=? i 0) (fx= i 0) (< i (rt:array-length xs))) + (if (and (fx>=? i 0) (fx (rt:array-length xs) 0) + (if (fx>? (rt:array-length xs) 0) (just (srfi:214:flexvector-remove-back! xs)) nothing))) @@ -50,16 +50,16 @@ (define shiftImpl (lambda (just nothing xs) - (if (> (rt:array-length xs) 0) + (if (fx>? (rt:array-length xs) 0) (just (srfi:214:flexvector-remove-front! xs)) nothing))) (define spliceImpl (lambda (i howMany bs xs) - (if (> howMany 0) + (if (fx>? howMany 0) (let ([removed (srfi:214:make-flexvector howMany)]) - (srfi:214:flexvector-copy! removed 0 xs i (+ i howMany)) - (srfi:214:flexvector-remove-range! xs i (+ i howMany)) + (srfi:214:flexvector-copy! removed 0 xs i (fx+ i howMany)) + (srfi:214:flexvector-remove-range! xs i (fx+ i howMany)) (srfi:214:flexvector-add-all! xs i (srfi:214:flexvector->list bs)) removed) (begin @@ -89,7 +89,7 @@ (lambda (compare fromOrdering xs) (let ([tmp (srfi:214:flexvector->vector xs)]) (vector-sort! - (lambda (x y) (> (fromOrdering ((compare y) x)) 0)) + (lambda (x y) (fx>? (fromOrdering ((compare y) x)) 0)) tmp) (srfi:214:flexvector-copy! xs 0 (srfi:214:vector->flexvector tmp))))) diff --git a/foldable-traversable/test/Main.ss b/foldable-traversable/test/Main.ss index 29f035ff..9fd2e8cb 100644 --- a/foldable-traversable/test/Main.ss +++ b/foldable-traversable/test/Main.ss @@ -3,14 +3,14 @@ arrayReplicate mkNEArray foldMap1NEArray) - (import (only (rnrs base) define lambda let if + > <) + (import (chezscheme) (prefix (purs runtime) rt:) (prefix (purs runtime srfi :214) srfi:214:)) (define arrayFrom1UpTo (lambda (n) (srfi:214:flexvector-map/index - (lambda (i x) (+ i 1)) + (lambda (i x) (fx1+ i)) (srfi:214:make-flexvector n)))) (define arrayReplicate @@ -23,7 +23,7 @@ (lambda (nothing) (lambda (just) (lambda (arr) - (if (> (srfi:214:flexvector-length arr) 0) + (if (fx>? (srfi:214:flexvector-length arr) 0) (just arr) nothing))))) @@ -34,8 +34,8 @@ (let ([len (srfi:214:flexvector-length arr)]) (let recur ([acc (f (rt:array-ref arr 0))] [i 1]) - (if (< i len) - (recur ((append acc) (f (rt:array-ref arr i))) (+ i 1)) + (if (fx xlen ylen) -1] + [(fx=? xlen ylen) 0] + [(fx>? xlen ylen) -1] (else 1)) (let ([o ((f (srfi:214:flexvector-ref xs xsi)) (srfi:214:flexvector-ref ys ysi))]) (if (not (fx=? o 0)) o (loop - (+ xsi 1) - (+ ysi 1))))))))))) + (fx1+ xsi) + (fx1+ ysi))))))))))) ) diff --git a/prelude/src/Data/Show.ss b/prelude/src/Data/Show.ss index ccfa4522..4208dde9 100644 --- a/prelude/src/Data/Show.ss +++ b/prelude/src/Data/Show.ss @@ -54,14 +54,14 @@ (define (string-join xs separator) (let ([len (rt:array-length xs)]) (cond - [(= len 0) (string->pstring "")] - [(= len 1) (rt:array-ref xs 0)] + [(fx=? len 0) (string->pstring "")] + [(fx=? len 1) (rt:array-ref xs 0)] (else (let recur ([i 1] [buffer (rt:array-ref xs 0)]) - (if (= len i) + (if (fx=? len i) buffer - (recur (+ i 1) (pstring-concat buffer separator (rt:array-ref xs i))))))))) + (recur (fx1+ i) (pstring-concat buffer separator (rt:array-ref xs i))))))))) (define showArrayImpl (lambda (f) diff --git a/prelude/src/Data/Show/Generic.ss b/prelude/src/Data/Show/Generic.ss index 24a2ce7c..80da51d9 100644 --- a/prelude/src/Data/Show/Generic.ss +++ b/prelude/src/Data/Show/Generic.ss @@ -2,7 +2,7 @@ (library (Data.Show.Generic foreign) (export intercalate) - (import (only (rnrs base) define lambda if let cond else = +) + (import (chezscheme) (only (purs runtime pstring) pstring pstring-concat) (prefix (purs runtime) rt:)) @@ -11,14 +11,14 @@ (lambda (xs) (let ([len (rt:array-length xs)]) (cond - [(= len 0) (pstring)] - [(= len 1) (rt:array-ref xs 0)] + [(fx=? len 0) (pstring)] + [(fx=? len 1) (rt:array-ref xs 0)] (else (let recur ([i 1] [buffer (rt:array-ref xs 0)]) - (if (= len i) + (if (fx=? len i) buffer - (recur (+ i 1) + (recur (fx1+ i) (pstring-concat buffer separator (rt:array-ref xs i))))))))))) ) diff --git a/st/src/Control/Monad/ST/Internal.ss b/st/src/Control/Monad/ST/Internal.ss index d6636e8d..072044e7 100644 --- a/st/src/Control/Monad/ST/Internal.ss +++ b/st/src/Control/Monad/ST/Internal.ss @@ -41,7 +41,7 @@ (lambda (hi) (lambda (f) (lambda () - (do ([i lo (+ i 1)]) ((= i hi) 'unit) + (do ([i lo (fx1+ i)]) ((fx=? i hi) 'unit) ((f i)))))))) (define foreach