Last active
September 14, 2019 10:19
-
-
Save perjerz/c6f5b6c400686cea85d2e056c0044c77 to your computer and use it in GitHub Desktop.
Mathematics for Programmers Exercises by Ajarn Dave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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