[Haskell-cafe] Re: Web server continued

2007-12-31 Thread Joost Behrends
I forgot 2 things: The distinction between '=' and '==' is much like in C, although mixing them up is not so dangerous like in C. ':=' and '=' like in Wirth languages would be nicer. Strangely nobody reacted on this. That a=a+1 is an infinite recursion here (but _|_ obviously not

[Haskell-cafe] Re: Web server (Was: Basic question concerning data constructors)

2007-12-31 Thread Joost Behrends
Hi, So how, prey tell, do you factor out an expression which includes p.../p? It is not Haskell, Haskell has no power there. Surely learning that mapping is easier than building your own (which will doubtlessly be worse (no offense, that's the first law of library use)). And since you

[Haskell-cafe] Basic question concerning data constructors

2007-12-30 Thread Joost Behrends
Hello, perhaps i will make a wishlist of topics not dealt in the tutorials. Here is something i miss in each of them: notes at the semantics of data constructors. We read data Pair a b = Pair a b in YetAnotherHaskellTutorial. And that is all ! If we omit data here, this would be a silly

[Haskell-cafe] ReRe: Basic question concerning data constructors

2007-12-30 Thread Joost Behrends
Thanks to both fast answers. there remain problems with Jakes mail for me. This: When you define datatypes, you are essentially defining a type-level constructors on the left hand side and (value-level) constructors on the right hand side. is very useful for me. data defines TWO

[Haskell-cafe] Re: Web server (Was: Basic question concerning data constructors)

2007-12-30 Thread Joost Behrends
Thanks for that info: Several people have adapted and further developed HWS: http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming#Web_servers http://darcs.haskell.org/hws/ http://www.informatik.uni-freiburg.de/~thiemann/WASH/ (WSP) There is also a mailing

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Stefan O'Rear stefanor at cox.net writes: If you can reproduce it on your machine (rm executable *.o *.hi between tests for maximum reliability), it's definitely a bug. http://hackage.haskell.org/trac/ghc/wiki/ReportABug Stefan Yes, it was the same as before. Had i reboot meanwhile,

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Daniel Fischer daniel.is.fischer at web.de writes: I can't reproduce it, both run in 130s here (SuSE 8.2, 1200MHz Duron). However, it's running over 30 minutes now trying to factorise 2^88+1 without any sign of approaching success, which suggests your code has a bug (the factorization is

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Daniel Fischer daniel.is.fischer at web.de writes: Of course, one minute after I sent my previous mail, I receive this one :( However, one point, it might be faster to factor out all factors p in found and only then compute the intsqrt, like found x = x{dividend = xstop, bound = intsqrt

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Sterling Clover s.clover at gmail.com writes: I'm curious if you get the same performance difference importing GHC.List instead of Data.Char? I chased some dependencies, and Data.Char imports GHC.Arr, which in turn imports GHC.List, which provides a bunch of fusion rules pragmas that would

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Neil Mitchell ndmitchell at gmail.com writes: If it can be reproduced on anyones machine, it is a bug. If you can bundle up two programs which don't read from stdin (i.e. no getLine calls) or the standard arguments (i.e. getArgs) which differ only by the Data.Char import, and have massive

[Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Joost Behrends
Hi again, Daniel cannot sleep tonight - perhaps from the feeling to loose too much time with these things. Yes - it's the wheel. And a dlist made from [3,5,7,11,13,17] was optimal in some of my experiments too. You will probably know it - but perhaps there are third-party readers: A last try to

[Haskell-cafe] Re: MonadFix

2007-12-21 Thread Joost Behrends
@apfelmus, please read my code. I introduced DivIter to separate divstep from divisions. But it stores intsqrt dividend also. Thus the sqrt is only recomputed, when a new factor is found. Concerning primes': With the sieve of Eratosthenes we cannot make a lazy list, we need the whole list at any

[Haskell-cafe] Re: MonadFix

2007-12-21 Thread Joost Behrends
@apfelmus, please read my code. I introduced DivIter to separate divstep from divisions. But it stores intsqrt dividend also. Thus the sqrt is only recomputed, when a new factor is found. Concerning primes': With the sieve of Eratosthenes we cannot make a lazy list, we need the whole list at any

[Haskell-cafe] Re: MonadFix

2007-12-21 Thread Joost Behrends
apfelmus apfelmus at quantentunnel.de writes: Huh? p intsqrt n is evaluated just as often as p*p n , with changing n . Why would that be less expensive? Btw, the code above test for r==0 first, which means that the following p*p n is tested exactly once for every prime

[Haskell-cafe] Re: MonadFix

2007-12-20 Thread Joost Behrends
Albert Y. C. Lai trebla at vex.net writes: Theoretically the recursions in oddFactors k n | otherwise = oddFactors (k+2) n and (*) divisions y |divisor y = bound y = divisions (divstep y) do not cost stack space. They are tail recursions too! In general similar tail

[Haskell-cafe] Re: MonadFix

2007-12-20 Thread Joost Behrends
apfelmus apfelmus at quantentunnel.de writes: How about separating the candidate prime numbers from the recursion factorize :: Integer - [Integer] factorize = f primes' where primes' = 2:[3,5..] f (p:ps) n | r == 0= p : f (p:ps) q | p*p n

[Haskell-cafe] MonadFix

2007-12-18 Thread Joost Behrends
Hi, since about three weeks i am learning Haskell now. One of my first excercises is to decompose an Integer into its primefactors. I already posted discussion on the solution to the problem 35 in 99 excercises. My simple algorithm uses a datatype DivIter of 4 named fields together with the core

[Haskell-cafe] Re: New to Haskell: The End

2007-12-18 Thread Joost Behrends
Henning Thielemann lemming at henning-thielemann.de writes: - it is lazy with class - it is strongly typed - it has automatic memory management - it has a standard library - it has a compiler - it is available on several platforms - it has a community - it is free There MUST be

[Haskell-cafe] Re: MonadFix

2007-12-18 Thread Joost Behrends
Daniel Fischer daniel.is.fischer at web.de writes: Am Dienstag, 18. Dezember 2007 17:26 schrieb Joost Behrends: Hi, since about three weeks i am learning Haskell now. One of my first excercises is to decompose an Integer into its primefactors. I already posted discussion