Re: [Haskell-cafe] Re: Haskell and C++ program

2009-01-19 Thread S. Doaitse Swierstra
On 17 jan 2009, at 22:22, Derek Elkins wrote: On Thu, 2009-01-15 at 13:40 +0100, Apfelmus, Heinrich wrote: Eugene Kirpichov wrote: Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. Oops. That's because my assertion show . read = id is

Re: [Haskell-cafe] Re: Haskell and C++ program

2009-01-19 Thread Derek Elkins
On Mon, 2009-01-19 at 22:12 -0500, S. Doaitse Swierstra wrote: On 17 jan 2009, at 22:22, Derek Elkins wrote: On Thu, 2009-01-15 at 13:40 +0100, Apfelmus, Heinrich wrote: Eugene Kirpichov wrote: Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect

Re: [Haskell-cafe] Re: Haskell and C++ program

2009-01-17 Thread Derek Elkins
On Thu, 2009-01-15 at 13:40 +0100, Apfelmus, Heinrich wrote: Eugene Kirpichov wrote: Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. Oops. That's because my assertion show . read = id is wrong. We only have read . show = id

[Haskell-cafe] Re: Haskell and C++ program

2009-01-15 Thread Apfelmus, Heinrich
Jonathan Cast wrote: reverseDouble = unlines . intro . map show . reverse . map (read :: String - Double) . takeWhile (/= end) . words where intro l = (read ++ show (length l) ++ elements) : elements in reversed

Re: [Haskell-cafe] Re: Haskell and C++ program

2009-01-15 Thread Eugene Kirpichov
Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. 2009/1/15 Apfelmus, Heinrich apfel...@quantentunnel.de: Jonathan Cast wrote: reverseDouble = unlines . intro . map show . reverse . map (read :: String -

[Haskell-cafe] Re: Haskell and C++ program

2009-01-15 Thread Apfelmus, Heinrich
Eugene Kirpichov wrote: Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. Oops. That's because my assertion show . read = id is wrong. We only have read . show = id show . read = id (in the less defined than sense) Regards, H.

Re[2]: [Haskell-cafe] Re: Haskell and C++ program

2009-01-15 Thread Bulat Ziganshin
Hello Eugene, Thursday, January 15, 2009, 3:27:59 PM, you wrote: but at least length.map show is eq to length :) Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. 2009/1/15 Apfelmus, Heinrich apfel...@quantentunnel.de: Jonathan Cast wrote: