Skip to content

Instantly share code, notes, and snippets.

@crclark96
Created August 25, 2020 12:15
Show Gist options
  • Save crclark96/4131696c5a316b19c9e2f4ac23397f8f to your computer and use it in GitHub Desktop.
Save crclark96/4131696c5a316b19c9e2f4ac23397f8f to your computer and use it in GitHub Desktop.
numChars.hs
Prelude Data.List> numChars s c = foldr (\x acc -> if x == c then acc+1 else acc) 0 s
Prelude Data.List> numChars "oh heavens" 'h'
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment