midpointdisplacement added by anonymous on Wed Dec 19 08:14:42 2018

;;; ~/mda.scm

(define mda (lambda (vec p1 p2)
    (define midpoint (+ p1 (/ (- p2 p1) 2)))
    (if (> (- p2 p1) 1)
        (begin
        (vector-set! vec midpoint (floor (/ (+ (vector-ref vec p1) (vector-ref vec p2)) 2)))
        (mda vec p1 midpoint)
        (mda vec midpoint p2)))))