Re: [racket-users] beating java (speed)

2017-07-01 Thread Neil Van Dyke
Any standard pixmap library that is sufficiently fast *without* using "unsafe" language is a win. Pixmap libraries are one of the most prolific class of unacceptably buggy code implemented C, and routinely provide remote exploit vectors via Web browsers and copied document files, as well as

Re: [racket-users] hacking falsiness

2017-07-01 Thread Matthias Felleisen
Boolean does play a special role. See the teaching languages for the reverse of the problem (easier). > On Jul 1, 2017, at 6:43 PM, Matthew Flatt wrote: > > At Sat, 1 Jul 2017 14:06:04 -0700, Matthew Butterick wrote: >> Good idea, but can I introduce a new macro (which

Re: [racket-users] hacking falsiness

2017-07-01 Thread Matthew Flatt
At Sat, 1 Jul 2017 14:06:04 -0700, Matthew Butterick wrote: > Good idea, but can I introduce a new macro (which naturally needs expansion) > into a fully-expanded module (which does not)? Yes, you can expand, add non-core forms, and let the result get expanded again. You're right that there's

Re: [racket-users] hacking falsiness

2017-07-01 Thread Matthew Butterick
> On Jul 1, 2017, at 2:24 PM, Deren Dohoda wrote: > > If your #lang has Greg's "if" then any module written in that #lang will use > that "if". IIUC Greg is suggesting something different than the usual shadow-and-export fandango that a module language ordinarily

Re: [racket-users] hacking falsiness

2017-07-01 Thread Deren Dohoda
Matthew, If your #lang has Greg's "if" then any module written in that #lang will use that "if". So if I understand, your concern is that someone calls a procedure which has some conditional behavior but that procedure, being written in another module entirely, won't use Greg's "if". That is,

Re: [racket-users] hacking falsiness

2017-07-01 Thread Matthew Butterick
Good idea, but can I introduce a new macro (which naturally needs expansion) into a fully-expanded module (which does not)? IOW, it feels like you'd need to mangle #%kernel `if` before expansion, so that all the higher level expansions landed on the new mangled form. Mangling #%datum won't

Re: [racket-users] Catching syntax errors

2017-07-01 Thread Ryan Culpepper
Use `convert-syntax-error` from the `syntax/macro-testing` module: http://docs.racket-lang.org/syntax/macro-testing.html#(form._((lib._syntax%2Fmacro-testing..rkt)._convert-syntax-error)) Ryan On 06/30/2017 04:47 PM, Sam Waxman wrote: Hello, I'm trying to test whether or not certain

Re: [racket-users] Typed Racket and Contracts

2017-07-01 Thread Matthias Felleisen
The contract extension of Typed Racket are still pending Sam’s review. > On Jul 1, 2017, at 12:41 PM, Zelphir Kaltstahl > wrote: > > I tried some simple examples of Typed Racket recently and then I thought I > could try some things with contracts too. > >

[racket-users] Typed Racket and Contracts

2017-07-01 Thread Zelphir Kaltstahl
I tried some simple examples of Typed Racket recently and then I thought I could try some things with contracts too. However, I do not seem to be able to contract-out any Typed Racket struct. For example: ~~~ #lang typed/racket (struct WordMetadata ([id : String] [learned : Boolean]

[racket-users] Re: how to get full tracebacks in DrRacket?

2017-07-01 Thread Zelphir Kaltstahl
On Friday, June 30, 2017 at 5:10:44 PM UTC+2, Matthew Butterick wrote: > Is there a way to configure DrRacket so that it always prints the same > full-length tracebacks that are visible on the command line? Here's an > example of the same module run in both places.  On command line I usually

Re: [racket-users] beating java (speed)

2017-07-01 Thread Vincent St-Amour
On Sat, 01 Jul 2017 08:25:01 -0500, WarGrey Gyoudmon Ju wrote: > > Hello, did you try remove racket/unsafe/ops? > You do not have to use unsafe operations for fixnum and flonum, Typed Racket > will do it for you. > > I am not sure if this is my problem, I found that racket/unsafe/op slows down

Re: [racket-users] beating java (speed)

2017-07-01 Thread Vincent St-Amour
On Sat, 01 Jul 2017 08:07:37 -0500, 'Shakin Billy' via Racket Users wrote: > > java code runs in 4.5 seconds > racket code takes 12.5 seconds to complete (in cli-mode) > > i typed racket and used unsafe operations. some perfomance hints from the > guide don't seem to apply since i already

Re: [racket-users] Re: beating java (speed)

2017-07-01 Thread Jens Axel Søgaard
Hi Billy Just curious. How long does the simple solution take: #lang racket/base (require math/number-theory) (define (f n) (for/sum ([x (in-range 1 (+ n 1))] #:when (= (length (divisors x)) 8)) 1)) (f 10e6) /Jens Axel -- You received this message because you are

Re: [racket-users] Re: beating java (speed)

2017-07-01 Thread Matthias Felleisen
> On Jul 1, 2017, at 10:05 AM, 'Shakin Billy' via Racket Users > wrote: > > i still don' wanna believe java is faster/better! I don’t know which version of Java you’re running but in all likelihood, you are competing with a system on which some company spent 2

[racket-users] Re: beating java (speed)

2017-07-01 Thread 'Shakin Billy' via Racket Users
thx for the answers so far! (multithreading) the java version was intended to use mutlithreading, but i commented it out, so it's singe-thread vs single-thread. (compilation) i'm not sure this will speed things up since i don't measure the time using cli tools but built-in tools which run

[racket-users] Re: beating java (speed)

2017-07-01 Thread 'Shakin Billy' via Racket Users
thx for the answers so far! multithreading: Am Samstag, 1. Juli 2017 15:07:37 UTC+2 schrieb Shakin Billy: > hi, > > i've been working a little on project euler problem 501. > my first attempt is a burte forcce loop.4iw rote it in java und racket and > found java to be faster by factor 3: > >

Re: [racket-users] beating java (speed)

2017-07-01 Thread George Neuner
On 7/1/2017 9:07 AM, 'Shakin Billy' via Racket Users wrote: java code runs in 4.5 seconds racket code takes 12.5 seconds to complete (in cli-mode) Just a thought ... did you compile the Racket code before you ran it? If not, it's likely quite a bit of the Racket time was for compilation.

Re: [racket-users] beating java (speed)

2017-07-01 Thread WarGrey Gyoudmon Ju
Hello, did you try remove racket/unsafe/ops? You do not have to use unsafe operations for fixnum and flonum, Typed Racket will do it for you. I am not sure if this is my problem, I found that racket/unsafe/op slows down my typed bitmap library. According to the Optimization Coach, FlVector (with

[racket-users] beating java (speed)

2017-07-01 Thread 'Shakin Billy' via Racket Users
hi, i've been working a little on project euler problem 501. my first attempt is a burte forcce loop.4iw rote it in java und racket and found java to be faster by factor 3: racket #lang typed/racket (require racket/unsafe/ops) (require racket/fixnum) (require racket/trace) ;(require