Question : first element in list haskell
Answered by : hippoerror
list = [1, 2, 3]
head :: [a] -> a
head (x:_) = x
head list -- 1
Source : | Last Update : Sun, 25 Oct 20
Question : haskell append to list
Answered by : yeah-tiger
1 : [2, 3]
--return [1, 2, 3]
Source : | Last Update : Wed, 04 Nov 20
Question : haskell access list element
Answered by : therealcb
--Haskell Lists' are 0 based
--Let xs be a list from where we want the n-th element
?> xs !! n
--Example
?> [1, 2, 3] !! 1
?> 2
Source : | Last Update : Thu, 10 Mar 22