Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.
Try Clojure
61–70 of 404 posts
Re: Try Clojure
#62> (+ 1 2 '(1 2)) > "3(1 2)" Yup, I'm out.
Fair. I don't mind dynamic typing so much, but I agree that getting clever with automatic type conversion is just plain wat. (reference to: https://www.destroyallsoftware.com/talks/wat )
> (type (+ 1 2 '(1 2)))
#object[String]Re: Try Clojure
#63> (+ 1 2 '(1 2)) > "3(1 2)" Yup, I'm out.
This is one of the real problems of clojure: you need some knowledge of the host language. It's also one of it's major strengths, and the only reason a lisp managed to get so much (relative) commercial traction.
Re: Try Clojure
#64Earlier quoted context omitted.
On the contrary - I think it's much easier! The real advantage of this notation is that it's much, much easier to stack calculations. Example: (/ (+ 34 68 12 9 20) 140) You can imagine how the first part of that could come about: (+ 34 68 12 9 20) And then the second part (pseudocode): (/ sum 140) In Clojure it's easy to mash them together, or for example to paste the first calculation in the second. (/ (+ 34 68 12 9…
A programming language should be first and foremost precise and readable, not concise. I can barely understand the clojure version but when I read the "traditional" one I don't even need to think. If you work with clojure a lot, does it become natural?
Re: Try Clojure
#65Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.
On the contrary - I think it's much easier! The real advantage of this notation is that it's much, much easier to stack calculations. Example: (/ (+ 34 68 12 9 20) 140) You can imagine how the first part of that could come about: (+ 34 68 12 9 20) And then the second part (pseudocode): (/ sum 140) In Clojure it's easy to mash them together, or for example to paste the first calculation in the second. (/ (+ 34 68 12 9…
Re: Try Clojure
#66Cool site, I've never tried Clojure before. My first reaction though is that (+ 1 1) is a highly unconventional and possibly confusing way of writing 1+1, and I'm not sure why that design choice came about.
On the contrary - I think it's much easier! The real advantage of this notation is that it's much, much easier to stack calculations. Example: (/ (+ 34 68 12 9 20) 140) You can imagine how the first part of that could come about: (+ 34 68 12 9 20) And then the second part (pseudocode): (/ sum 140) In Clojure it's easy to mash them together, or for example to paste the first calculation in the second. (/ (+ 34 68 12 9…
(-> (+ 34 68 12 9 20) (/ 140))
Re: Try Clojure
#67I use Clojure nearly daily at my job and at home. Sometimes it's standard Clojure, sometimes it's the excellent Babashka flavor which I use as a make-like task runner and Zsh-like script replacement. It's not the only language I use of course, and Go is a strong second place most of the time especially if I need something compiled to a single binary. But Clojure is where I generally feel most at home thanks to the irreplaceable REPL based development flow which is more like a dialogue with my program than your typical write compile run loop.
Combine that with it running on the JVM and you have a wonderful set of tools to get things done in a pleasant way.
I strongly encourage anyone with even a passing interest in Lisp and functional programming to give it a try. If you're using VSCode there is the excellent Calva plugin to help you out.
Re: Try Clojure
#68> (+ 1 2 '(1 2)) > "3(1 2)" Yup, I'm out.
That's because this is actually ClojureScript (JS under the hood) running as a browser library. If you try that in Clojure, you'll get: > ClassCastException class clojure.lang.PersistentList cannot be cast to class java.lang.Number If you try it in a "proper" ClojureScript dev environment (shadow-cljs), you get nil as a result with this warning: > cljs.core/+, all arguments must be numbers, got [number cljs.core/ILis…
Re: Try Clojure
#69Earlier quoted context omitted.
On the contrary - I think it's much easier! The real advantage of this notation is that it's much, much easier to stack calculations. Example: (/ (+ 34 68 12 9 20) 140) You can imagine how the first part of that could come about: (+ 34 68 12 9 20) And then the second part (pseudocode): (/ sum 140) In Clojure it's easy to mash them together, or for example to paste the first calculation in the second. (/ (+ 34 68 12 9…
A programming language should be first and foremost precise and readable, not concise. I can barely understand the clojure version but when I read the "traditional" one I don't even need to think. If you work with clojure a lot, does it become natural?
99% of the syntax is just (foo arg1 arg2).
Re: Try Clojure
#70Earlier quoted context omitted.
In my experience, the subsets of the community around clojure were one of the biggest problem with it. It's gotten better over the years, but circa 2016 - 2018 it had a spike in popularity despite being very hostile to newcomers. There was an almost apologist attitude towards rough edges or failure modes folks new to the community would fall into. I managed to work with it for a time despite that, but it left me with…
YMMV. I always found it very welcoming and full of interesting people.
Clojure is particularly vulnerable to that because it really is an enterprise applications language. That makes it more vulnerable to learning curve problems than a language like Rust whose most direct competitors are other languages with comparably steep learning curves.