Re: [Haskell-cafe] Haskell syntax inside QuasiQuote

2008-10-27 Thread Reiner Pope
I've tried it out and it looks good so far. I had to fiddle with haskell-src-ext's .cabal file to get it to install with GHC 6.10, which is surprising since it isn't listed as a broken package... ah well. I'm able to write code like this now: > foo x = [$vec|sin x, myFunc x, 4*5|] Since Haskell

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
Daniel Fischer <[EMAIL PROTECTED]> wrote: > Am Montag, 27. Oktober 2008 13:34 schrieb Achim Schneider: > > > > > > Who does such horrible things? > > > Repeat after me: 1 is NOT a prime. Never, under no circumstances. > > > > Then chase it out of your prime factor products. You'd be the first > >

Re: [Haskell-cafe] using ghc as a library

2008-10-27 Thread Anatoly Yakovenko
On Mon, Oct 27, 2008 at 3:23 PM, Thomas Schilling <[EMAIL PROTECTED]> wrote: > Not at the moment. I was thinking about abstracting out the finder, > which might be useful for other things, too. Can you maybe describe > your actual goal? Adding an import "foo/bar" would not parse, so you > must h

Re: [Haskell-cafe] Cabal and GHCi

2008-10-27 Thread Reiner Pope
On Tue, Oct 28, 2008 at 2:23 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > reiner.pope: >>Hi, >> >>Is there a way to use GHCi with code which is cabal-buildable but not "ghc >>--make"-able? The emacs haskell-mode makes a pretty good guess by :cd-ing >>into the directory with the .ca

