Re: [Haskell-cafe] Re: Software Tools in Haskell

2007-12-15 Thread Bulat Ziganshin
Hello apfelmus, Saturday, December 15, 2007, 12:51:39 PM, you wrote: >> countWords = countChar ' ' this is number of spaces not words -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-

[Haskell-cafe] Re: Software Tools in Haskell

2007-12-15 Thread apfelmus
Benja Fallenstein wrote: Henning Thielemann wrote: I remember there was a discussion about how to implement full 'wc' in an elegant but maximally lazy form, that is counting bytes, words and lines in one go. Did someone have a nice idea of how to compose the three counters from implementations o

[Haskell-cafe] Re: Software Tools in Haskell

2007-12-13 Thread apfelmus
Tommy M McGuire wrote: apfelmus wrote: tabwidth = 4 -- tabstop !! (col-1) == there is a tabstop at column col -- This is an infinite list, so no need to limit the line width tabstops = map (\col -> col `mod` tabwidth == 1) [1..] -- calculate spaces needed to fill to the n

Re: [Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread Conal Elliott
Since there are many useful per-line functions, do a little refactoring, placing the following into a library: perLine :: (String -> String) -> (String -> String) perLine f = unlines . map f . lines On Dec 12, 2007 12:43 PM, apfelmus <[EMAIL PROTECTED]> wrote: > Tommy M McGuire wrote: > > (

Re: [Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread Tommy M McGuire
apfelmus wrote: Tommy M McGuire wrote: (Plus, interact is scary. :-D ) You have a scary feeling for a moment, then it passes. ;) tabwidth = 4 -- tabstop !! (col-1) == there is a tabstop at column col -- This is an infinite list, so no need to limit the line width tabstops =

[Haskell-cafe] Re: Software Tools in Haskell

2007-12-12 Thread apfelmus
Tommy M McGuire wrote: (Plus, interact is scary. :-D ) You have a scary feeling for a moment, then it passes. ;) Gwern Branwen wrote: I... I want to provide a one-liner for 'detab', but it looks impressively monstrous and I'm not sure I understand it. On the other hand, I'm not looking for