Re: [racket] Redex question: parameterizing a language definition

2013-06-04 Thread Robby Findler
Oh: one other gotcha to watch out for. When Racket compiles a file to .zo, it discards source location information in syntax object templates. This means that these trick also won't work in that case. It is possible to preserve this syntax location information. ... long story short: various things

Re: [racket] Racket 5.3.4, 32-bit slow?

2013-06-04 Thread Joe Gilray
Hi again Danny, Very interesting note, thanks for the details. The problem is a slightly easier version of one the ProjectEuler.net problems (see here: http://projecteuler.net/problem=210) Basically the hard part of the problem is finding the grid points that fall in a circle with origin at (125

Re: [racket] Racket 5.3.4, 32-bit slow?

2013-06-04 Thread Danny Yoo
> Yes, makes perfect sense, hmmm... there's probably a way to avoid so many > sqrt calls. > This probably won't help. No individual iteration in that inner loop is beyond 32 bits. The accumulated sum itself is what grows beyond the bounds of a 32-bit representation. Reducing the number of sqrt

Re: [racket] Racket 5.3.4, 32-bit slow?

2013-06-04 Thread Joe Gilray
Hi Danny, Yes, makes perfect sense, hmmm... there's probably a way to avoid so many sqrt calls. How do you like Go? How is the performance on this code? Thanks, -joe On Tue, Jun 4, 2013 at 12:59 PM, Danny Yoo wrote: > Some of the involved numbers are bigger than can be represented in 32 > b

Re: [racket] Racket 5.3.4, 32-bit slow?

2013-06-04 Thread Danny Yoo
Some of the involved numbers are bigger than can be represented in 32 bits. Therefore, the computation on 32 bit platforms will need to use more software-emulated bigintegers to perform the computation successfully, and that's where the performance difference is coming from. I played with this b

Re: [racket] Redex question: parameterizing a language definition

2013-06-04 Thread Lindsey Kuper
On Mon, Jun 3, 2013 at 11:29 PM, Robby Findler wrote: > I've written three little examples [...] Thanks, Robby, this is an enormous help. I'll play with these and see what can be done. Lindsey Racket Users list: http://lists.racket-lang.org/users

[racket] Racket 5.3.4, 32-bit slow?

2013-06-04 Thread Joe Gilray
The following code runs in reasonable time (about 5s) on 64-bit 5.3.4, but takes about 20x as long on 32-bit. I adapted this code from some scheme code on the PE forum. Thoughts? Thanks, -Joe (define (euler210) (define limit (expt 10 8)) (define ldiv4 (quotient limit 4)) (define ldiv8 (qu

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Daniel Prager
Ok I've tried Sean's shorter version (nice use of the macro), but the regex isn't quite right for the ie/ei case, so the numbers are out. We'll get there ... -- Dan Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Daniel Prager
Hi Sean If you look again on the page I hit on a similar for/fold solution independently, which is now up on Rosetta Amusingly, the Common Lisp version was submitted by a colleague of mine who I mentioned this exercise to, so no doubt there'll be some friendly banter tomorrow! So any further hel

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Sean Kanaley
Hello fellow Rosetta submitter! The regular expressions are actually pretty useful to make a functional version shorter than the imperative one! First, forms with (for ...) and a bunch of (set!)'s is made functional by (for/fold ...) where the final (values ...) functionally sets the new values.

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Tobias Hammer
Sorry for the misinformation but Eli is of course right that regexp-quote must be used. Example: (regexp-match? "a" "abc") #t (regexp-match? "." "abc") #t ; WRONG! '.' matches every character (regexp-match? (regexp-quote "a") "abc") #t (regexp-match? (regexp-quote ".") "abc") #f On

Re: [racket] Error during installation of 5.3.4.11

2013-06-04 Thread Laurent
Then don't bother too much. Though if you want to do something maybe you can just target the most popular distributions maybe and leave the rest as is. On Tue, Jun 4, 2013 at 12:33 PM, Eli Barzilay wrote: > 10 minutes ago, Laurent wrote: > > Ahem, picked the wrong 32/64bits version... Sorry fo

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Daniel Prager
Thanks Tobias & Eli I've updated my submission to use (regexp-match? sub-str str). [Also added the stretch goal solution, but could do with some refactoring to reduce the joint line-count.] -- Dan Racket Users list: http://lists.racket-lang.org/users

Re: [racket] quasisyntax vs quasisyntax/loc

2013-06-04 Thread Tobias Hammer
Thanks for your answer. Did i understand it correct that neither quasisyntax nor quasisyntax/loc recognize quasisyntax/loc inside. So if these are used, quasisyntax/loc must currently be in the outmost layer? On Tue, 04 Jun 2013 12:07:39 +0200, Matthew Flatt wrote: The problem is that `

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Eli Barzilay
An hour ago, Daniel Prager wrote: > > (define (in? str sub-str) >   (not (string=? str (string-replace str sub-str "" > > Is there something I could have used out-of-the-box? No -- eventually there should be these two things: (string-index str sub [start 0] [end (string-length str)]) (l

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Tobias Hammer
Or even shorter (regexp-match? sub-str str) (Didn't know that worked) On Tue, 04 Jun 2013 13:34:37 +0200, Tobias Hammer wrote: I think regexp are the right choice: (regexp-match? (regexp sub-str) str)) On Tue, 04 Jun 2013 12:43:02 +0200, Daniel Prager wrote: I've just submitted a

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Tobias Hammer
I think regexp are the right choice: (regexp-match? (regexp sub-str) str)) On Tue, 04 Jun 2013 12:43:02 +0200, Daniel Prager wrote: I've just submitted a Racket solution to Rosetta Code for "I before E except after C" (no stretch goal yet). http://rosettacode.org/wiki/I_before_E_exc

[racket] Rosetta code submission / string operations

2013-06-04 Thread Daniel Prager
I've just submitted a Racket solution to Rosetta Code for "I before E except after C" (no stretch goal yet). http://rosettacode.org/wiki/I_before_E_except_after_C and noticed a couple of seeming omissions from the basic string operations, or more likely the documentation. I ended up rustlin

Re: [racket] Error during installation of 5.3.4.11

2013-06-04 Thread Eli Barzilay
10 minutes ago, Laurent wrote: > Ahem, picked the wrong 32/64bits version... Sorry for the noise. > Maybe there could be a simple check in the installation file that > issues a warning whenever the machine's architecture is different > from the installer's? Though since very few people seem to com

Re: [racket] Error during installation of 5.3.4.11

2013-06-04 Thread Laurent
Ahem, picked the wrong 32/64bits version... Sorry for the noise. Maybe there could be a simple check in the installation file that issues a warning whenever the machine's architecture is different from the installer's? Though since very few people seem to complain about this, that's probably no big

Re: [racket] Processing and Racket

2013-06-04 Thread David Griffiths
Hi all, I've been keeping half an eye on this thread, a lot of people (me included) use fluxus/racket for teaching programming to artists, and we have a growing community of live coders who use it in performance settings (VJing and making music too). One of my current projects with fluxus is to u

Re: [racket] quasisyntax vs quasisyntax/loc

2013-06-04 Thread Matthew Flatt
The problem is that `quasisyntax' doesn't recognize `quasisyntax/loc' as a kind of quasiquote. In terms of plain quasiquote, your example is analogous to > (define-syntax-rule (qq e) (quasiquote e)) > `(qq ,(+ 1 2)) '(qq 3) as opposed to > `(quasiquote ,(+ 1 2)) '`,(+ 1 2) A difference is

[racket] quasisyntax vs quasisyntax/loc

2013-06-04 Thread Tobias Hammer
Hi, i have a problem with nested quasisyntax, quasisyntax/loc and unsyntax. Two quasisyntax with one unsyntax gets me one level up, as expected. But two quasisyntax/loc with unsyntax somehow gets me to the outmost level. Can anybody tell me if this is intended or explain why this happens?