RosettaCodeData/Task/Singly-linked-list-Element-insertion/Haskell/singly-linked-list-element-insertion-1.hs

4 lines
145 B
Haskell
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
insertAfter a b (c:cs) | a==c = a : b : cs
| otherwise = c : insertAfter a b cs
insertAfter _ _ [] = error "Can't insert"