Rational sequence

2002-10-22 Thread Ferenc Wagner
With GHC-5.02.2, I do $ ghci Prelude :m Ratio Ratio [1%2..10%2] [1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2] The question is, why is there 11%2 at the end of the list? It's inconsistent with the (good) rules for Integer, since Ratio [1,3..10] [1,3,5,7,9] Is this intentional?

Re: Rational sequence

2002-10-22 Thread Alastair Reid
Ferenc Wagner [EMAIL PROTECTED] writes: $ ghci Prelude :m Ratio Ratio [1%2..10%2] [1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2] H, the CVS copy of Hugs seems to suffer from a different problem: Prelude [0.5,1.5..5.5]::[Rational] [0 % 1,1 % 1,2 % 1,3 % 1,4 % 1,5 % 1] I'm expecting to see: [1 %

Re: Rational sequence

2002-10-22 Thread Jerzy Karczmarczuk
Alastair Reid: Ferenc Wagner [EMAIL PROTECTED] writes: H, the CVS copy of Hugs seems to suffer from a different problem: Prelude [0.5,1.5..5.5]::[Rational] [0 % 1,1 % 1,2 % 1,3 % 1,4 % 1,5 % 1] I'm expecting to see: [1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2] Rationals in Hugs were

RE: Rational sequence

2002-10-22 Thread Simon Peyton-Jones
The Report says that the Enum instance for Ratio uses the same rule as for Float/Double, namely that [a..b] means takeWhile (= (b+1/2)) [a, a+1, a+2, ...] You may say that the = should be but that's what the Report says. Certainly if you do [1%3..10%3] you'll get more values

Re: Rational sequence

2002-10-22 Thread Ferenc Wagner
Simon Peyton-Jones [EMAIL PROTECTED] writes: The Report says that the Enum instance for Ratio uses the same rule as for Float/Double, Now I can see that the revised Report contains more about this than the one on haskell.org. But I still can't see the statement you cited above. Where should

Re: Rational sequence

2002-10-22 Thread Alastair Reid
Jerzy Karczmarczuk [EMAIL PROTECTED] writes: Rationals in Hugs were always a bit obscure. What do you think, what is the Rational form of 2.3 ? (GHCi says 23/10). The answer is: 2589569785738035 % 1125899906842624 (Old Hugs, Feb. 2001) I'm afraid the new release won't fix this. Once

Re: Rational sequence

2002-10-22 Thread Frank Atanassow
Jerzy Karczmarczuk wrote (on 22-10-02 13:05 +0200): What do you think, what is the Rational form of 2.3 ? (GHCi says 23/10). The answer is: 2589569785738035 % 1125899906842624 Er, why? Because 2.3 is not representable using a double precision float or something? -- Frank

Re: representation getting verbose...

2002-10-22 Thread haskell-cafe-admin
Thanks for your reply... Paul Hudak [EMAIL PROTECTED] writes: case expr of C f - ... V (Variable (VVariable s)) - ... ... I think you mean: case expr of C f - ... V (VVariable s) - ... which is not quite as verbose. Yes, I think I should have checked my

SOE exercise

2002-10-22 Thread Isaac Jones
(I'm not sure why my postings seem somewhat anonymous, I'll mess with the headers in this post to see if that fixes it. I post to other mailman lists and haven't noticed this problem.) I'm working through Paul Hudak's SOE, and have a question about problem 9.4, which is to define a function

Re: SOE exercise

2002-10-22 Thread Hal Daume III
applyEach [(+1), (+3), (+2)] 1 = [2,4,3] :: [Integer] applyEach' :: [a-b] - a - [b] applyEach' funs x = map applyx funs where applyx (fun) = fun x ...or more simply: applyEach' l x = map ($x) l ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Re: Rational sequence

2002-10-22 Thread Frank Atanassow
Frank Atanassow wrote (on 22-10-02 15:08 +0200): Jerzy Karczmarczuk wrote (on 22-10-02 13:05 +0200): What do you think, what is the Rational form of 2.3 ? (GHCi says 23/10). The answer is: 2589569785738035 % 1125899906842624 Er, why? Because 2.3 is not representable using a

Odd Performance

2002-10-22 Thread Tom Pledger
Tim Otten writes: : | Can anyone suggest why the tighter algorithm exhibits significantly | worse performance? Is takeWhile significicantly more expensive than | take? No. | Is the \z lambda expression expensive? No. | The intsqrt isn't recalculated each time takeWhile evalutes a |

Odd Performance

2002-10-22 Thread Tom Pledger
Tom Pledger writes: | Tim Otten writes: | : | | Can anyone suggest why the tighter algorithm exhibits significantly | | worse performance? Is takeWhile significicantly more expensive than | | take? | | No. Correction (before anyone else pounces on it): Only if the predicate function

Re: representation getting verbose...

2002-10-22 Thread Claus Reinke
Variable (VVariable(varName, (Value (Number (NNumber (varValue, varDimension)) Here VVariable and NNumber are newtype constructors of tuples, and the entire expression is an Expression which, among other things has: data Expression = Value

Re: representation getting verbose...

2002-10-22 Thread Andrew J Bromage
G'day all. On Thu, Oct 17, 2002 at 11:08:57AM -0400, [EMAIL PROTECTED] wrote: For an interpreter I'm writing, I found myself writing a function constructVarExpr :: String - Expr just to make it easier. As an alternative opinion, I don't think there's anything wrong with this. A constructor

using IOExts...

2002-10-22 Thread Jason Smith
Hi All I don't know what I'm doing wrong here but for some reason no matter what esoteric command line option I seem to be able to dream up I can get ghc to include IOExts..I want to use the side-affect IO commands but cannot. I am using ghc-5.02.2for Win32. Can someone just give me a