Isn't this tail recursive?

Hal Daume III hdaume@ISI.EDU
Sun, 10 Mar 2002 18:38:54 -0800 (PST)


I don't think it's an issue of it being a tail call; i think it's just too
lazy.

>                     Normal  -> countAll' cs 0 nl (nw + newWord) (nc + 1)
>                     White   -> countAll' cs 1 nl nw (nc + 1)
>                     Newline -> countAll' cs 1 (nl + 1) nw (nc + 1)


make this something like

...

  Normal -> nw' `seq` nc' `seq` countAll' cs 0 nl nw' nc'
  White  -> nc' `seq`           countAll' cs 1 nl nw  nc'
  Newline-> nl' `seq` nc` `seq` countAll' cs 1 nl' nw nc'
    where nw' = nw + newWord
          nc' = nc + 1
          nl' = nl + 1

...

or something.  I'm not entirely sure but it's worth a shot.

 - Hal