Skip to content

Instantly share code, notes, and snippets.

@perjerz
Last active September 14, 2019 10:19
Show Gist options
  • Save perjerz/c6f5b6c400686cea85d2e056c0044c77 to your computer and use it in GitHub Desktop.
Save perjerz/c6f5b6c400686cea85d2e056c0044c77 to your computer and use it in GitHub Desktop.
Mathematics for Programmers Exercises by Ajarn Dave
Prelude> countWords s = length(Data.List.nub(words s))
Prelude> countWords "This is a cat this is a rat"
6
isPalindrome a = a == reverse a
isPalindrome "2"
Prelude> isPalindrome "233"
False
mkSequence start end step = [start,step..end]
Prelude> mkSequence 1 10 4
makePalindrome xs = xs ++ (tail (reverse xs))
makePalindrome [1,2,3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment