[plt-scheme] Slideshow best practices and tips?

From: Grant Rettke (grettke at acm.org)
Date: Fri Jul 25 16:12:20 EDT 2008

> Why not instead have a macro that actually understands the slide number and puts it in the
> right place in the list of slides?

Good idea :)

#lang slideshow

(define slides '())

(define-syntax add-slide
  (syntax-rules ()
    [(add-slide num (define (name args ...) body))
     (begin
       (define (name args ...) body)
       (set! slides (append slides `((num . ,name)))))]))

(add-slide 3
 (define (slide-3)
   (slide
    #:title "Slide 3")))

(add-slide 2
 (define (slide-2)
   (slide
    #:title "Slide 2")))

(add-slide 1
 (define (slide-1)
   (slide
    #:title "Slide 1")))

(for-each
 (λ (num/slide) ((cdr num/slide)))
 (sort slides < #:key car))

Posted on the users mailing list.