Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Exercise
--ghc 7.10 import Data.List (transpose) generateList xs = map (\x -> case () of _ | x >= (xs !! 0) && x < (xs !! 1) -> 1 | otherwise -> 0) [9..17] calculate xs = [length [x | x <- list, x >= 2, x < 4], length $ filter (>=4) list] where list = map sum . transpose $ map generateList xs main = do print $ calculate [[9,10], [9,12]] print $ calculate [[9,10], [9,12], [13,15], [10,18]] print $ calculate [[9,11], [12,14], [13,15], [11,18], [14,18], [10,14], [15,18]] print $ calculate [[9,10], [9,12], [14,15], [16,18], [14,18], [10,13], [15,18], [10,14], [9,13]] print $ calculate [[9,14],[15,17],[12,13],[16,18],[10,15],[14,16],[9,13],[9,15]]
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Invert a monotonic function
project euler 1, haskel
Fibonacci proof
haskell linked list
Factors of a number, prime numbers
Semilattice
haskell_exam
Reader
credit card number validator
Modeling algebraic understanding with Haskell in KS1
stackse - search stackoverflow differently
Please log in to post a comment.