Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


Interesting. Do you by any chance have links to some newbie resources? Maybe it's worth reading up on some sort of lisp. Clojure maybe?


Generating 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-lib...

The Common Lisp HTML generation library most people actually use[0]: http://weitz.de/cl-who/

HTML generation in PLT Scheme's Continue framework: 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

[0] I'm not actually certain about that, but I think it's the most popular.


clj-html - http://github.com/mmcgrana/clj-html

which is deprecated by

hiccup - http://github.com/weavejester/hiccup

though the latter has pretty lame examples


Also, AFAIK people generally use Lisp to generate HTML, not as a replacement to HTML.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: