Skip to content

Instantly share code, notes, and snippets.

@hernantz
Created April 28, 2015 01:25
Show Gist options
  • Save hernantz/63a48b689736f6131940 to your computer and use it in GitHub Desktop.
Save hernantz/63a48b689736f6131940 to your computer and use it in GitHub Desktop.
Some homework on learning haskell
-- 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