3 ms·
Disclaimer noted, but as to your lisp/HTML example, HTML and lisps actually have a lot in common - if you strip away the end tags and the angle brackets, you ge
by zephjc 17y ago
Disclaimer noted, but as to your lisp/HTML example, HTML and lisps actually have a lot in common - if you strip away the end tags and the angle brackets, you get something very lispy looking
<div>
<span>Hello</span>
</div>
has the same (prefix) order of operators and operands as
(div
(span "Hello"))
Off the top of my head, the "hiccup" package for Clojure has an 'html' function (macro?) that translates just that sort of stuff directly into html
- ramchip 17y agoAlso, AFAIK people generally use Lisp to generate HTML, not as a replacement to HTML.
- mixmax 17y agoInteresting. Do you by any chance have links to some newbie resources? Maybe it's worth reading up on some sort of lisp. Clojure maybe?
- zephjc 17y agoclj-html - http://github.com/mmcgrana/clj-html http://github.com/mmcgrana/clj-html which is deprecated by hiccup - http://github.com/weavejester/hiccup http://github.com/weavejester/hiccup though the latter has pretty lame examples
- Zak 17y agoGenerating HTML from Lisp is very easy and natural. Of course, there are situations where it might be better to use an HTML template, and there are libraries for that too. Here are a few more examples of HTML generation in Lisp: A tutorial about writing an HTML-generating DSL in Common Lisp: http://gigamonkeys.com/book/practical-an-html-generation-library-the-interpreter.html http://gigamonkeys.com/book/practical-an-html-generation-lib... The Common Lisp HTML generation library most people actually use[0]: http://weitz.de/cl-who/ http://weitz.de/cl-who/ HTML generation in PLT Scheme's Continue framework: http://docs.plt-scheme.org/continue/index.html#(part._.Rendering_.H.T.M.L) http://docs.plt-scheme.org/continue/index.html#(part._.Rende... Arc's built-in HTML generation (powers this site): http://files.arcfn.com/doc/html.html http://files.arcfn.com/doc/html.html [0] I'm not actually certain about that, but I think it's the most popular.