リストの n 番目の位置に要素を追加する方法がわかりません。例えば:
(insert-at new k lis)
(insert-at ’N 2 ’(a b c d e f))
=>
’(a b N c d e f)
大丈夫ですか?:
(define (insert-at new k lis)
(cond (( null? lis)
(list new))
(zero? k
(cons new lis))
(else
(cons (car lis)
(insert-at new (- k 1) (cdr lis))))))