- Reflection and metaprogramming
- First-class functions
- Functional programming
- REPL Driven Development
Best overview can be found on official site.
It would be true if I say that Clojure doesn’t have syntax. It just uses Symbolic Expressions (s-expressions): function call is a list where first item — name of the function and the rest — arguments. It’s called prefix notation or polish notation.
; clojure (+ 1 2) ; 3 (max 13 9) ; 13
And here core concepts of clojure syntax is ended!
List is one of the most used data structure in Clojure but how we can use it as data if we use it in the code? We need treating code as data: add quote prefix (') before list or use special form quote. It’s really something like quotes in out regular texts. Of cause quotemakes sens not only for lists.
; clojure '(1 2 3) ; (1 2 3) (quote (+ 1 2 3)) ; (+ 1 2 3)
Greate, we have code as data — one of the most unique feature of Clojure — thanks to quote! For executing data as code you can use eval.
; clojure (eval (quote (+ 1 2 3))) ; 6
So you can do code -> data -> new data -> code and transform your code in runtime. And it was just one example of really powerful conceptions of Clojure!
That’s enough for quick introduction to Clojure, feel free to read all links in this article for full picture. In next article we will talk deeply about syntax.