* added an (ikarus vectors) library.
* moved make-vector to ikarus.vectors
This commit is contained in:
parent
17d8da7486
commit
828df98fa8
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -11,9 +11,6 @@
|
|||
(primitive-set! 'void
|
||||
(lambda () (void)))
|
||||
|
||||
|
||||
|
||||
|
||||
(primitive-set! 'integer->char
|
||||
(lambda (n)
|
||||
(unless (fixnum? n)
|
||||
|
@ -30,23 +27,6 @@
|
|||
($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
|
||||
(lambda (x)
|
||||
|
|
|
@ -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)])))
|
||||
|
||||
)
|
|
@ -30,6 +30,7 @@
|
|||
"ikarus.records.ss"
|
||||
"ikarus.cxr.ss"
|
||||
"ikarus.strings.ss"
|
||||
"ikarus.vectors.ss"
|
||||
"ikarus.numerics.ss"
|
||||
"ikarus.guardians.ss"
|
||||
|
||||
|
|
Loading…
Reference in New Issue