Example:
(deftest p21-insert-at (is (= '(1 new 2 3 4) (insert-at 'new 1 '(1 2 3 4)))))
Solution:
My solution to this problem is based on the same idea as the previous one: Reuse split from problem 17 to cut the input sequence into two parts. Then concatenate the parts, cons'ing the element to insert to the tail before doing so.
No comments:
Post a Comment