xanadu - xml b-tree - 3
This commit is contained in:
parent
0e25720779
commit
ec6815345e
|
@ -27,11 +27,14 @@
|
||||||
;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
(define (vector-median v)
|
(define (vector-median v)
|
||||||
(let ((retv (make-vector (inexact->exact (/ (vector-length v) 2)))))
|
(let ((len (ceiling (/ (vector-length v) 2))))
|
||||||
(do ((i 0 (+ i 1)))
|
(let ((retl (make-vector len))
|
||||||
((= i (/ (vector-length v) 2)) retv)
|
(retr (make-vector len)))
|
||||||
(vector-set! retv i (vector-ref v i))
|
(do ((i 0 (+ i 1)))
|
||||||
)))
|
((= i len) (list retl retr))
|
||||||
|
(vector-set! retl i (vector-ref v i))
|
||||||
|
(vector-set! retr i (vector-ref v (- len (+ i 1))))
|
||||||
|
)))
|
||||||
|
|
||||||
(define (make-b-tree)
|
(define (make-b-tree)
|
||||||
(let ((*tree (make-vector 0)))
|
(let ((*tree (make-vector 0)))
|
||||||
|
|
Loading…
Reference in New Issue