Lisp/Clojure: Removing unnecessary parentheses through conventions

clojurelisp

I am fascinated to Lisp as it is simple yet powerful. I am just a beginner and I know there have been lots of discussions on removing parentheses from Lisp and its dialects. Yet I request Lisp ninja's to take few minutes answering this.

Will there be any side effects in Lisp/Clojure if they had followed 2 conventions below:

;; function declaration
defn function-name param-1 .... param-n
  ...
  function-body ;; not (function-body)
  ...

;; function call
function-name param-1 ... param-n ;; not (function-name param-1 ... param-n)

While still using () or [] for inline and nested expressions.

(println "hello, ") (println "world !!!") ;; inline    
= a (- 2 3) ;; nested

Best Answer

You can do that, and much more, using sweet-expressions. There is already a working implementation of sweet-expressions for Scheme, which I encourage you to study. The basic idea is that you replace the standard S-expression reader with a sweet-expression reader; everything else stays the same, and you retain homoiconicity and the ability to use macros.

The question is how to implement sweet-expressions in Clojure, since curly braces are already used as a notation for maps, sets, and metadata.

Related Topic