(define repeat (lambda (n val) (let loop ((i n) (out '())) (if (<= i 0) out (loop (- i 1) (cons val out))))))