summaryrefslogtreecommitdiff
path: root/h3.hs
blob: 7c8604d80003725bd8a438b278f6365fb5406325 (plain)
1
2
3
4
5
6
7
elementAt :: [a] -> Integer -> Maybe a

elementAt [] _ = Nothing
elementAt (x:xs) 1 = Just x
elementAt (x:xs) n
    | n>1 = elementAt xs (n-1)
    | otherwise = Nothing