You are viewing a single comment's thread. Return to all comments →
In Haskell, map (flip filter list) on a list of predicates is kinda neat.
map (flip filter list)
import Text.Printf import Data.List (genericLength) main = do len <- readLn :: IO Float list <- fmap (map (read :: String -> Int) . words) getLine mapM_ (printf "%.6f\n" . (/len) . genericLength . flip filter list) [(>0), (<0), (==0)]
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
In Haskell,
map (flip filter list)
on a list of predicates is kinda neat.