Created
April 28, 2015 01:25
-
-
Save hernantz/63a48b689736f6131940 to your computer and use it in GitHub Desktop.
Some homework on learning haskell
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
-- repeat | |
rep :: Int -> x -> [x] | |
rep 0 x = [] | |
rep n x = [x] ++ rep (n-1) x | |
-- get value at | |
at :: [x] -> Int -> x | |
at (x:xs) 0 = x | |
at (x:xs) n = at (xs) (n-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment