Re: [racket] define-syntax-rule/id

2011-04-18 Thread Laurent
Whoa, very nice! IIUC, you could get rid of syntax-local-eval because you have a sub-macro, so the overall macro puts the content of id-rename inside a sub-macro that is then evaluated. This is also why id is correctly "bound" inside (begin body ...) : after the first expansion, it is not really b

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Vincent St-Amour
At Mon, 18 Apr 2011 19:41:18 -0400, Danny Yoo wrote: > > > This program now compiles in approximately 3 seconds on my machine, > > whereas previously it was more than 2 minutes. > > Awesome! I look forward to trying this out. Will this make the > upcoming Racket release? Yes. Vincent

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2011 at 7:41 PM, Danny Yoo wrote: >> This program now compiles in approximately 3 seconds on my machine, >> whereas previously it was more than 2 minutes. > > Awesome!  I look forward to trying this out.  Will this make the > upcoming Racket release? Yes. -- sam th sa...@ccs.neu.

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Danny Yoo
> This program now compiles in approximately 3 seconds on my machine, > whereas previously it was more than 2 minutes. Awesome! I look forward to trying this out. Will this make the upcoming Racket release? _ For list-related administrative tasks

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2011 at 2:27 PM, Sam Tobin-Hochstadt wrote: > On Mon, Apr 18, 2011 at 1:48 PM, Danny Yoo wrote: >> On Mon, Apr 18, 2011 at 1:38 PM, Danny Yoo wrote: >>> Hi Sam, >>> >>> Ok, I've reduced the example to a smaller, self-contained 188-line >>> program, with a bunch of type declaratio

Re: [racket] Future thread

2011-04-18 Thread Matthew Flatt
At Mon, 18 Apr 2011 13:44:05 -0600, Jay McCarthy wrote: > I'd like the best of both worlds. I would imagine that this would work > by having blocked futures be a schedule-able thread so that if they > need to do unsafe work---and no other Racket thread is > available---then they could be selected f

Re: [racket] Future thread

