I often end up writing macros that both quote some code and expand into
that code where the first one is usually via `racket` or one of the
code-rendering libraries, and the second one gets used to write tests for
the code in my slideshow. These tend to be short and fairly ad hoc macros
because I end up customizing them in various ways to support the
presentation. I haven't found an idea for a nice general purpose library
that does this. In the meantime, there's a bare bones example below. I
usually end up starting like that but then doing various fancy things to
support the specific examples in good ways.

hth,
Robby

#lang racket
(require slideshow
         slideshow/code
         syntax/parse/define)
(module+ test (require rackunit))

(define-simple-macro
  (code+run e)
  (values (code e) e))

(define-values (x^2+1-pict x^2+1-func)
  (code+run
   (λ (x)
     (+ (* x x)
        1))))
(module+ test
  (check-equal? (x^2+1-func 0) 1)
  (check-equal? (x^2+1-func -1) 2))

(slide x^2+1-pict)



On Sun, Feb 21, 2021 at 8:05 AM David Bremner <[email protected]> wrote:

>
> I mostly use emacs org-mode documents for making (latex beamer) slide
> decks. This allows me to "tangle" the example code from the slides,
> along with whatever needed supporting material, to generate example
> programs that I can share with students.  Is there a (pre-built?) way to
> do something similar with a #lang slideshow document? I guess in
> principle I could embed my slideshow program in an org-mode document,
> but I wondered if this could be accomplished with racket, and with less
> levels of compiling.
>
> d
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/87o8gdplce.fsf%40tethera.net
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOPZPhpfL%3DELhd1k9Z%2B130XDBC7rPcF9%2BE09VA0ei79MkA%40mail.gmail.com.

Reply via email to