RosettaCodeData/Task/Singly-linked-list-Element-insertion/ACL2/singly-linked-list-element-insertion.acl2
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

8 lines
239 B
Text

(defun insert-after (x e xs)
(cond ((endp xs)
nil)
((equal x (first xs))
(cons (first xs)
(cons e (rest xs))))
(t (cons (first xs)
(insert-after x e (rest xs))))))