You are viewing a single comment's thread. Return to all comments →
The generate code by HR is bad. Haskell is a functional programming language and it should be a declarative style rather than imperative.
for example this processes whole input like a stream. Betpkr Much more elegant.
filterIt :: [Int] -> [String] filterIt (a:xs) = map show $ filter (\x -> x < a) xs
main = interact $ unlines . filterIt. map read. words
Seems like cookies are disabled on this browser, please enable them to open this website
Filter Array
You are viewing a single comment's thread. Return to all comments →
The generate code by HR is bad. Haskell is a functional programming language and it should be a declarative style rather than imperative.
for example this processes whole input like a stream. Betpkr Much more elegant.
filterIt :: [Int] -> [String] filterIt (a:xs) = map show $ filter (\x -> x < a) xs
main = interact $ unlines . filterIt. map read. words