Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "The whole language always available" hold in case of Clojure?

Ninth bullet point in Paul Graham's What Made Lisp Different says,

9. The whole language always available.

There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.

Running code at read-time lets users reprogram Lisp's syntax; running code at compile-time is the basis of macros; compiling at runtime is the basis of Lisp's use as an extension language in programs like Emacs; and reading at runtime enables programs to communicate using s-expressions, an idea recently reinvented as XML.

Does this last bullet point hold for Clojure?

like image 730
missingfaktor Avatar asked Sep 19 '10 06:09

missingfaktor


People also ask

Is clojure better than Common Lisp?

Common lisp comparatively faster than Clojure as it uses compilers like SBCL which makes common lisp faster than C programming or any other low-level programming language and it also provides a variety of different libraries for different concepts that can be included in the program for easy execution.

Why does a Lisp fail?

The reason Lisp failed was because it fragmented, and it fragmented because that was the nature of the language and its domain-specific solution style. The network effect worked in reverse.

Why use Lisp?

Key Points. Lisp empowers programmers to write faster programs faster. An empirical study shows that when programmers tackle the same problems in Lisp, C/C ++ and Java, that the Lisp programs are smaller (and therefore easier to maintain), take less time to develop and run faster.


2 Answers

You can mix runtime and compile-time freely in Clojure, although Common Lisp is still somewhat more flexible here (due to the presence of compiler macros and symbol macros and a fully supported macrolet; Clojure has an advantage in its cool approach to macro hygiene through automagic symbol resolution in syntax-quote). The reader is currently closed, so the free mixing of runtime, compile-time and read-time is not possible1.


1 Except through unsupported clever hacks.

like image 167
Michał Marczyk Avatar answered Sep 17 '22 09:09

Michał Marczyk


It does hold,

(eval (read-string "(println \"Hello World!!\")"))
Hello World!!
nil

Just like emacs you can have your program configuration in Clojure, one project that I know Clojure for is static which allows you to have your template as a Clojure vector along with arbitrary code which will be executed at read time.

like image 33
Hamza Yerlikaya Avatar answered Sep 17 '22 09:09

Hamza Yerlikaya