Intro to Haskell Flashcards
what is qsorts type? (in Haskell and in layman’s terms)
qsort :: Ord a => [a] -> [a]
for any type a of ordered values, qsort maps a list of such values to another.
what is the universal type in fp?
lists
describe the tail function in fp
tail[1, 2, 3]
[2, 3]
describe the !! function in fp
[1, 2, 3, 4] !! 2
3
describe the take function in fp
take 3 [1, 2, 3, 4, 5]
[1, 2, 3]
describe the drop function in fp
drop 3 [1, 2, 3, 4, 5]
[4, 5]
describe the length function in fp
length [1, 2, 3, 4]
4
describe the sum function in fp
sum [1, 2, 3, 4, 5]
15
describe the product function in fp
product [1 .. 5]
120
describe the ++ function in fp
[1, 2] ++ [3, 4]
[1, 2, 3, 4]
describe the reverse function in fp
reverse[1, 2, 3]
[3, 2, 1]
what is the highest priority in Haskell?
function application
what suffic do Haskell files use?
.hs
how would you write an infinite list?
[1 ..]
what is the naming convention for functions and arguments?
they must begin with a lower case character