* added an (ikarus vectors) library.

* moved make-vector to ikarus.vectors
This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 04:25:15 -04:00
parent 17d8da7486
commit 828df98fa8
4 changed files with 27 additions and 20 deletions

Binary file not shown.

View File

@ -11,9 +11,6 @@
(primitive-set! 'void (primitive-set! 'void
(lambda () (void))) (lambda () (void)))
(primitive-set! 'integer->char (primitive-set! 'integer->char
(lambda (n) (lambda (n)
(unless (fixnum? n) (unless (fixnum? n)
@ -29,23 +26,6 @@
(error 'char->integer "~s is not a character" x)) (error 'char->integer "~s is not a character" x))
($char->fixnum x))) ($char->fixnum x)))
(let ()
(define fill!
(lambda (v i n fill)
(cond
[($fx= i n) v]
[else
($vector-set! v i fill)
(fill! v ($fx+ i 1) n fill)])))
(define make-vector
(case-lambda
[(n) (make-vector n (void))]
[(n fill)
(unless (and (fixnum? n) (fx>= n 0))
(error 'make-vector "~s is not a valid length" n))
(fill! ($make-vector n) 0 n fill)]))
(primitive-set! 'make-vector make-vector))
(primitive-set! 'vector-length (primitive-set! 'vector-length

26
src/ikarus.vectors.ss Normal file
View File

@ -0,0 +1,26 @@
(library (ikarus vectors)
(export make-vector)
(import
(except (ikarus) make-vector)
(only (scheme)
$fx= $fx>= $fx+ $vector-set!
$make-vector))
(module (make-vector)
(define fill!
(lambda (v i n fill)
(cond
[($fx= i n) v]
[else
($vector-set! v i fill)
(fill! v ($fx+ i 1) n fill)])))
(define make-vector
(case-lambda
[(n) (make-vector n (void))]
[(n fill)
(unless (and (fixnum? n) ($fx>= n 0))
(error 'make-vector "~s is not a valid length" n))
(fill! ($make-vector n) 0 n fill)])))
)

View File

@ -30,6 +30,7 @@
"ikarus.records.ss" "ikarus.records.ss"
"ikarus.cxr.ss" "ikarus.cxr.ss"
"ikarus.strings.ss" "ikarus.strings.ss"
"ikarus.vectors.ss"
"ikarus.numerics.ss" "ikarus.numerics.ss"
"ikarus.guardians.ss" "ikarus.guardians.ss"