4 ms·
I took some time to think about this because it started off as a feeling and not a list of reasons. For me it's mostly centered around control structures - if,
by aaron-santos 10y ago
I took some time to think about this because it started off as a feeling and not a list of reasons.
For me it's mostly centered around control structures - if, for, switch, case (scala's pattern matching). Clojure's control structures are syntactically composed of ()'s and []'s. Scala's aren't. They are a coded into the language's grammar[1][2]. Clojure's ns forms parallel Scala's package and import statements, but are again Clojure's are syntactically composed of ()'s and []'s. I know it's a relatively small point, but control structures make up a significant portion of programs.
As a side note, I took a look at a Clojure grammar also specified for antlr[3]. My initial thought would be that Clojure's grammar would be appreciably smaller. It is, but not by as much as I was expecting. There are a lot of very little additions to the reader that add up [4][5][6].
[1] - Scala's syntax http://www.scala-lang.org/files/archive/spec/2.11/13-syntax-summary.html http://www.scala-lang.org/files/archive/spec/2.11/13-syntax-...
[2] - Examples https://github.com/lrlucena/grammars-v4/blob/master/scala/scala.g4#L96 https://github.com/lrlucena/grammars-v4/blob/master/scala/sc...
[3] - https://github.com/laurentpetit/ccw/blob/3738a4fd768bcb0399630b7f6a6427a3066bdaa9/clojure-antlr-grammar/src/Clojure.g https://github.com/laurentpetit/ccw/blob/3738a4fd768bcb03996...
[4] - http://clojure.org/reference/reader#macrochars http://clojure.org/reference/reader#macrochars
[5] - https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ https://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful...
[6] - See "Special Characters" http://clojure.org/api/cheatsheet http://clojure.org/api/cheatsheet