diff options
author | Determinant <ted.sybil@gmail.com> | 2017-05-28 18:19:31 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2017-05-28 18:19:31 -0400 |
commit | afae39a832fbdf0f5bf67e20cac7bdf224b0a290 (patch) | |
tree | 34e472ec0de24fab26e064628025cb2ece798bc5 /1-10/3.hs |
init
Diffstat (limited to '1-10/3.hs')
-rw-r--r-- | 1-10/3.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/1-10/3.hs b/1-10/3.hs new file mode 100644 index 0000000..660ae64 --- /dev/null +++ b/1-10/3.hs @@ -0,0 +1,5 @@ +elementAt [] _ = error "out of range" +elementAt (x:_) 1 = x +elementAt (_:xs) k + | k < 1 = error "out of range" -- deal with the infinite list + | otherwise = elementAt xs (k - 1) |