mirror of
https://git8.cs.fau.de/theses/bsc-leon-vatthauer.git
synced 2024-05-31 07:28:34 +02:00
13 lines
237 B
Haskell
13 lines
237 B
Haskell
hd :: [a] -> a
|
|
hd [] = error "empty list"
|
|
hd (x : _) = x
|
|
|
|
main :: IO ()
|
|
main = do
|
|
print (Main.reverse ([1,2,3]::[Int]))
|
|
print (hd []::[String])
|
|
|
|
reverse :: [a] -> [a]
|
|
reverse = reverseAcc []
|
|
where
|
|
reverseAcc = foldl (flip (:))
|