4 ms·
... then we could write a domain specific language for building web pages and another one for managing additional features, thanks to the power of lisp macro.
by Pompidou 5y ago
... then we could write a domain specific language for building web pages and another one for managing additional features, thanks to the power of lisp macro.
- shakna 5y agoSXML is widely used when combining Scheme and the web, so the DSL has already been made for you, and is actually pretty pleasant to use. Example SXML template, that fills in data fields from a given namespace: (form (@ (method (%data form-method)) (action (%data form-action))) (label "Username") (input (@ (type "text") (name (%data username-input-name)))) (label "Password") (input (@ (type "password") (name (%data password-input-name)))) (input (@ (type "submit"))))
- MathMonkeyMan 5y agoI even do a minimal version of SXML in python, using python's lists, because it's much better than the DOM/builder way. https://github.com/dgoffredo/dgoffredo.github.io/blob/372300b6666c683bfe7674cf7ea106d3cc979e53/bin/sxml.py https://github.com/dgoffredo/dgoffredo.github.io/blob/372300... You could do the exact same thing in javascript.
- bjoli 5y agoDoes the new pattern match work with this? In guile there is (ice-9 sxml match) which matches attributes without order. Incredibly useful. And then there is the whole SXPATH and SXSLT stuff that makes sxml a lot nicer than HTML.
- MathMonkeyMan 5y agoNot sure, but I ported Jim Bender's sxml-match to Racket so I could use it to pull apart some XSD: https://github.com/dgoffredo/stag/tree/master/src/stag/sxml-match https://github.com/dgoffredo/stag/tree/master/src/stag/sxml-... Hardly had to touch it, it's brilliant.
- Pompidou 5y agoNice. I will take a look at this. Thanks