3 ms·
I started using Clojure roughly around the same time as the OP and have mostly abandoned Python as my general programming language in favor of Clojure. Here's w
by rlander 15y ago
I started using Clojure roughly around the same time as the OP and have mostly abandoned Python as my general programming language in favor of Clojure. Here's why:
1. Simplicity. No more thinking about objects and their weird/complex interactions. Although even in Python I was used to writing functions instead of classes, every once in a while I was forced to think about classes. I think objects are the wrong kind of abstraction for 99% of what I do. In clojure you just define a map and write functions that operate on it.
2. Incremental development. Yes, you can somewhat do that in iPython, but it's limited. In Clojure, I can start development at the repl, move code to the file/namespace when it is good enough, run the program, go back to the repl and insert myself into that namespace and modify live code, on the fly.
3. Immutability. I was already sold on immutability from Erlang.
4. Functional programming. Same as above.
5. One language, multiple runtimes. Clojure was designed to be a hosted language. This means it is not endemic to the JVM as noted elsewhere in this thread. You can already use clojure to target the JVM, CLR, Javascript and Python. No more encode/decoce Json/Xml/Yaml whatever between runtimes.
Now, one of the reasons it took me so long to "discover" clojure is the JVM. Most books assume you are a Java programmer and are familiar with Java and the JVM, which was not my case at all. In fact, besides not knowing anything about the JVM, I also hated Java the language. But you eventually learn to like the JVM and everything that comes with it.
- tferris 15y agoThanks. Gave me a much better understanding. Now, I want to try it. How does Clojure compare to ClojureScript?
- spacemanaki 15y agoIf you're starting out, I would recommend Clojure first. ClojureScript is basically the same language, although there are large pieces missing (since JS is single-threaded the only managed reference supported is atom, there is less support for runtime reflection like docstrings and exploring namespaces dynamically) but right now things are a bit rough around the edges, although they are getting better rapidly (see: ClojureScript One). It's just that when you get stuck with some issue with ClojureScript (like a browser connected REPL barfing on you or debugging the JS that comes out of the ClojureScript/Google Closure compiler, or understanding how macros work) I think it really helps to have a solid grasp of Clojure. See this for more details, although it might not mean much to someone new to Clojure: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure https://github.com/clojure/clojurescript/wiki/Differences-fr... That being said, if you have some desire to experiment with alternatives to JS in the environments that is has traditionally been the only choice, ClojureScript is a compelling alternative, and ClojureScript One is an absolutely fantastic place to start. I have really enjoyed working with it and with ClojureScript in general, and huge props are deserved to those making it a better experience, because it's come a long way very fast.