varikvalefor,

root@nerva:~# cat /root/prgs/horatio-ratio.hs
import Control.Monad;
import System.Environment;

blah :: Bool -> [String] -> (Int, Int, Int, Int);
blah _ [] = (0 , 0, 0, 0);
blah _ ("\begin{code}" : xs) = blah True xs;
blah _ ("\end{code}" : xs) = blah False xs;
blah True (t : xs) = addCode $ blah True xs
where {
addCode (a , b , c , d) = (a, b+1, c, d + length t);
}
blah False (t : xs) = addNot $ blah False xs
where {
addNot (a, b, c, d) = (a + 1, b, c + length t, d);
}

main = (>>=) getArgs $ mapM $ readFile >=> print . blah False . lines;

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • provamag3
  • everett
  • cisconetworking
  • Leos
  • normalnudes
  • cubers
  • modclub
  • ngwrru68w68
  • tacticalgear
  • megavids
  • anitta
  • tester
  • JUstTest
  • lostlight
  • All magazines