Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- suche :: String -> String -> Integer
- suche haystack needle = suche' (zip [0..] haystack) needle
- suche' :: [(Integer, Char)] -> String -> Integer
- suche' [] needle = -1
- suche' ((idx, x):xs) needle
- | (x:map snd (take (length needle - 1) xs)) == needle = idx
- | otherwise = suche' xs needle
Add Comment
Please, Sign In to add comment