Re: [racket] Racket community exceed expectations.

2012-12-11 Thread Neil Toronto
On 12/11/2012 12:36 PM, daniel rupis wrote: To balance my (a little trolling post), I must say that racket community is very nice. Thanks to all that respond to the post. For my part, you're welcome. :) I am interested in math, and I follow for example maxima, julia and R. It should be

Re: [racket] Math library ready for testing

2012-12-11 Thread Hendrik Boom
On Tue, Dec 11, 2012 at 05:56:03PM +0100, Pierpaolo Bernardi wrote: > On Tue, Dec 11, 2012 at 5:11 PM, Stephen Bloch wrote: > > > > How many primes are below ten million? A hundred million? At some > > point storing the primes will take less memory than storing > > primality flags, but that

[racket] 2012-12-12 Boston Lisp Meeting: Marc Battyani, Alex Plotnick [TOMORROW]

2012-12-11 Thread Francois-Rene Rideau
2012-12-12 Boston Lisp Meeting: Marc Battyani, Alex Plotnick http://fare.livejournal.com/170783.html When? TOMORROW, Wednesday December 12th 2012 at 6pm. Where? MIT 32-D463 (Star conference room at the Stata Center). Who Speaks? Marc Battyani will showcase his web framework written in Common L

[racket] Racket community exceed expectations.

