File size distribution: Difference between revisions

m
m (→‎{{header|Haskell}}: increase the precision when displaying file sizes)
Line 511:
| otherwise = printf "%8dB " n
where
-- display suffix = (<> suffix) . show . (realToFrac n /)
display :: Double -> String -> String
display b = printf "%7.2f%s " (realToFrac n / b)
Line 581 ⟶ 580:
printf "Total size: %s\n" $ displaySize $ totalBytes items
putStrLn "\nDistribution:\n"
printf "%9s <-> %9s %7s\n" "From" "To" "Count"
putStrLn $ replicate 4546 '-'
let results = expandedGroups groupSize (sizes items) (groupThreshold fileCount) items
-- let results = initialGroups groupSize items
Line 593 ⟶ 592:
expandGroups gsize sizes n . initialGroups gsize</lang>
{{out}}
<pre style="height: 50rem;">$ filedist ~/Music 1 ↵
Using 4 worker threads
Total files: 688
Line 601 ⟶ 600:
Distribution:
 
From <-> To Count
----------------------------------------------
0B <-> 80B = 7 1.017%: █
81B <-> 161B = 74 10.756%: ███████████
Line 625 ⟶ 624:
6.67MB <-> 13.33MB = 72 10.465%: ██████████
13.33MB <-> 20.00MB = 6 0.872%: █
20.00MB <-> 26.66MB = 1 0.145%:
 
$ filedist ~/Music 10
Using 4 worker threads
Total files: 688
Line 635 ⟶ 634:
Distribution:
 
From <-> To Count
----------------------------------------------
0B <-> 88B = 7 1.017%: █
89B <-> 177B = 75 10.901%: ███████████
Line 669 ⟶ 668:
13.33MB <-> 16.00MB = 3 0.436%:
16.00MB <-> 18.67MB = 3 0.436%:
24.00MB <-> 26.66MB = 1 0.145%:
</pre>
 
Anonymous user