helper:inner-add   scheme


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm

Implementation

; helper:inner-add
;;;;;;;;;;;;
;; inner fn with cases to support :add
(define helper:inner-add
  (lambda (l1 l2)
    (cond ((= (length l1) (length l2))
            (map (lambda (x y) (helper:inner-do-add x y)) l1 l2))
          ((> (length l1) (length l2))
            (map (lambda (x y) (helper:inner-do-add x y)) 
            (cl:slice-left l1 (length l2)) l2))
          ((< (length l1) (length l2))
            (map (lambda (x y) (helper:inner-do-add x y)) 
            (cl:expand-list2 l1 (length l2)) l2))
    )))


Back to Index