# Implementing Haskell's delete

Learn You a Haskell shows the delete function.

delete: deletes first occurrence of item

ghci> delete 'h' "hey there ghang!"
"ey there ghang!"


delete' :: (Eq a) => a -> [a] -> [a]
delete' y xs = delete'' y xs []
where delete'' _ [] _ = []
delete'' d (a:as) acc
| a == d    = reverse acc ++ as
| otherwise = delete'' d as (a:acc)


I don't like the fact that I'm using the : operator, but then calling reverse and acc ++ as.

Also, I don't know how to capture the first pattern match of delete'' with a single pattern match and guards alone.

I think you're overcomplicating this a bit. Something like delete certainly shouldn't need reverse or ++ to implement.
delete' :: (Eq a) => a -> [a] -> [a]

delete' y (x:xs) = if x == y then xs else x : delete' y xs