2011-04-18 Thread Robby Findler
I think performance is hard enough that you cannot work from theoretical concerns, but only from concrete, too slow programs. Robby On Mon, Apr 18, 2011 at 3:16 PM, Jay McCarthy wrote: > 2011/4/18 Robby Findler : >> So, in that spirit, what is causing your tasks to get stuck? (You can >> use the

Re: [racket] Future thread

2011-04-18 Thread Jay McCarthy
2011/4/18 Robby Findler : > So, in that spirit, what is causing your tasks to get stuck? (You can > use the debug log to get some information on this.) Currently my concern is just theoretical. I'm getting ready to implement it. Jay -- Jay McCarthy Assistant Professor / Brigham Young Universit

Re: [racket] Future thread

2011-04-18 Thread Robby Findler
On Mon, Apr 18, 2011 at 2:44 PM, Jay McCarthy wrote: > I have a program that spends most of the time waiting for user > input/time to advance (think of a World.) I have a computation that I > can perform at Frame 0, but I don't need the result until Frame 10. I > will do some work between these fr

[racket] Future thread

2011-04-18 Thread Jay McCarthy
I have a program that spends most of the time waiting for user input/time to advance (think of a World.) I have a computation that I can perform at Frame 0, but I don't need the result until Frame 10. I will do some work between these frames. I'd like to be able to have this computation take place

Re: [racket] Specifying the type of a function that contains a type test (but isn't one)

2011-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2011 at 3:02 PM, Jeremiah Willcock wrote: > Given the following Typed Racket program: > > #lang typed/racket > > (: greater-than-5? (Any -> Boolean)) > (define (greater-than-5? x) >  (and (integer? x) (> x 5))) First, you probably want to use `exact-integer?' here, see the TR docs

[racket] Specifying the type of a function that contains a type test (but isn't one)

2011-04-18 Thread Jeremiah Willcock
Given the following Typed Racket program: #lang typed/racket (: greater-than-5? (Any -> Boolean)) (define (greater-than-5? x) (and (integer? x) (> x 5))) (: equal-to-7? (Any -> Boolean)) (define (equal-to-7? x) (and (greater-than-5? x) (= x 7))) I receive the error (highlighting the x in (

Re: [racket] define-syntax-rule/id

2011-04-18 Thread Jon Rafkind
Here is an alternative implementation that makes the example you showed at the very bottom of your emails work. I don't know if its "better" but using `syntax-local-eval' looks somewhat dangerous to me. This is mostly straight-forward except that to get the right lexical scope for `get-x1' we need

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2011 at 1:48 PM, Danny Yoo wrote: > On Mon, Apr 18, 2011 at 1:38 PM, Danny Yoo wrote: >> Hi Sam, >> >> Ok, I've reduced the example to a smaller, self-contained 188-line >> program, with a bunch of type declarations followed by a trivial >> function definition: > > Ok, reduced fur

Re: [racket] define-syntax-rule/id

2011-04-18 Thread Laurent
Found! After having read more carefully Eli's very good post ( http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html), it became clearer that the problem was that the context of the created identifier was wrong. Deconstructing and reconstructing the id syntax object did the trick: (

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Danny Yoo
On Mon, Apr 18, 2011 at 1:38 PM, Danny Yoo wrote: > Hi Sam, > > Ok, I've reduced the example to a smaller, self-contained 188-line > program, with a bunch of type declarations followed by a trivial > function definition: Ok, reduced further to 87 line example. It's short enough that I'll just em

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Danny Yoo
Hi Sam, Ok, I've reduced the example to a smaller, self-contained 188-line program, with a bunch of type declarations followed by a trivial function definition: http://hashcollision.org/tmp/test-types.rkt It's the definition of collect-primitive-command there that takes several minutes for

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Sam Tobin-Hochstadt
On Mon, Apr 18, 2011 at 12:26 PM, Eli Barzilay wrote: > > And one more point -- I see this: > >  (define-struct Rep (seq free-vars free-idxs stx) #:transparent) >  [...] >  (p/c (struct Rep ([seq exact-nonnegative-integer?] >                    [free-vars (hash/c symbol? variance?)] >            

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Vincent St-Amour
At Mon, 18 Apr 2011 12:26:26 -0400, Eli Barzilay wrote: > > But in the TR case the transformation seems fine because > `filter-equal?' is defined as a simple > > (define (filter-equal? a b) (= (Rep-seq a) (Rep-seq b))) > > Sam/Vincent: that's probably a good thing to do, and even better -- > g

Re: [racket] webserver mapping servlets to path

2011-04-18 Thread J G Cho
Thank you all for your help. Dropping else clause did the trick for the first one. This is great since it's much more elegant than my second way. (BTW, for that second way, adding #:servlet-regexp #rx"servlets*" did "fix" my issue the server not finding /servlets/blog as a static file.) Going bac

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Eli Barzilay
30 minutes ago, Danny Yoo wrote: > > diff --git a/collects/typed-scheme/types/filter-ops.rkt > b/collects/typed-scheme/types/filter-ops.rkt > index 2d24753..3786840 100644 > --- a/collects/typed-scheme/types/filter-ops.rkt > +++ b/collects/typed-scheme/types/filter-ops.rkt > @@ -132,7 +132,11 @@ >

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Danny Yoo
> One hot spot identified: the use of remove-duplicates in the > definition of -and within typed-scheme/types/filter-ops.rkt is taking > a significant amount of time. Ok, code analyzed. The other part of the -or code that's significantly expensive is the running optimizations and filtering going

[racket] define-syntax-rule/id

2011-04-18 Thread Laurent
Dear Racket list, Once again, I need a little help on a macro definition. I want to define the following (simplified[1]) macro: (define-syntax-rule/id [*id id-gen*] *body*) where id is replaced with the result of id-gen inside body. For example: (define-syntax-rule/id [x #'foo] (begin (defin

Re: [racket] non-terminating type check for typed racket

2011-04-18 Thread Danny Yoo
> Also, if the part that's slow may well be inferring the type > parameters to a polymorphic function application, in which case it > should be easy to work around by explicitly using `inst'. One hot spot identified: the use of remove-duplicates in the definition of -and within typed-scheme/types

Re: [racket] My PLT->Racket porting experience

2011-04-18 Thread Robby Findler
On Thu, Mar 3, 2011 at 7:33 AM, Don Blaheta wrote: > Quoth Stephen Chang: >> I've never seen a dialog box appear behind another window in drracket, >> but I have on occasion, due to my own doing, lost a dialog box behind >> another window, and subsequently gotten frustrated when the buttons in >>

Re: [racket] webserver mapping servlets to path

2011-04-18 Thread Jay McCarthy
Hi jGc, It is actually simpler than Noel suggests. Scroll down... 2011/4/16 J G Cho : > To those familiar with Web Server, > > I am a bit lost trying to map servlets to paths. e.g.: > > servlet1.rkt should requests to http://localhost:8080/app1 > servlet2.rkt should requests to http://localhost:8