mirror of
https://git8.cs.fau.de/theses/bsc-leon-vatthauer.git
synced 2024-05-31 07:28:34 +02:00
14 lines
281 B
Haskell
14 lines
281 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 l = reverseAcc l []
|
|
where
|
|
reverseAcc [] a = a
|
|
reverseAcc (x:xs) a = reverseAcc xs (x:a)
|