File size distribution: Difference between revisions
Content added Content deleted
(added Haskell) |
|||
Line 391:
</pre>
=={{header|Haskell}}==
Uses grouped frequency distribution. Program arguments include directory and frequency distribution group size. Distribution groups of 0 are removed.
<lang haskell>{-# LANGUAGE TupleSections #-}
Line 434:
displaySize n
| n <= 2^10 = show n <> "B"
| n >= 2^10 && n <= 2^20 =
| n >= 2^20 && n <= 2^30 =
| n >= 2^30 && n <= 2^40 =
| n >= 2^40 && n <= 2^50 =
| otherwise = "Too large!"
where
f suffix = (<> suffix) . show . round . (realToFrac n /)
collectItems :: FilePath -> IO [Item]
Line 494 ⟶ 496:
156MB <-> 195MB = 1
352MB <-> 391MB = 1</pre>
=={{header|Julia}}==
{{works with|Julia|0.6}}
|