Raghavan Muthu wrote:6. The wikipedia article also says that clojure works on "code as data" principle. The term is fascinating but I could get very little of it. can you just brief about this?
Chris Houser wrote:
This is "code is data". Of course the syntax for lists is a bit different, but Clojure has syntax for lists, hash maps, vectors, and sets, and this syntax is used both for its data and for its code. As with most LISPs, code is primarily made of up lists:
This is the key to macros being not just possible but convenient to write and use. It means it's easy to pass around not just objects and functions, but unevaluated code or code fragments. It means reading in, manipulating, and then saving code back out to files is fairly straightforward. It may not be immediately obvious how this helps, but I continue to be surprised by subtle ways my programs can benefit from the fact that code and data are described and manipulated exactly the same way.