Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-08-01 Thread Henry Lenzi
Hello everyone - First of all, a big Thank You to all of you and for taking the time for responding. I'll have to set aside sometime during this weekend to see if I can understand the ideas you've been so kind to offer. However, I should confess that I've made some progress with way simpler stuf

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
On Aug 1, 2014, at 8:46 PM, Alexander D. Knauth wrote: > What do you mean? > Shouldn’t it go something like this: > (syntax-parameterize ([current-defs (mutable-set)]) > (match-define (sender x) 1) > (reciever) > x) > ; => > (syntax-parameterize ([current-defs (mutable-set #’(define x x3)])

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
What do you mean? Shouldn’t it go something like this: (syntax-parameterize ([current-defs (mutable-set)]) (match-define (sender x) 1) (reciever) x) ; => (syntax-parameterize ([current-defs (mutable-set #’(define x x3)]) (match-define x3 1) (reciever) x) ; => (syntax-parameterize ([cu

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
Ah, okay, so... this macro expander you give is fundamentally flawed because match-define does an initial parse (which uses the match expander) to get the identifiers it is going to define. So, when you expand to x3 as the match pattern, you end up returning x3 as one of the values that the matc

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
Okay, define-forms.rkt had some uses of parse outside of gen-match's "go" which sets the parameter, so I fixed that. Now it turns out the docs are imprecise for make-syntax-delta-introducer's first argument. It wants an identifier rather than an arbitrary piece of syntax. Not sure why that's nec

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
Well, I just hacked racket/match to allow match-expanders to take a third argument that is the introducer for the application. No permutation of mark applications works, I think since syntax-local-introduce does not include all the marks from the top use of match-define all the way through inter

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
I found this on line 2327 of racket/src/racket/src/env.c: static Scheme_Object * local_introduce(int argc, Scheme_Object *argv[]) { Scheme_Comp_Env *env; Scheme_Object *s; env = scheme_current_thread->current_local_env; if (!env) not_currently_transforming("syntax-local-introduce");

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
Well one problem is expander application his its own mark to deal with, so you can't cancel the mark on x. https://github.com/plt/racket/blob/master/racket/collects/racket/match/parse-helper.rkt#L157 Another problem is expecting the implementation of match-define to not have any inner macros th

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
Well, if the match-expander is invoked in the “dynamic extent” of the match-define form, then would syntax-local-introduce apply that syntax-mark? On Aug 1, 2014, at 6:20 PM, J. Ian Johnson wrote: > Well that's a pickle. I can tell you that (mac . args) gets expanded as > (X[mac^m] . X[args^

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
Well that's a pickle. I can tell you that (mac . args) gets expanded as (X[mac^m] . X[args^m])^m where m is a fresh mark and X expands a form. If m is applied to something with m already, they annihilate each other (see Syntactic Abstraction in Scheme for how this totally works). The syntax-loca

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
On Aug 1, 2014, at 5:37 PM, J. Ian Johnson wrote: > It's best to expand into a begin-for-syntax that does the desired mutation, > rather than mutate within the transformer. You currently _cannot_ do this > outside top level forms. The reason I can’t do that is because in the real program, sen

[racket] ICFP 2014 Final Call for Participation

2014-08-01 Thread David Van Horn
[ Early registration ends 3 Aug; Invited speakers and conference program have been announced. ] = Final Call for Participation ICFP 2014 19th ACM SIGPLAN International Conference on Functional Programming and affiliated events

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread Ryan Culpepper
Use syntax-local-introduce when putting syntax into a side-channel or getting it back out across macro calls. This only matters when the syntax represents a definition or more generally contains binders whose references are not all in the same syntax. Here are the two places that need changing

Re: [racket] getting one macro to tell another macro to define something

2014-08-01 Thread J. Ian Johnson
It's best to expand into a begin-for-syntax that does the desired mutation, rather than mutate within the transformer. You currently _cannot_ do this outside top level forms. In this case, sender would be (define-syntax (sender stx) (syntax-case stx () [(_ def) #'(begin-for-syntax (set-ad

[racket] getting one macro to tell another macro to define something

2014-08-01 Thread Alexander D. Knauth
Is there any way to do something like this and have it work?: #lang racket (require racket/stxparam (for-syntax syntax/parse racket/set)) ;; current-defs : (syntax-parameter-of (or/c set-mutable? #f)) (define-syntax-parameter current-defs #f) (define-syntax sender (l

Re: [racket] weird error with typed racket, submodules, and math/array

2014-08-01 Thread Vincent St-Amour
Hmm, that's odd. I do remember that workaround working at some point, but maybe it doesn't anymore. In the meantime, not using submodules with TR sounds like the best solution. Vincent At Thu, 31 Jul 2014 21:39:38 -0400, Alexander D. Knauth wrote: > > [1 ] > I just tried that but got an even

Re: [racket] is there any way to tell syntax-parse to parse a pattern within a parametization ?

2014-08-01 Thread Alexander D. Knauth
Oh, I had forgotten that syntax-classes could take arguments. Thanks! On Aug 1, 2014, at 12:45 PM, J. Ian Johnson wrote: > Two things: > 1) syntax-classes can take parameters, so you can pass an argument to x that > is a boolean, within-y?. You can't create a parameterization scope because

Re: [racket] is there any way to tell syntax-parse to parse a pattern within a parametization ?

2014-08-01 Thread J. Ian Johnson
Two things: 1) syntax-classes can take parameters, so you can pass an argument to x that is a boolean, within-y?. You can't create a parameterization scope because this is all within the parsing code for syntax-parse. You could mutate a box or parameter with a ~do pattern and reset it after the

[racket] is there any way to tell syntax-parse to parse a pattern within a parametization ?

2014-08-01 Thread Alexander D. Knauth
Is there any way to tell syntax-parse to parse a pattern within a parametization ? For example in something like this: (define within-y? (make-parameter #f)) (define-syntax-class x [pattern _ #:when (within-y?)]) (define-syntax-class y [pattern :x]) (define (parse stx) (syntax-parse stx

Re: [racket] "upload file" button in a Racket web server

2014-08-01 Thread Jay McCarthy
There's nothing that a normal Web app can do that Racket can't. Whatever you see in the UI is just HTML + JS. The exact same HTML and JS will work in Racket as well. The actual upload code is something like: And on the server you will get a binding:file object: http://docs.racket-lang.org/we

Re: [racket] "upload file" button in a Racket web server

2014-08-01 Thread Andrew Dudash
There's the following. #lang web-server/insta (require web-server/formlets) (define (start req) (send/formlet (file-upload))) But this doesn't support dragging and dropping images. You can add support for that with JavaScript, but I don't think there's anything like it in a Racket lib