Skip to content

Instantly share code, notes, and snippets.

@pmiddend
Created January 26, 2016 16:38
Show Gist options
  • Select an option

  • Save pmiddend/af6ff2595f4e11c6f40b to your computer and use it in GitHub Desktop.

Select an option

Save pmiddend/af6ff2595f4e11c6f40b to your computer and use it in GitHub Desktop.
count :: String -> String -> Int
count _ [] = 0
count needle a@(_:xs) | needle `isPrefixOf` a = 1 + count needle xs
| otherwise = count needle xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment