constant-list

Name

constant-list -- Returns a list of the specified value

Synopsis

(constant-list value length)

Description

Return a list containing length elements, each of value.

Author

David Carlisle

Source Code

(define (constant-list value length)
  ;; Returns a list of the specified value
   (let loop ((count (abs length)) (result '()))
     (if (equal? count 0)
         result
         (loop (- count 1) (cons value  result)))))