ivl:expand/contract   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/pc_ivl.xtm

Implementation

;; expand/contract list by factor paying no attention to key
(define ivl:expand/contract
   (lambda (lst factor)
      (cons (car lst)
            (let loop ((old (car lst))
                       (l (cdr lst))
                       (current (car lst))
                       (newlst '()))
               (if (null? l)
                   (reverse newlst)
                   (loop (car l)
                         (cdr l)
                         (+ current (* factor (- (car l) old)))
                         (cons (real->integer (+ current (* factor (- (car l) old))))
                               newlst)))))))


Back to Index

Similar Entries