![]() |
|
[Source] R5RS Scheme (Racket/LISP) S-expression to XML converter - 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] R5RS Scheme (Racket/LISP) S-expression to XML converter (/showthread.php?tid=6196235) |
R5RS Scheme (Racket/LISP) S-expression to XML converter - MiguelSanchez - Mar 5, 2022 I'm going to make a nice animated SVG generator, rather then outputting html I'm going to output normal s-expressions which I've just writing homomorphically to XM anyway to preserve a direct mapping. It's just this way I'll have macros and quasiquotes in HTML and SVG. It's short Code (define (->str s) (if (string? s) (string-append "\"" s "\"") (if (number? s)(number->string s) (symbol->string s))))I've got a basic animated SVG demo function named demo, it just takes duration as a variable so I could show the syntax for unquoting a variable in the quasiquote, everything following ` is a quote,it means I'm talking about the literal symbols not what they represent, unless proceeded by a comma (like duration is) which means I'm referring to the variable duration's assigned value not the literal name 'duration. I'll turn this into a tight banner making library soon, and I'll be back for business (with free vouch copies of custom banners when I do) |