Re:Is Clojure dying, and what has Ruby got to do with it?
by city41 on Thursday May 25, 2017 @07:10PM
(#14420829)
Quantity is only one aspect. Structure and ability to mentally parse out patterns matters too. I don't mind Lisps and use Clojure regularly, yet I'd still argue your JS examples are easier to read than the Lisp ones.
Heck even Clojure seems to agree, just the simple act of using vectors for various things (ie function parameters) helps with the readability
((fn [a b]
(* a b)
) 6 4)
Re:Is Clojure dying, and what has Ruby got to do with it?
by falcolas on Friday May 26, 2017 @09:22AM
(#14423796)
Well, vectors are a workaround for the challenges in creating homeoiconic lists that the JVM understands.
And if I'm frank, the JS examples are easy to read because you're familiar with the syntax. When you first started to learn C style syntax, it was likely just as confusing. I've spent a fair bit of time with lisp now, and the parenthesis are no more or less confusing than any of the symbols used in other languages. They're just scope delimiters.
Re:Is Clojure dying, and what has Ruby got to do with it?
by city41 on Friday May 26, 2017 @12:12PM
(#14425062)
I disagree. The JS is easier to read because it has an easier to parse structure. I've been coding in clojure for several years now.
Re:Is Clojure dying, and what has Ruby got to do with it?
by bshimmin on Thursday May 25, 2017 @06:09PM
(#14420549)
For your second example, your JavaScript is wrong. Let's compare the ES2015 JavaScript:
((a, b) => a * b)(6, 4);
...against the Clojure: ((fn [a b] (* a b)) 6 4)
Not a lot in it, really, is there?
Re:Is Clojure dying, and what has Ruby got to do with it?
by dragandj on Thursday May 25, 2017 @06:43PM
(#14420725)
The clojure example is really (* 6 4) since * is already a function, not an operator as in most languages.
On the other hand, you can trivially create a macro that would implement the exact es2015 syntax (or at least a very close match), but why would anyone do this?
Re:Is Clojure dying, and what has Ruby got to do with it?
by lilactown on Thursday May 25, 2017 @06:37PM
(#14420698)
If we're golfing...
(#(* %1 %2) 6 4)
Re:Is Clojure dying, and what has Ruby got to do with it?
by smnplk on Thursday May 25, 2017 @09:13PM
(#14421421)
And a bit shorter version...
24
;)
Re:Is Clojure dying, and what has Ruby got to do with it?
by mrkgnao on Thursday May 25, 2017 @11:42PM
(#14421839)
I wonder, does #(* %1) do anything sensible?
Re:Is Clojure dying, and what has Ruby got to do with it?
by latte on Friday May 26, 2017 @07:31AM
(#14423310)
Clojure's * can accept any number of arguments, including zero (returns 1 in this case), one (acts as identity function on numbers) or more than two (returns the product of all arguments). This helps to simplify arithmetic expressions in some cases (e. g. polynominals) and allows to calculate a sum or product of any sequence, including empty one, using (reduce * xs)
Let's try something a bit harder.
vs. 10 first, 8 second.Yes, "why all the [symbols]" indeed.