Jump to content

File size distribution: Difference between revisions

m
Line 473:
displaySize :: Integer -> String
displaySize n
| n <= 2^10 n <= 2^10 = show n <> "B"
| n >= 2^10 && n <= 2^20 = display "KB" $ 2^10
| n >= 2^20 && n <= 2^30 = display "MB" $ 2^20
Line 496:
displayFrequency :: Integer -> FrequencyGroup -> IO ()
displayFrequency filesCount ((min, max), count) =
printf "%5s <-> %5s = %5d %56.2f3f%%: %-5s\n"
(displaySize min)
(displaySize max)
Line 505:
percentage :: Double
percentage = (realToFrac count / realToFrac filesCount) * 100
bars = replicate (round $ percentage * 4) '█' -- % of 25% (max group size)
 
parseArgs :: [String] -> Either String (FilePath, Int)
Line 564:
 
Distribution:
0B <-> 83B = 43580 10.093%: ████████████████████████████████████████
0B <-> 83B = 43580 10.09%: ██████████
84B <-> 167B = 40942 9.48482%: ███████████████████████████████████████████████
168B <-> 251B = 24867 5.76759%: █████████████████████████████
252B <-> 335B = 20019 4.64636%: ████████████████████████
336B <-> 419B = 15623 3.62618%: ████ ██████████████
420B <-> 503B = 13403 3.10104%: ███ ████████████
504B <-> 587B = 12778 2.96959%: ███ ████████████
588B <-> 671B = 12125 2.81808%: ███ ███████████
672B <-> 755B = 12736 2.95950%: ███ ████████████
756B <-> 839B = 9565 2.22215%: ██ █████████
826B <-> 2KB = 83110 19.247%: █████████████████████████████████████████████████████████████████████████████
826B <-> 2KB = 83110 19.25%: ███████████████████
2KB <-> 2KB = 34092 7.90895%: ████████████████████████████████████████
2KB <-> 3KB = 20814 4.82820%: ████████████████████████
3KB <-> 4KB = 15088 3.49494%: ███ ██████████████
4KB <-> 5KB = 10327 2.39392%: ██ ██████████
5KB <-> 6KB = 7608 1.76762%: ██ ███████
6KB <-> 6KB = 6260 1.45450%: ██████
6KB <-> 7KB = 4562 1.06057%: ████
7KB <-> 8KB = 3894 0.90902%: ████
8KB <-> 16KB = 18833 4.36362%: ████ █████████████████
16KB <-> 24KB = 6188 1.43433%: ██████
24KB <-> 32KB = 3342 0.77774%: ███
32KB <-> 40KB = 2100 0.49486%: ██
40KB <-> 48KB = 1447 0.34335%:
48KB <-> 56KB = 966 0.22224%:
56KB <-> 64KB = 726 0.17168%:
64KB <-> 72KB = 852 0.20197%:
72KB <-> 81KB = 563 0.13130%:
81KB <-> 161KB = 2368 0.55548%: ██
161KB <-> 242KB = 967 0.22224%:
242KB <-> 322KB = 558 0.13129%:
322KB <-> 403KB = 287 0.07066%:
403KB <-> 483KB = 176 0.04041%:
483KB <-> 564KB = 100 0.02023%:
564KB <-> 644KB = 77 0.02018%:
644KB <-> 725KB = 101 0.02023%:
725KB <-> 805KB = 77 0.02018%:
815KB <-> 2MB = 282 0.07065%:
2MB <-> 2MB = 123 0.03028%:
2MB <-> 3MB = 74 0.02017%:
3MB <-> 4MB = 59 0.01014%:
4MB <-> 5MB = 26 0.01006%:
5MB <-> 6MB = 17 0.00004%:
6MB <-> 6MB = 20 0.00005%:
6MB <-> 7MB = 7 0.00002%:
7MB <-> 8MB = 6 0.00001%:
8MB <-> 16MB = 23 0.01005%:
16MB <-> 24MB = 10 0.00002%:
24MB <-> 32MB = 9 0.00002%:
32MB <-> 40MB = 4 0.00001%:
40MB <-> 49MB = 5 0.00001%:
73MB <-> 81MB = 3 0.00001%:
98MB <-> 196MB = 8 0.00002%:
294MB <-> 392MB = 1 0.00000%: </pre>
 
=={{header|Julia}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.