问题描述
sash> (insert-at 'alfa '(a b c d) 2)
-> (a alfa b c d)
解法
(define insert-at
(lambda (e ls n)
(let f ([ls ls] [n n])
(cond
[(null? ls) '()]
[(= n 1) (cons e ls)]
[else (cons (car ls) (f (cdr ls) (- n 1)))]))))