It seems as if everything needs to be wrapped in parenthesis in clojure. Even a simple hello world!
(println "Hello world!")
What is the benefit of that syntax decision?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The fundamental reason is that Clojure was designed as a homoiconic language, i.e. code is expressed in the core data structures of the language. All Lisps share this property, but few other languages do. As a result, the entire language design of Lisps is strongly influenced by this decision.
The choice was made early in the design of Lisp that lists would be used for function invocation in the form:
This has lots of advantages:
(cons function-symbol list-of-args)The function name could have been put outside the parentheses:
But this would have many disadvantages: