RosettaCodeData/Task/Singly-linked-list-Element-insertion/ACL2/singly-linked-list-element-insertion.acl2

9 lines
239 B
Text
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
(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))))))