diff options
Diffstat (limited to 'p3.hs')
-rw-r--r-- | p3.hs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -0,0 +1,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 |