Browse Source

Problem 03

completed
Craige McWhirter 7 months ago
parent
commit
8562287bd4
Signed by: craige GPG Key ID: 7DBA9F5689EFB6AA
  1. 10
      elementAt.hs

10
elementAt.hs

@ -0,0 +1,10 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- Find the K'th element of a list. The first element in the list is number 1
-- !!: accepts a list and an integer and returns the item in the list at integer
-- position. The numbering starts with 0.
elementAt :: [a] -> Int -> a
elementAt list i = list !! (i-1)
Loading…
Cancel
Save