Re: [racket-users] Basic macro question

2017-02-05 Thread Jon Zeppieri
On Sun, Feb 5, 2017 at 10:12 PM, wrote: > Ahh... datum->syntax, I thought I had seen something like this before. It is > treating "a", or a's form, as the scope for the new ids essentially, but I > can pick standard names. This just presupposes I only care to use my "a" >

Re: [racket-users] Basic macro question

2017-02-05 Thread keccak384
On Sunday, February 5, 2017 at 10:04:47 PM UTC-5, Philip McGrath wrote: > You need to have the lexical context information of x, y, and z come from > stx: otherwise, they will be protected by macro expansion (as a matter of > hygiene). > > > Here's one way to do it: > (define-syntax (a stx) >  

Re: [racket-users] Basic macro question

2017-02-05 Thread Philip McGrath
You need to have the lexical context information of x, y, and z come from stx: otherwise, they will be protected by macro expansion (as a matter of hygiene). Here's one way to do it: > (define-syntax (a stx) > (syntax-parse stx > [(a) > (with-syntax ([x (datum->syntax stx 'x)] >

Re: [racket-users] Basic macro question

2017-02-05 Thread Jon Zeppieri
On Sun, Feb 5, 2017 at 9:41 PM, wrote: > I must be missing something simple here. > > 229> (define-syntax a (lambda (stx) (syntax-parse stx [(a) #`(begin (define x > 97) (define y 98) (define z 99))]))) > 230>(a) > 231>y > 232; y:undefined; > 233; cannot reference undefined

[racket-users] Basic macro question

2017-02-05 Thread keccak384
I must be missing something simple here. 229> (define-syntax a (lambda (stx) (syntax-parse stx [(a) #`(begin (define x 97) (define y 98) (define z 99))]))) 230>(a) 231>y 232; y:undefined; 233; cannot reference undefined identifier 234; [,bt for context] If

Re: [racket-users] ->* contracts not enforcing #:pre/desc pre-conditions

2017-02-05 Thread Robby Findler
Thanks. I've pushed a fix. https://github.com/racket/racket/commit/8c5c8da1a7e8c63460125d5cde3cdc5e1240a09c Robby On Sun, Feb 5, 2017 at 3:44 AM, Philip McGrath wrote: > Contracts created with ->* don't seem to be enforcing their #:pre/desc > pre-conditions. > > Given

Re: [racket-users] Using brag parser library with Typed Racket

2017-02-05 Thread Sourav Datta
On Sunday, February 5, 2017 at 4:06:13 AM UTC+5:30, Matthew Butterick wrote: > On Feb 4, 2017, at 8:18 AM, Sourav Datta wrote: > > (require/typed "grammar1.rkt" >  [parse (->* (Listof Token) >  (Any) >  Syntax)]) >

[racket-users] ->* contracts not enforcing #:pre/desc pre-conditions

2017-02-05 Thread Philip McGrath
Contracts created with ->* don't seem to be enforcing their #:pre/desc pre-conditions. Given this program: > #lang racket > (module private racket > (provide get-apples-allowed? >get-apples) > (define get-apples-allowed? > (make-parameter #f)) > (define (get-apples) >