Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 12 lines (9 sloc) 245 Bytes
#!/usr/bin/env runhaskell
import Data.List
main = interact f
f :: String -> String
f s = show harmonic_mean
where
nums = [read l :: Double | l <- lines s, l /= ""]
n = genericLength nums
harmonic_mean = n / sum (map (1.0/) nums)