Fengyang Wang

Lispy HTML

Jun 18, 2016

I’ve become convinced that s-expressions are one of the best ways to encode data. And HTML, in many ways, is data.

It seems like life would have been so much easier if the powers that were decided to use this syntax:

(html ([lang "en"])
  (title "An HTML Page")
  (p "This is a simple HTML page."))

instead of

<!DOCTYPE html>
<html lang="en">
  <title>An HTML Page</title>
  <p>This is a simple HTML page.</p>
</html>

Furthermore, the former syntax has the potential to allow macros—which can not only simplify complex documents, but also save HTTP traffic. Finally, if this were the format of HTML, then JavaScript would indeed look a lot like a lisp, as so many claim it is.

But that’s just talking the talk. I’d rather walk the walk! I’ve rewritten my résumé with s-expressions, which are then compiled into plain HTML by a currently-unreleased Julia tool. (Julia is basically a lisp anyway!) More to come in the future.