[plt-scheme] Slideshow macro problem

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Mon May 31 15:25:00 EDT 2010

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

Posted on the users mailing list.