ref: 47235546ec225eb4885bb9793b84d2f2df73dc45
parent: 1f8978838ef1ce72ffe14ec5844a698ce98dce11
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Thu Sep 21 20:05:56 EDT 2023
Improve statistics tool.
--- a/Tools/Stats.hs
+++ b/Tools/Stats.hs
@@ -10,7 +10,11 @@
loop m "" = m
loop m cs@(_:ds) | Just (x,y) <- getComb cs = loop (M.insertWith (+) x 1 m) y
| otherwise = loop m ds
- getComb ('(':'$':cs) = Just ('$':xs, tail ys) where (xs, ys) = span (/= ')') cs+ getComb ('(':'$':cs) = --Just ('$':xs, tail ys) where (xs, ys) = span (/= ')') cs+ let (k1, r) = span (/= ' ') cs
+ in case r of
+ ' ':'$':s -> let (k2, t) = span (/= ')') s in Just ("($" ++ k1 ++ " $" ++ k2 ++ ")", tail t)+ _ -> Nothing
getComb _ = Nothing
srt = sortBy (compare `on` snd) $ M.toList res
mapM print srt
--
⑨