[plt-scheme] Slideshow macro problem
The slideshow/step module uses unhygienic macros, and you're running
into one of the many problems with that. I suggest instead checking
out the slideshow staging tools in my planet package:
http://planet.plt-scheme.org/package-source/cce/scheme.plt/7/0/planet-docs/manual/graphics-section.html#%28part._slideshow%29
Carl Eastlund
On Mon, May 31, 2010 at 3:25 PM, Nadeem Abdul Hamid <nadeem at acm.org> wrote:
> I'm trying to take something like the following and write a macro to help generate slide items:
>
> #lang slideshow
>
> (require slideshow/code)
> (require slideshow/step)
>
> (void
> (with-steps
> (a b)
> (slide
> ((vonly a) (code (lambda (x) "hello")))
> ((vonly b) (code (lambda (x) "bye"))))))
>
>
> So I tried:
>
> (define-syntax (code-only stx)
> (syntax-case stx ()
> [(_ id exp) #'((vonly id) (code exp))]))
>
> (void
> (with-steps
> (a b)
> (slide
> (code-only a (lambda (x) "hello"))
> (code-only b (lambda (x) "bye")))))
>
>
> But this highlights "vonly" with an error "expand: unbound identifier in module in: vonly".
>
> So then I thought of maybe wrapping "with-steps" with my own macro that defines "code-only" inside of it, but I can't seem to get it to work; something like the following...
>
> (define-syntax (my-with-steps stx)
> (syntax-case stx ()
> [(_ (step-name ...) expr0 expr ...)
> (....??? do something in here to define "code-only" macro ???....
> #`(with-steps (step-name ...) expr0 expr ...))]))
>
>
> Any suggestions?
>
> Thanks,
> nadeem