Clojure/ClojureScript does not have reader macros. I personaly think it is a huge loss as I'm specifially interested in hacking with the syntax. Is there way to develop websites using a lisp with reader macros?
-
2I do not understand this question yet. What parts of the question are particular to web site development? Are you asking for a client-side Lisp? Your focus on Clojure seems to suggest this, but I'm not sure, as "website development" encompasses computation on both the client and server sides. Which are you focusing on? – dyoo Oct 07 '12 at 00:09
-
In what way do you want to "hack the syntax"? Is there something that you are trying to do that normal macros cannot accomplish? – mikera Oct 07 '12 at 00:38
-
1Where do you see that Clojure doesn't have reader macros? http://clojure.org/reader provides details. Is there something else in particular you want to do? – deterb Oct 07 '12 at 04:41
-
2@deterb: He wants to hack the syntax using reader macros, which he specifically mentionned in his question. Related: http://stackoverflow.com/questions/5746801/what-advantage-does-common-lisp-reader-macros-have-that-clojure-does-not-have – Cedric Martin Oct 08 '12 at 01:12
-
1You don't need reader macros to hack the syntax. Of course it is a nice feature to have, but you can always replace the whole parser with a single macro. Any Lisp with a Common Lisp-style macros can do it. – SK-logic Oct 08 '12 at 10:20
-
1Clojure 1.4 made the reader more extensible by introducing reader literals. This most likely gives you at least part of what you want out of reader macros. Reader literals are "data structures tagged by a symbol to denote how they will be read" (c.f. https://github.com/clojure/clojure/blob/master/changes.md). The important difference between this and reader macros is that the representation following the symbol must be some existing reader literal or composition of existing reader literals (strings, vectors, hash-maps). A cool thing about them is that data is strongly decoupled from host impl – rplevy Oct 09 '12 at 05:07
-
There's also a trick to achieve true reader macros in Clojure, it's just dirty. I will let you use Google to find it though. And I didn't tell you it's documented in a blog article by Brian Carper somewhere. – rplevy Oct 09 '12 at 05:10
2 Answers
Common Lisp has Parenscript, that allows you to generate JavaScript from Lisp syntax, and be able to use reader macros.
You can also hook it with slime-proxy and swank-js to have a fully interactive experience.

- 9,343
- 2
- 31
- 36
You might be interested in sweet.js. It's essentially JavaScript with a powerful macro system that does much, if not all, of what reader macros can do. Now, it's not actually a Lisp, but JavaScript was partially inspired by Scheme, and sweet.js's macro system is intended to be the natural extension of the Scheme macro system to a language with non-S-expression-based syntax.
The big caveat is that sweet.js is super-new. It doesn't even have version numbers yet. So it's more something to keep an eye on than something to use for production code just yet.

- 1,239
- 9
- 10