Hack Forums
[Source] [Racket] Interactive Slideshow Maker Wizard - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Source] [Racket] Interactive Slideshow Maker Wizard (/showthread.php?tid=6197318)



[Racket] Interactive Slideshow Maker Wizard - MiguelSanchez - Mar 14, 2022

I used to have a bunch of custom hotbars filled with interactive code & media generators, I've lost most of it until I gain the mental strength to go through my old unsorted harddrives.
Luckily I managed to dig up this small section I'd linked to a friend on Facebook.

Written in DrRacket's built-in slideshow lang, syntactically it's still just Racket/Plt-Scheme.

Code
#lang slideshow

(define (readstring) (let ((inp (read)))

                              (if (string? inp) inp

                              (if (symbol? inp) (symbol->string inp)

                              (if (number? inp) (number->string inp)

                                  inp

                                  )))))



(define (getitems) (begin

                     (display "please enter item text, in speech marks if it contains spaces, or :n for next slide \n")

                     (let ((instring (readstring)))

                      (if (equal? instring ":n")                

                     '()

                     (cons instring (getitems))

                     ))))

(define (makeslideshow)

(begin

  (display "Please enter slide title, with speech marks if it contains spaces, \" \" for no title, or :q to quit.")

  (let ((title (readstring)))

    (if (equal? title ":q")

        ""

    (let ((items (getitems)))

     (string-append "(slide

     #:title \"" title "\"" (apply string-append (map (lambda (x) (string-append "(item \"" x "\")")) items)) ")

" (makeslideshow) ))))))



(display (makeslideshow))