* vector->list is moved to ikarus.vectors

This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 06:08:43 -04:00
parent e9ca4ed971
commit 8188c51d20
3 changed files with 19 additions and 19 deletions

Binary file not shown.

View File

@ -179,21 +179,6 @@
(let ()
(define f
(lambda (v i ls)
(cond
[($fx< i 0) ls]
[else
(f v ($fxsub1 i) (cons ($vector-ref v i) ls))])))
(primitive-set! 'vector->list
(lambda (v)
(if (vector? v)
(let ([n ($vector-length v)])
(if ($fxzero? n)
'()
(f v ($fxsub1 n) '())))
(error 'vector->list "~s is not a vector" v)))))
(let ()
(define f

View File

@ -1,13 +1,13 @@
(library (ikarus vectors)
(export make-vector vector vector-length vector-ref vector-set!
list->vector)
vector->list list->vector)
(import
(except (ikarus) make-vector vector
vector-length vector-ref vector-set!
list->vector)
vector->list list->vector)
(only (scheme)
$fx= $fx>= $fx< $fx<= $fx+ $fxadd1 $car $cdr
$fx= $fx>= $fx< $fx<= $fx+ $fxadd1 $fxsub1 $fxzero? $car $cdr
$vector-set! $vector-ref $make-vector $vector-length))
@ -76,6 +76,21 @@
(error 'vector-set! "index ~s is out of range for ~s" i v))
($vector-set! v i c)))
(define vector->list
(lambda (v)
(define f
(lambda (v i ls)
(cond
[($fx< i 0) ls]
[else
(f v ($fxsub1 i) (cons ($vector-ref v i) ls))])))
(if (vector? v)
(let ([n ($vector-length v)])
(if ($fxzero? n)
'()
(f v ($fxsub1 n) '())))
(error 'vector->list "~s is not a vector" v))))
(define list->vector
(letrec ([race
(lambda (h t ls n)