Re: [Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Richard O'Keefe
On 28 Oct 2008, at 3:51 pm, Derek Elkins wrote: Some variation on a module then: http://en.wikipedia.org/wiki/Module_(mathematics) When you have M acting on X and X is an abelian group: M is a field => vector space M is a ring => module M is a semiring => module over a semiring M is

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Aaron Denney
On 2008-10-27, Bart Massey <[EMAIL PROTECTED]> wrote: > Peter Gavin gmail.com> writes: >> The reason for doing it this way is that e.g. 2.5 is >> exactly between 2 and 3, and rounding *up* every time >> would cause an uneven bias toward 3. To counteract that >> effect, rounding to the nearest eve

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread Jefferson Heard
By the way, T, feel free to lean on me if you run into any problems. I did something along the lines of what you were describing some time ago, my particular non-linear transform being converting a vertex array to/from polar coordinates and updating in realtime. -- Jeff On Tue, Oct 28, 2008 at 12

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread T Willingham
On Mon, Oct 27, 2008 at 11:04 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > It depends on the operations (safe indexing or unsafe indexing). > Being strict or unboxed doesn't determine the safety. OK, that makes sense. This is a huge load off my conscience. I can now dig into Real World Haskell w

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Bart Massey
Peter Gavin gmail.com> writes: > The reason for doing it this way is that e.g. 2.5 is > exactly between 2 and 3, and rounding *up* every time > would cause an uneven bias toward 3. To counteract that > effect, rounding to the nearest even integer is used, > which causes the half of the x.5 values

Re: [Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Derek Elkins
On Tue, 2008-10-28 at 15:43 +1300, Richard O'Keefe wrote: > On 28 Oct 2008, at 2:54 pm, Derek Elkins wrote: > > > On Tue, 2008-10-28 at 13:54 +1300, Richard O'Keefe wrote: > >> Is there a special name for an operator monoid where the > >> structure that's acted on is an Abelian group? > > > > This

Re: [Haskell-cafe] Cabal and GHCi

2008-10-27 Thread Don Stewart
reiner.pope: >Hi, > >Is there a way to use GHCi with code which is cabal-buildable but not "ghc >--make"-able? The emacs haskell-mode makes a pretty good guess by :cd-ing >into the directory with the .cabal file; however, if there is a different >source-dir this doesn't work s

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread Don Stewart
t.r.willingham: > On Mon, Oct 27, 2008 at 10:07 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > > > > Seems fine. You'll be working at a low level, with strict, mutable, > > unboxed data structures, but that's fine: the machine loves them. > > > > Thanks for the quick reply. One last question -- is

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread T Willingham
On Mon, Oct 27, 2008 at 10:07 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > > Seems fine. You'll be working at a low level, with strict, mutable, > unboxed data structures, but that's fine: the machine loves them. > Thanks for the quick reply. One last question -- is it at all possible to segfault

[Haskell-cafe] Re: [darcs-users] Poll: Do you need to be able to build darcs from source on GHC 6.6?

2008-10-27 Thread Matthias Kilian
On Mon, Oct 27, 2008 at 07:24:31PM -0700, Jason Dagit wrote: > I would like to find out if any darcs users who build from the source > are still using ghc 6.6? > > If you are such a user, please let me know. Yep. OpenBSD is still at ghc-6.6. Ciao, Kili -- Trust your brain, not the mach

Re: [Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Derek Elkins
On Tue, 2008-10-28 at 15:43 +1300, Richard O'Keefe wrote: > On 28 Oct 2008, at 2:54 pm, Derek Elkins wrote: > > > On Tue, 2008-10-28 at 13:54 +1300, Richard O'Keefe wrote: > >> Is there a special name for an operator monoid where the > >> structure that's acted on is an Abelian group? > > > > This

Re: [Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Richard O'Keefe
On 28 Oct 2008, at 2:54 pm, Derek Elkins wrote: On Tue, 2008-10-28 at 13:54 +1300, Richard O'Keefe wrote: Is there a special name for an operator monoid where the structure that's acted on is an Abelian group? This should just be equivalent to a ring, maybe without distributivity. Maybe m

[Haskell-cafe] Problems building HOC

2008-10-27 Thread Colin Fleming
Hi all, I'm trying to get HOC to build because I'd like to take Yi for a spin and see how it works. I followed the instructions in the Yi README, but I can't get HOC to build. It seems like HOC is under pretty heavy development right now, so maybe this is something transient. I didn't build libffi

[Haskell-cafe] Poll: Do you need to be able to build darcs from source on GHC 6.6?

2008-10-27 Thread Jason Dagit
Hello, I would like to find out if any darcs users who build from the source are still using ghc 6.6? If you are such a user, please let me know. Thanks, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listin

Re: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread Don Stewart
t.r.willingham: >As my first Haskell exposure, I've been working through Real World >Haskell. > >I am considering converting some of my C++ graphics libraries to >Haskell. I've done a fair amount of googling on the subject, however >I haven't quite been able to find clear answ

[Haskell-cafe] Memory efficiency questions for real-time graphics

2008-10-27 Thread T Willingham
As my first Haskell exposure, I've been working through Real World Haskell. I am considering converting some of my C++ graphics libraries to Haskell. I've done a fair amount of googling on the subject, however I haven't quite been able to find clear answers to some of following issues. (1) Using

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Richard O'Keefe
On 28 Oct 2008, at 11:11 am, Henning Thielemann wrote: In measured data the .5-case should be very rare - a "null set"? However I assume that .5 happens more often in practice - because of prior rounding, Think about money. When I was a child, farthings (1/4 of a penny) had just been dropped

Re: [Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Derek Elkins
On Tue, 2008-10-28 at 13:54 +1300, Richard O'Keefe wrote: > Is there a special name for an operator monoid where the > structure that's acted on is an Abelian group? This should just be equivalent to a ring, maybe without distributivity. Maybe missing some other properties depending on what you me

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Richard O'Keefe
On 27 Oct 2008, at 11:00 pm, Henning Thielemann wrote: On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude> round 3.5 4 Prelude> round 2.5 2 Is there any explanation about that ? It's the definition we learnt in school ... Check http://en

RE: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread ajb
G'day all. Henning Thielemann suggested: In measured data the .5-case should be very rare - a "null set"? However I assume that .5 happens more often in practice - because of prior rounding, which was shown to be bad practice in this thread. The usual case in floating point is usually not

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread ajb
G'day all. Quoting Daniel Fischer <[EMAIL PROTECTED]>: Who does such horrible things? Repeat after me: 1 is NOT a prime. Never, under no circumstances. The definition of "prime" is well-understood standard terminology, but that doesn't escape the fact that it's arbitrary and human-defined. I

RE: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread ajb
G'day all. Quoting "Mitchell, Neil" <[EMAIL PROTECTED]>: With rounding to the nearest even integer for 0.5's you get 6, otherwise if you always round up you get 7. If you bias towards rounding up you get a general upwards trend as numbers are rounded, which is bad, while the even condition ensu

[Haskell-cafe] What's this algebraic structure called?

2008-10-27 Thread Richard O'Keefe
Is there a special name for an operator monoid where the structure that's acted on is an Abelian group? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-10-27 Thread David Waern
I think this is a bug in Haddock related to template-haskell declarations. It will hopefully be fixed soon, but I'm afraid it won't part of the 2.3.0 version that will come with GHC 6.10.1. David 2008/10/27 Leonidas Fegaras <[EMAIL PROTECTED]>: > > Sorry for the previous message. I am sending it

[Haskell-cafe] Problem with haddock 2.3.0 (again)

2008-10-27 Thread Leonidas Fegaras
Sorry for the previous message. I am sending it again. Dear fellow haskell programmers, I tried to install a package in hackageDB and got a strange error from haddock: haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing

[Haskell-cafe] Re: [Haskell] IORef sharing

2008-10-27 Thread Bulat Ziganshin
Hello Rodney, Tuesday, October 28, 2008, 1:27:26 AM, you wrote: > Now I define an IORef and a couple of counters that share > the IORef, >> iio :: IO (IORef Int) >> iio = newIORef 0 >> ic1 = do { io <- iio ; count io 0 } >> ic2 = do { io <- iio ; count io 0 } > So apparently my mental picture

Re: [Haskell-cafe] using ghc as a library

2008-10-27 Thread Thomas Schilling
Not at the moment. I was thinking about abstracting out the finder, which might be useful for other things, too. Can you maybe describe your actual goal? Adding an import "foo/bar" would not parse, so you must have some kind of preprocessing going on, so you might be able to insert some dummy im

Re: [Haskell-cafe] Problem with haddock 2.3.0

2008-10-27 Thread Miguel Mitrofanov
What the ..? Is that some sort of a virus? On 28 Oct 2008, at 01:05, Fegaras, Leonidas wrote: You have received a secure message Read your secure message by opening the attachment, securedoc.html. You will be prompted to open (view) the file or save (download) it to your computer. For bes

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, Janis Voigtlaender wrote: Lennart Augustsson wrote: I can't remember the method being called anything. It was just what we were being taught. With the obvious explanation that .5 is right in the middle so always going one way would introduce a bias. This was circa 1969.

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, Ketil Malde wrote: Of course, Haskell should discard the rather tasteless IEEE754 crud, and do its calculations on infinite streams of digits. Then, rounding upwards after 'take'ing a sufficient amount of decimals will be the right thing to do. When I implemented just th

Re: [Haskell-cafe] Haskell on the JVM

2008-10-27 Thread John A. De Goes
Please, oh please, get it into GHC Head! You'll be my hero. Regards, John A. De Goes N-BRAIN, Inc. http://www.n-brain.net [n minds are better than n-1] On Oct 27, 2008, at 3:02 PM, Brian Alliet wrote: On Mon, Oct 27, 2008 at 10:58:11AM +, Simon Peyton-Jones wrote: Is there an interest i

Re: [Haskell-cafe] Haskell on the JVM

2008-10-27 Thread David Leimbach
On Mon, Oct 27, 2008 at 12:02 PM, Brian Alliet <[EMAIL PROTECTED]> wrote: > On Mon, Oct 27, 2008 at 10:58:11AM +, Simon Peyton-Jones wrote: > > Is there an interest in hosting GHC on the JVM (besides my own). > > Yep. I wrote a JVM backend for GHC (LambdaVM). It is suffering from > bit-rot tho

Re: [Haskell-cafe] using ghc as a library

2008-10-27 Thread Anatoly Yakovenko
On Mon, Oct 27, 2008 at 3:27 AM, Thomas Schilling <[EMAIL PROTECTED]> wrote: > I'm not quite sure what you are trying to do. But for what it's > worth, you can load a specific file via > > setTarget [Target (TargetFile "foo/blah.hs") True Nothing] right, but I cant do that from inside a module i

Re: [Haskell-cafe] Haskell on the JVM

2008-10-27 Thread Brian Alliet
On Mon, Oct 27, 2008 at 10:58:11AM +, Simon Peyton-Jones wrote: > Is there an interest in hosting GHC on the JVM (besides my own). Yep. I wrote a JVM backend for GHC (LambdaVM). It is suffering from bit-rot though. I think this thread has re-spaked my interest in it though. > I don't think it

Re: [Haskell-cafe] strange ghc output

2008-10-27 Thread Dougal Stanton
On Mon, Oct 27, 2008 at 4:49 PM, brad clawsie <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > i have a small program i have been using routinely that has stopped > working. the last alteration of my install configuration was to upgrade > the haskell-feed package as

[Haskell-cafe] strange ghc output

2008-10-27 Thread brad clawsie
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 i have a small program i have been using routinely that has stopped working. the last alteration of my install configuration was to upgrade the haskell-feed package as arch linux recommended. here is the error i get: - - $ runghc newspage.hs GHC

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Peter Gavin
L.Guo wrote: Hi all: I just read about definitions of Prelude [1], and noticing that. In 6.4.6 Coercions and Component Extraction, it discribes like this: "round x returns the nearest integer to x, the even integer if x is equidistant between two integers." I think this is unresonable. th

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread John A. De Goes
It's well known from numerical analysis that you can achieve the best general behavior by rounding to even in "half" the cases, and rounding to odd in "half" the cases. It's usually deterministic by looking at the digit to the right of the round point. Regards, John A. De Goes N-BRAIN, I

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Martijn van Steenbergen
Ketil Malde wrote: Of course, Haskell should discard the rather tasteless IEEE754 crud, and do its calculations on infinite streams of digits. Then, rounding upwards after 'take'ing a sufficient amount of decimals will be the right thing to do. Except arbitrary-precision real arithmetic is not

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Stefan Monnier
>>> 2.4x -> x >> That's supposed to be 2.4x -> 2, of course. > Ah, damn it. I was hoping for a long discussion on just what math > would look like with rounding like that ;-) I think it has a name... "modulo" maybe? Stefan ___ Haskell-Cafe m

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Jules Bean
This behaviour is not what I expect after reading the description at http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:round . Given that this behaviour has caused a bit of confusion I think a change to the documention might be in order. The authority here is the report whic

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Ketil Malde wrote: Janis Voigtlaender <[EMAIL PROTECTED]> writes: Since just about every floating point operation involves some sort of loss of precision, repeated rounding is a fact of life. Of course. But that was not the point of the discussion... Well, allow me to contribute to kee

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Ketil Malde
Janis Voigtlaender <[EMAIL PROTECTED]> writes: >> Since just about every floating point operation involves some sort of >> loss of precision, repeated rounding is a fact of life. > Of course. But that was not the point of the discussion... Well, allow me to contribute to keeping the discussion

[Haskell-cafe] Re: [Haskell] Re: Current XML libraries status

2008-10-27 Thread Uwe Schmidt
Hello David, > I tried to use HXT's readDocument with its tagsoup option for my > application. I couldn't find a way to construct the operation that > didn't run out of memory. I'll attach some code using HaXml's > saxParse so you can see what I want. Is that easy to do in HXT? > I simply

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Brandon S. Allbery KF8NH
On 2008 Oct 27, at 6:00, Henning Thielemann wrote: On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude> round 3.5 4 Prelude> round 2.5 2 Is there any explanation about that ? It's the definition we learnt in school ... Maybe you did; I learned "

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Thomas Davie
[1] The Haskell 98 Report: Predefined Types and Classes http://haskell.org/onlinereport/basic.html This behaviour is not what I expect after reading the description at http://haskell.org/ghc/docs/latest/html/libraries/base/ Prelude.html#v:round . Given that this behaviour has caused a bit o

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Magnus Therning
On Mon, Oct 27, 2008 at 1:37 PM, Lennart Augustsson <[EMAIL PROTECTED]> wrote: > I can't remember the method being called anything. > It was just what we were being taught. With the obvious explanation > that .5 is right in the middle so always going one way would introduce > a bias. This was cir

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Magnus Therning
On Mon, Oct 27, 2008 at 9:48 AM, L.Guo <[EMAIL PROTECTED]> wrote: > Hi all: > > > I just read about definitions of Prelude [1], and noticing that. > > In 6.4.6 Coercions and Component Extraction, it discribes like this: > > > "round x returns the nearest integer to x, the even integer if x is > eq

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Lennart Augustsson wrote: I can't remember the method being called anything. It was just what we were being taught. With the obvious explanation that .5 is right in the middle so always going one way would introduce a bias. This was circa 1969. Well, I wasn't serious about the "political" exp

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
I can't remember the method being called anything. It was just what we were being taught. With the obvious explanation that .5 is right in the middle so always going one way would introduce a bias. This was circa 1969. On Mon, Oct 27, 2008 at 3:30 PM, Janis Voigtlaender <[EMAIL PROTECTED]> wrot

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Lennart Augustsson wrote: It is certainly what I learnt in school. But that was another school. Hmm, on reflection, taking Neil's explanation into account and the fact that this rounding mode was referred to as "banker's rounding", the point may be that it was not only another school, but anot

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
But you shouldn't use the "common round function", you should use the Haskell round function. That's the one that is mathematically better and has hardware support. On Mon, Oct 27, 2008 at 2:05 PM, L.Guo <[EMAIL PROTECTED]> wrote: > Thank you all for instructions. > > I am not the same education r

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
It is certainly what I learnt in school. But that was another school. On Mon, Oct 27, 2008 at 12:15 PM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: > Henning Thielemann wrote: >> >> On Mon, 27 Oct 2008, L.Guo wrote: >> >>> I think this is unresonable. then try it in GHC 6.8.3. >>> >>> >>> Prelu

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Daniel Fischer
Am Montag, 27. Oktober 2008 13:34 schrieb Achim Schneider: > > > > Who does such horrible things? > > Repeat after me: 1 is NOT a prime. Never, under no circumstances. > > Then chase it out of your prime factor products. You'd be the first one > to break a monoid and locate unsafeCalculate#. Huh?

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Magnus Therning
2008/10/27 Janis Voigtlaender <[EMAIL PROTECTED]>: > Janis Voigtlaender wrote: > >> 2.4x -> x > > That's supposed to be 2.4x -> 2, of course. Ah, damn it. I was hoping for a long discussion on just what math would look like with rounding like that ;-) /M -- Magnus Therning

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
"Felipe Lessa" <[EMAIL PROTECTED]> wrote: > On Mon, Oct 27, 2008 at 10:20 AM, Achim Schneider <[EMAIL PROTECTED]> > wrote: > > Hmmm... I'm wondering whether there's a standard C way to set the > > rounding direction. > > nearbyint() and rint() may be used, and the rounding mode can be set > by fe

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
Daniel Fischer <[EMAIL PROTECTED]> wrote: > Am Montag, 27. Oktober 2008 12:35 schrieb Achim Schneider: > > Daniel Fischer <[EMAIL PROTECTED]> wrote: > > > Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann: > > > > I also know a didact which tells teachers that 1 has no prime > > > > dec

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 10:20 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > Hmmm... I'm wondering whether there's a standard C way to set the > rounding direction. nearbyint() and rint() may be used, and the rounding mode can be set by fesetround(). IIRC, this is C99. -- Felipe. _

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
Henning Thielemann <[EMAIL PROTECTED]> wrote: > > On Mon, 27 Oct 2008, L.Guo wrote: > > > And then, in haskell, is that means, I have to use 'floor . (.5+)' > > instead of 'round' to get the common round function ? > > That's certainly the best to do. > Hmmm... I'm wondering whether there's a

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, L.Guo wrote: And then, in haskell, is that means, I have to use 'floor . (.5+)' instead of 'round' to get the common round function ? That's certainly the best to do. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http:/

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread L.Guo
Thank you all for instructions. I am not the same education route with you, so i just heard round-to-even for the very first time. Now I understand why it exists in theory. And then, in haskell, is that means, I have to use 'floor . (.5+)' instead of 'round' to get the common round function ?

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Daniel Fischer
Am Montag, 27. Oktober 2008 12:35 schrieb Achim Schneider: > Daniel Fischer <[EMAIL PROTECTED]> wrote: > > Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann: > > > I also know a didact which tells teachers that 1 has no prime > > > decomposition. Oh, I see, she may have copied that from

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Ketil Malde wrote: Janis Voigtlaender <[EMAIL PROTECTED]> writes: If you round to odd instead of round to even, then 4.5 rounds to 5, Well, of course I did not learn to round to odd. I learned to round .5 to above, but not to do repeated rounding. Since just about every floating point o

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
Daniel Fischer <[EMAIL PROTECTED]> wrote: > Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann: > > > I also know a didact which tells teachers that 1 has no prime > > decomposition. Oh, I see, she may have copied that from Wikipedia: > > http://en.wikipedia.org/wiki/Prime_factorisat

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, Daniel Fischer wrote: Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann: On Mon, 27 Oct 2008, Janis Voigtlaender wrote: Henning Thielemann wrote: I think one reason is that repeated rounding should not be worse than rounding in one go. Consider the rule 'use c

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Daniel Fischer
Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann: > On Mon, 27 Oct 2008, Janis Voigtlaender wrote: > > Henning Thielemann wrote: > >> I think one reason is that repeated rounding should not be worse than > >> rounding in one go. Consider the rule 'use ceiling when the first > >> removed

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Ketil Malde
Janis Voigtlaender <[EMAIL PROTECTED]> writes: >> If you round to odd instead of round to even, then 4.5 rounds to 5, > Well, of course I did not learn to round to odd. I learned to round .5 > to above, but not to do repeated rounding. Since just about every floating point operation involves som

[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Achim Schneider
"L.Guo" <[EMAIL PROTECTED]> wrote: > "round x returns the nearest integer to x, the even integer if x is > equidistant between two integers." > > > Is there any explanation about that ? > Yes. math.h, rint() and IEEE. The Right Way(tm) to round is rounding every other n.5 into a different dire

RE: [Haskell-cafe] Haskell on the JVM

2008-10-27 Thread Simon Peyton-Jones
Is there an interest in hosting GHC on the JVM (besides my own). There's interest but my understanding is that the GHC backend architecture is not at all friendly to work with. That said, I hear in the next release (I think 6.12, not the 6.10 that's in beta) will have a redesigned backend arc

[Haskell-cafe] Re: External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-27 Thread Achim Schneider
"Felipe Lessa" <[EMAIL PROTECTED]> wrote: > On Mon, Oct 27, 2008 at 6:47 AM, Achim Schneider <[EMAIL PROTECTED]> > wrote: > > Don't you slam pointless style! > > main = mapM_ (($ [1..10^8::Int]) . (.) (putStrLn . show)) [last, head] > > =) > Hmmm... Template Haskell... repetitive code... defici

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, Janis Voigtlaender wrote: Henning Thielemann wrote: I think one reason is that repeated rounding should not be worse than rounding in one go. Consider the rule 'use ceiling when the first removed digit is 5'. Then 0.45 - (round to one place) -> 0.5 - (round to integer)

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Felipe Lessa wrote: On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: Well, of course I did not learn to round to odd. I learned to round .5 to above, but not to do repeated rounding. Nobody rounds in passes, of course =). Oh, Mrs. "I forgot her name" actually

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Henning Thielemann wrote: I think one reason is that repeated rounding should not be worse than rounding in one go. Consider the rule 'use ceiling when the first removed digit is 5'. Then 0.45 - (round to one place) -> 0.5 - (round to integer) -> 1 But repeated rounding *is* worse than round

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: > Well, of course I did not learn to round to odd. I learned to round .5 > to above, but not to do repeated rounding. Nobody rounds in passes, of course =). I was talking about two successive rounds. > In fact, by your

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Janis Voigtlaender wrote: 2.4x -> x That's supposed to be 2.4x -> 2, of course. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Felipe Lessa wrote: On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: That is of course true (and was the topic of heated discussion with my fourth grade math teacher), but does not explain 2.5 -> 2. If you round to odd instead of round to even, then 4.5 rounds t

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Felipe Lessa
(Janis, sorry for e-mailiing just for you on the first time.) On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender <[EMAIL PROTECTED]> wrote: > That is of course true (and was the topic of heated discussion with my > fourth grade math teacher), but does not explain 2.5 -> 2. If you round to odd in

Re: [Haskell-cafe] using ghc as a library

2008-10-27 Thread Thomas Schilling
I'm not quite sure what you are trying to do. But for what it's worth, you can load a specific file via setTarget [Target (TargetFile "foo/blah.hs") True Nothing] see http://code.haskell.org/~nominolo/html/ghc/GHC.html#v%3AsetTargets Here're GHC's current haddocks (for HEAD): http://code.h

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, Janis Voigtlaender wrote: Henning Thielemann wrote: On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude> round 3.5 4 Prelude> round 2.5 2 Is there any explanation about that ? It's the definition we learnt in school ..

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Janis Voigtlaender
Henning Thielemann wrote: On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude> round 3.5 4 Prelude> round 2.5 2 Is there any explanation about that ? It's the definition we learnt in school ... Hmm, Henning, this is strange. The two of us w

Re: [Haskell-cafe] Instances of Lattice?

2008-10-27 Thread Henning Thielemann
On Sun, 26 Oct 2008, Galchin, Vasili wrote: Hi Henning, I am rereading my emails and I don't believe I got an examples of "instance Lattice". E.g. instance Lattice Bool. ?? Did you look into the Lattice module? Bool with respect to && and || Sets with respect to union and intersection (a

RE: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Mitchell, Neil
Hi, That is a fairly standard implementation of rounding for financial institutions. Consider sum . map round Over the list [3.5,2.5] With rounding to the nearest even integer for 0.5's you get 6, otherwise if you always round up you get 7. If you bias towards rounding up you get a general upwa

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Henning Thielemann
On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude> round 3.5 4 Prelude> round 2.5 2 Is there any explanation about that ? It's the definition we learnt in school ... I think one reason is that repeated rounding should not be worse than roun

[Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread L.Guo
Hi all: I just read about definitions of Prelude [1], and noticing that. In 6.4.6 Coercions and Component Extraction, it discribes like this: "round x returns the nearest integer to x, the even integer if x is equidistant between two integers." I think this is unresonable. then try it in GH

Re: [Haskell-cafe] Re: External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-27 Thread Felipe Lessa
On Mon, Oct 27, 2008 at 6:47 AM, Achim Schneider <[EMAIL PROTECTED]> wrote: > Don't you slam pointless style! main = mapM_ (($ [1..10^8::Int]) . (.) (putStrLn . show)) [last, head] =) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

[Haskell-cafe] Re: External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-27 Thread Achim Schneider
Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > Hello Albert, > > Saturday, October 25, 2008, 9:02:14 PM, you wrote: > > > u = (putStrLn . show . last $ list) >> (putStrLn . show . head $ > > list) where list = [1..10^8::Int] > > i prefer to write it as > > main = do let list = [1..10^8] >