2012-12-11 Thread daniel rupis
To balance my (a little trolling post), I must say that racket community is very nice. Thanks to all that respond to the post. I am interested in math, and I follow for example maxima, julia and R. It should be wonderful if the new math library could be integrated in any way with the symboli

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Jens Axel Søgaard : I have just pushed an improvement for prime? on small numbers. Before: >> (time (for/sum ([n (in-range 100)] >> #:when (prime? n)) >> n)) >> >> ; cpu time: 8944 real time: 9079 gc time: 257 >> ; 37550402023 Now: cpu time: 1511 real time:

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Neil Toronto
On 12/11/2012 08:03 AM, daniel rupis wrote: I should say that I like racket, but I find macros in racket rather difficult. I can use macros in common-lisp but I still can't use racket macros. (I am trying to say that perhaps macros in racket are something difficult to grasp). Yeah, dealing wi

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Neil Toronto
On 12/11/2012 09:59 AM, Sam Tobin-Hochstadt wrote: On Tue, Dec 11, 2012 at 11:43 AM, daniel rupis I am using racket from the console, not using DrRacket. I just copy the code with control-c and paste with control-v then wait a seconds for the definitions to be loaded in memory and then run

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Vincent St-Amour
At Tue, 11 Dec 2012 16:43:25 + (UTC), daniel rupis wrote: > Anyway, my point was that I was expecting something more from typed racket. > Since typed racket use types (like declaring type in sbcl) I was expected > better > perfomance, that's all. There's a big difference between Typed Racket

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Phil Bewig : > I can't type. The correct count of primes less than a million is 78498. And > there is something wrong if (nth-prime 78498) returns 13, as the 78498th > prime is 83. That's because nth-prime counts from 0 and Mathematica counts from 1. -- Jens Axel Søgaard

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Sam Tobin-Hochstadt
On Tue, Dec 11, 2012 at 11:43 AM, daniel rupis wrote: > Sam Tobin-Hochstadt writes: > >> >> While you're certainly right about DrRacket introducing noise in >> performance measurement, I don't think you need to generate an >> executable to eliminate that overhead. Simply running `racket` from >>

Re: [racket] Math library ready for testing

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 5:11 PM, Stephen Bloch wrote: > How many primes are below ten million? A hundred million? At some point > storing the primes will take less memory than storing primality flags, but > that point may be above the size of tables we can realistically store today. > (for

Re: [racket] Math library ready for testing

2012-12-11 Thread Phil Bewig
I can't type. The correct count of primes less than a million is 78498. And there is something wrong if (nth-prime 78498) returns 13, as the 78498th prime is 83. On Tue, Dec 11, 2012 at 10:46 AM, Martin Neal wrote: > I clicked the link, and the result shows 78498 which jives with nth-pri

Re: [racket] Math library ready for testing

2012-12-11 Thread Martin Neal
I clicked the link, and the result shows 78498 which jives with nth-prime On Tue, Dec 11, 2012 at 8:31 AM, Phil Bewig wrote: > There must be an error in the prime-counting function. According to href=" > http://www.wolframalpha.com/input/?i=how+many+primes+less+than+a+million";>Wolfram|Alpha, >

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread daniel rupis
Sam Tobin-Hochstadt writes: > > While you're certainly right about DrRacket introducing noise in > performance measurement, I don't think you need to generate an > executable to eliminate that overhead. Simply running `racket` from > the command line on a file in a module ought to be sufficient

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 5:28 PM, Sam Tobin-Hochstadt wrote: >> This looks like you are testing from inside DrRacket. As I already >> wrote you should generate an executable and measure that. >> >> If you run the test from inside DrRacket, you are measuring DrRacket >> overhead, which is far from

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Veer Singh
Sorry my mistake , it is 6.8 seconds. :) . Veer On Tue, Dec 11, 2012 at 9:52 PM, daniel rupis wrote: > Veer Singh writes: > >> >> I am getting 6.8 ms without modifying the code. >> When I change modulo to remainder I get 6.3 ms consistently. > > > I think you mean 6.8 seconds not milliseconds

Re: [racket] Math library ready for testing

2012-12-11 Thread Phil Bewig
There must be an error in the prime-counting function. According to http://www.wolframalpha.com/input/?i=how+many+primes+less+than+a+million";>Wolfram|Alpha, there are 79486 primes less than a million, not 78497. I don't use Racket, but I do have lots of Scheme code that computes with prime number

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Sam Tobin-Hochstadt
On Tue, Dec 11, 2012 at 11:23 AM, Pierpaolo Bernardi wrote: > On Tue, Dec 11, 2012 at 5:08 PM, daniel rupis > wrote: >> Pierpaolo Bernardi writes: > >>> Remember to generate an executable, to obtain the maximum speed. > > >> Welcome to Racket v5.3.1. >> >> >> (define (test) >> (time (displayln

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 5:23 PM, Pierpaolo Bernardi wrote: > If you run the test from inside DrRacket, you are measuring DrRacket > overhead, which is far from negligible. As an example, the test I just sent, with the limit changed to 60999, on my machine runs in 20083 ms from inside DrRacket, w

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 5:08 PM, daniel rupis wrote: > Pierpaolo Bernardi writes: >> Remember to generate an executable, to obtain the maximum speed. > Welcome to Racket v5.3.1. > > > (define (test) > (time (displayln (total-primes 60999> > > > >> (test) > 6145 > cpu time: 39170 real tim

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread daniel rupis
Veer Singh writes: > > I am getting 6.8 ms without modifying the code. > When I change modulo to remainder I get 6.3 ms consistently. I think you mean 6.8 seconds not milliseconds. Try with the bigger n to remove transient behaviour. Racket Users list: http://lists

Re: [racket] Using _fun for callbacks

2012-12-11 Thread Eli Barzilay
Yesterday, Matthew Flatt wrote: > I've run into this, too, and I don't have a better solution right now. > > It's not clear to me what happens with fancy argument specifications > when the function description is used for a callback, but I've never > gotten around to sorting it out. Sounds like w

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread daniel rupis
Pierpaolo Bernardi writes: > > On Tue, Dec 11, 2012 at 4:03 PM, daniel rupis > wrote: > > > > I was comparing some code in Qi with that of sbcl, I posted a question in > > comp.lang.lisp asking for a way to improve the perfomance, WJ gave a typed > > racket version that was slower than sbcl an

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
On Dec 11, 2012, at 9:03 AM, Jens Axel Søgaard wrote: > 2012/12/11 Stephen Bloch : > >> Would it perhaps make more sense for small-primes to contain primes >> themselves, in increasing order so one can be found by binary search, rather >> than booleans? The O(1) behavior would be replaced by O(

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Veer Singh
I am getting 6.8 ms without modifying the code. When I change modulo to remainder I get 6.3 ms consistently. Veer. On Tue, Dec 11, 2012 at 8:33 PM, daniel rupis wrote: > > I was comparing some code in Qi with that of sbcl, I posted a question in > comp.lang.lisp asking for a way to improve the

Re: [racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 4:03 PM, daniel rupis wrote: > > I was comparing some code in Qi with that of sbcl, I posted a question in > comp.lang.lisp asking for a way to improve the perfomance, WJ gave a typed > racket version that was slower than sbcl and also much slower than cpp. The sbcl versi

[racket] deceptive perfomance for typed racket in integer division

2012-12-11 Thread daniel rupis
I was comparing some code in Qi with that of sbcl, I posted a question in comp.lang.lisp asking for a way to improve the perfomance, WJ gave a typed racket version that was slower than sbcl and also much slower than cpp. Daniel Rupis wrote: Note: The code compute the number of primes below 3

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Stephen Bloch : > Would it perhaps make more sense for small-primes to contain primes > themselves, in increasing order so one can be found by binary search, rather > than booleans? The O(1) behavior would be replaced by O(log(limit)), but > perhaps you would save enough memory to put

Re: [racket] Math library ready for testing

2012-12-11 Thread Sam Tobin-Hochstadt
Unfortunately, Maxima seems to be distributed under the GPL, which means that we can't easily just take their code and add it to Racket. Sam On Tue, Dec 11, 2012 at 8:52 AM, Jens Axel Søgaard wrote: > 2012/12/11 Jens Axel Søgaard : >> 2012/12/11 Jens Axel Søgaard : >>> Here is what Maxima does (

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Jens Axel Søgaard : > 2012/12/11 Jens Axel Søgaard : >> Here is what Maxima does (line 628 and below): >> >> https://github.com/andrejv/maxima/blob/master/src/ifactor.lisp > > I have attached a port in the attached file. The new primality > tester is called new-prime? and the old one pri

Re: [racket] Math library ready for testing

2012-12-11 Thread Sam Tobin-Hochstadt
On Tue, Dec 11, 2012 at 6:01 AM, Jens Axel Søgaard wrote: > > The second will be to experiment with "medium numbers" > and see whether trial division is faster than the pseudo > prime test, when the small prime limit is raised to larger number > again. One thing that might be worth considering, e

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Stephen Bloch : > On Dec 11, 2012, at 6:01 AM, Jens Axel Søgaard wrote: > Would it perhaps make more sense for small-primes to contain primes > themselves, in increasing order so one can be found by binary search, rather > than booleans? The O(1) behavior would be replaced by O(log(lim

Re: [racket] Math library ready for testing

2012-12-11 Thread Stephen Bloch
On Dec 11, 2012, at 6:01 AM, Jens Axel Søgaard wrote: > For a small (less than 1) number n prime? looks up primality of > with a simple (vector-ref small-primes n). > > For a large number (greater than 1) a pseudo prime test is used. > > Originally the limit for small primes was a mil

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Pierpaolo Bernardi : > On Tue, Dec 11, 2012 at 12:01 PM, Jens Axel Søgaard > wrote: > >> Below 60 there are only 16 numbers not divisible by 2, 3 or 5. >> The number of bytes needed to store primality results for the >> first million numbers will therefore be >> 100 * 16/60 *

Re: [racket] Math library ready for testing

2012-12-11 Thread Pierpaolo Bernardi
On Tue, Dec 11, 2012 at 12:01 PM, Jens Axel Søgaard wrote: > Below 60 there are only 16 numbers not divisible by 2, 3 or 5. > The number of bytes needed to store primality results for the > first million numbers will therefore be > 100 * 16/60 * 1/8 ~ 3.3 > > How much space would b

Re: [racket] Math library ready for testing

2012-12-11 Thread Robby Findler
FWIW, I think these questions are best answered with an app in hand, but my apriori guess would be to say that 32k isn't too bad, but that it also doesn't seem necessary in this case. Martin Neal's micro benchmark already saw lots of improvements with just a different algorithm so perhaps that's en

Re: [racket] Math library ready for testing

2012-12-11 Thread Jens Axel Søgaard
2012/12/11 Martin Neal : > First - I love the library. There's so much functionality that it's going > to take quite some time to explore it all > > I'd love to see an `in-primes` function added to math/number-theory. Excellent idea. I have added it to the todo-list. > Using a pseudo prime test