Re: [racket-users] is there a way to syntax-local-lift- something into a define-syntax?

2016-10-09 Thread Stephen Chang
Yes, that worked. Thanks.

On Sun, Oct 9, 2016 at 8:11 AM, Matthew Flatt  wrote:
> Does `syntax-local-lift-module-end-declaration` work?
>
> At Sat, 8 Oct 2016 19:29:19 -0400, Stephen Chang wrote:
>> I'm trying to write a provide transformer that wraps a provided
>> identifier and then provides that instead.
>>
>> For example,
>> #lang racket
>> (require (for-syntax syntax/parse racket/provide-transform))
>>
>> (define-syntax wrapped-out
>>   (make-provide-pre-transformer
>>(lambda (stx modes)
>>  (syntax-parse stx
>>[(_ f)
>> #:with wrapped-f
>> (syntax-local-lift-expression
>>  #'(lambda args (display "applying ") (displayln 'f)
>> (apply f args)))
>> (pre-expand-export
>>  #'(rename-out [wrapped-f f]) modes)]
>>
>> (provide (wrapped-out +))
>>
>> A program requiring my module and using addition will print "applying +".
>>
>> But I actually want to wrap f with a macro. Is this possible? (Is this
>> an XY problem?)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] is there a way to syntax-local-lift- something into a define-syntax?

2016-10-09 Thread Matthew Flatt
Does `syntax-local-lift-module-end-declaration` work?

At Sat, 8 Oct 2016 19:29:19 -0400, Stephen Chang wrote:
> I'm trying to write a provide transformer that wraps a provided
> identifier and then provides that instead.
> 
> For example,
> #lang racket
> (require (for-syntax syntax/parse racket/provide-transform))
> 
> (define-syntax wrapped-out
>   (make-provide-pre-transformer
>(lambda (stx modes)
>  (syntax-parse stx
>[(_ f)
> #:with wrapped-f
> (syntax-local-lift-expression
>  #'(lambda args (display "applying ") (displayln 'f)
> (apply f args)))
> (pre-expand-export
>  #'(rename-out [wrapped-f f]) modes)]
> 
> (provide (wrapped-out +))
> 
> A program requiring my module and using addition will print "applying +".
> 
> But I actually want to wrap f with a macro. Is this possible? (Is this
> an XY problem?)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] is there a way to syntax-local-lift- something into a define-syntax?

2016-10-08 Thread Stephen Chang
I'm trying to write a provide transformer that wraps a provided
identifier and then provides that instead.

For example,
#lang racket
(require (for-syntax syntax/parse racket/provide-transform))

(define-syntax wrapped-out
  (make-provide-pre-transformer
   (lambda (stx modes)
 (syntax-parse stx
   [(_ f)
#:with wrapped-f
(syntax-local-lift-expression
 #'(lambda args (display "applying ") (displayln 'f)
(apply f args)))
(pre-expand-export
 #'(rename-out [wrapped-f f]) modes)]

(provide (wrapped-out +))

A program requiring my module and using addition will print "applying +".

But I actually want to wrap f with a macro. Is this possible? (Is this
an XY problem?)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.