Question: Can't get my haskell program to work sort [] = [] sort (x:xs) = sort [a | a
Can't get my haskell program to work
sort [] = [] sort (x:xs) = sort [a | a <- xs , a<=x ] ++ [x] ++ sort [a | a <- xs , a > x]
getList:: Int->[IO Int] getList 0 = [] --declaring the empty list getList n = [a | a <- [getNumber] ] ++ getList (n-1)
getNumber::IO Int --get number function getNumber = do s <- getLine return (read s) --Main function to handle main = do p <- getNumber -- taking the number of variable lst <- sequence (getList p) --calling gtlistFunction to input the list print (sort lst) --print
quicksort.hs:13:6: error: parse error on input `=' Perhaps you need a 'let' in a 'do' block? e.g. 'let x = 5' instead of 'x = 5' | 13 | main = do | ^
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
