[Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

Bulat Ziganshin bulatz at HotPOP.com
Sat Nov 19 04:36:44 EST 2005


Hello John,

Saturday, November 19, 2005, 2:25:47 AM, you wrote:

JM>  grep -o ' [-+.*/=^$#@!%]+ ' GenUtil.hs | sort | uniq -c | sort -n
JM>      30  .

JM> one of the most common operators.

especially in comments ;)  add the following filter to strip them:

import System.Environment

main = interact (noStream.(unlines.map noEnd.lines))

noStream ('{':'-':xs) = noInStream xs
noStream (c:xs)       = c:noStream xs
noStream ""           = ""

noInStream ('-':'}':xs) = noStream xs
noInStream (_:xs)       = noInStream xs
noInStream ""           = ""

noEnd ('-':'-':xs) = ""
noEnd (c:xs)       = c:noEnd xs
noEnd ""           = ""


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list