cl:expand-list   scheme


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

Implementation

;
;;;;;; extend a list with the last element duplicated
;;;;;; original version
;; add extra N elements to list (or turn atom into list of N elements)
; (cl:expand-list 50 3) ;; (50 50 50)
; (cl:expand-list '(50 51) 3) ;; (50 51 51 51 51)
(define cl:expand-list
   (lambda (l n)
      (if (list? l)
          (let ((xx (make-list n (cl:last l))))
             (append l xx))
          (let ((xx (make-list n l)))
             xx))))


Back to Index

Similar Entries