5 ms·
I have nothing against Clojure, but I agree with Donald Knuth who said: "Programs are meant to be read by humans and only incidentally for computers to execute.
by benas 6y ago
I have nothing against Clojure, but I agree with Donald Knuth who said: "Programs are meant to be read by humans and only incidentally for computers to execute." [1].
I could be wrong, but I don't find Clojure to be "simple" for humans to read (or write). Here is an example from the blog post:
So let’s write a simple one. Let’s write the factorial function.
(defn fac [x] (if (= x 1) 1 (* x (fac (dec x)))))
Note the "simple one" here. I don't know for others, but this is not simple for me as a human to read, understand and reason about. For instance:
if (= x 1)
As a human, I read this like "if equals x one", which does not translate to my natural language where I would say "if x equals one". So I need an additional mental effort to do the translation. This is not the case in other languages where "if x equals one" would be written like "if x = 1" or "if (x == 1)". If the gap between the natural language and programming language is big, it is difficult for a human to use that programming language. And for Clojure, this gap is big IMO.
(I (wanted) (to learn ((some)) Clojure in the past) but [quickly] ([(realized it was (not) for me)])) [2].
[1]: https://news.ycombinator.com/item?id=16430751 https://news.ycombinator.com/item?id=16430751
[2]: https://twitter.com/b_e_n_a_s/status/1244417191556063234?s=20 https://twitter.com/b_e_n_a_s/status/1244417191556063234?s=2...
- sooheon 6y agoFormatting helps for presentation, just as it does for human text. (defn fac [x] (if (= x 1) 1 (* x (fac (dec x))))) > (I (wanted) (to learn ((some)) Clojure in the past) but [quickly] ([(realized it was (not) for me)])) This is missing semantics for morphology. Delimiters aren't strewn about randomly, they precisely delineate the AST.
- sooheon 6y agoTotally not serious stab at actual semantic representation of your claim in clojure. (state-claim (but (past-tense (desire (learn me clojure))) (past-tense (realize me (not (good-fit? me clojure))))))
- benas 6y agoYes of course, that's incorrect and provocative in purpose. The point is not about the syntax, but about expressiveness: A programming language should make it easy for a human to express (write) his intentions in code and for other humans to interpret (read) those intensions in a natural way. In other words, the gap between the developer's natural language and his/her programming language should be minimal (and this is regardless of the developer's natural language, be it English or whatever).
- Silhouette 6y agoIn other words, the gap between the developer's natural language and his/her programming language should be minimal I'm not sure that follows from the original claim at all. Mathematics has plenty of problems in when it comes to obscure terminology and regrettable notations, yet still vast numbers of people prefer the conciseness and precision of mathematics to using natural language when they want to discuss concepts in science, engineering, programming, etc. At some point, if you're going to work in a technical field, you're going to need terminology and notation to match. Newbies to the field need to learn those before they can understand what is being said "naturally". The alternative is to attempt to dumb everything down to the point where newbies can understand it straight away but, assuming it is even possible, this risks losing a lot of effectiveness in communications between everyone who does have more experience.
- benas 6y agoWriting code is different from writing mathematical equations. Developers (humans) prefer meaningful variable names, method names, expressions, etc. Comparing this to maths where conciseness is key is not the best analogy IMO. And it is not about experience (btw, I have no problem being one of these newbies who "need to learn those before they can understand what is being said "naturally""), it is really about expressiveness to reduce the mental effort to match things (what I have in mind and what I see in code). That's why there are many attempts [1] to create programming languages that are as close as possible to people's natural languages. [1]: https://en.wikipedia.org/wiki/Non-English-based_programming_languages https://en.wikipedia.org/wiki/Non-English-based_programming_...
- sooheon 6y ago> If the gap between the natural language and programming language is big, it is difficult for a human to use that programming language. And for Clojure, this gap is big IMO. English is not all natural languages. Verb-subject-object is the 3rd most common ordering in human languages[1]. Infix is not the only mathematical notation either[2]. I think we all benefit from mind-expansion from learning new languages. [1] https://en.wikipedia.org/wiki/Verb–subject–object https://en.wikipedia.org/wiki/Verb–subject–object [2] https://en.wikipedia.org/wiki/Polish_notation https://en.wikipedia.org/wiki/Polish_notation
- benas 6y agoDid I mention English? That still applies to any language. If the developer's natural language is Russian, the mental effort to translate what the developer wants to express in Russian in his programming language should be minimal.
- SaxonRobber 6y agoDon’t try to reason with clojure zealots, they are just as bad as rust zealots and also less relevant.
- benas 6y agoThank you. This is really the impression I have right now after reading all these replies (and those on twitter as well).. Even though I'm trying to argue in a constructive way from the beginning.
- sooheon 6y ago> my natural language where I would say "if x equals one". You gave an english quotation as an example of your natural language. My only point is that there is no objective "natural" ordering, what is natural to each person depends on their starting point. Because this is somewhat arbitrary and provincial, it is good to be exposed to alternatives.
- filoeleven 6y agoHere’s a trivial extension to one of your examples: (if (= a b c) true) In JS it looks like this: if (a == b && b == c) return true; Let’s build an even bigger one! Clojure: (if (or (= a b c) (not= d e)) true) And in JS: if ((a == b && b == c) || d != e) return true; More verbose, contains some weird symbols, and I’m not sure that my line breaks are helping anybody. Wanna see if an “array” is full of the same value? (apply = [2 2 2]) In JS: [2, 2, 2].every( (val, i, arr) => val === arr[0] ) These are not pathological cases.