(define repetitions-of (lambda (copies item) ; makes a list containing copies repetitions of the item (cond ((= copies 0) (list)) ; the (list) could also be '() (else (cons item (repetitions-of (- copies 1) item)))))) (define expand (lambda (lst) (cond ((null? lst) '()) ((number? (car lst)) (append (repetitions-of (car lst) (car (cdr lst))) (expand (cdr (cdr lst))))) (else (cons (car lst) (expand (cdr lst)))) ))) (expand '(get a job sha 8 na get a job sha 8 na wah 8 yip sha boom)) (define expand (lambda (lst) (cond ((null? lst) '()) ((number? (car lst)) (repetitions-of-onto (car lst) (car (cdr lst)) (expand (cdr (cdr lst))))) (else (cons (car lst) (expand (cdr lst)))) ))) (define sum (lambda (lst) (if (null? lst) 0 (+ (car lst) (sum (cdr lst)))))) (define combine-list (lambda (lst combine null-output) (if (null? lst) null-output (combine (car lst) (combine-list (cdr lst) combine null-output))))) (define repetitions-of-onto (lambda (copies element lst) (if (= copies 0) lst (repetitions-of-onto (- copies 1) element (cons element lst))))) (define reverse-onto (lambda (lst1 lst2) (if (null? lst1) lst2 (reverse-onto (cdr lst1) (cons (car lst1) lst2))))) (define reverse (lambda (lst) (reverse-onto lst '()))) (define append (lambda (lst1 lst2) (reverse-onto (reverse lst1) lst2)))