I want to create a procedure called (splice L i n A)
where L
is a list, i
is an index, n
is the number of elements and A
is another list. So i
is the index at which I would like to insert the list A
into the list L
and n
is the number of elements that I want to remove from my new list starting at index i
.
For example: if I run
(splice '(1 2 3 4 5) 2 1 '(a b c))
this will give me
(1 2 a b c 4 5)
so I added the list '(a b c)
at index i
and I removed 1 element starting at index i
which would be the 3.