On Dec 13, 2007 2:20 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote: > Another version of detab: > > main = interact $ perLine $ concat . snd. mapAccumL f 0 where > f tab '\t' = (0, replicate (4-tab) ' ') > f tab char = ((tab+1) `mod` 4, [char])
Although on reflection, I think I might like the following compromise with Tillmann's version best: main = interact $ perLine $ detab 0 where detab tab ('\t':cs) = replicate (4-tab) ' ' ++ detab 0 cs detab tab (char:cs) = char : detab ((tab+1) `mod` 4) cs detab tab "" = "" - Benja _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe