Hello John,

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

JM>  grep -o ' [-+.*/[EMAIL PROTECTED] ' 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:[EMAIL PROTECTED]



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to