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

4 lines
145 B
Haskell
Raw Permalink Normal View History

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