3 ms·
I'm coming to Clojure from doing some relatively basic scientific programming in Ruby and Python. Mostly Python. I don't have a formal background in programming
by phren0logy 16y ago
I'm coming to Clojure from doing some relatively basic scientific programming in Ruby and Python. Mostly Python. I don't have a formal background in programming, and both Ruby and Python made it easy for me to automate portions of my data analysis tasks. Python's excellent scientific libraries allowed for even further integration into my data analysis tool chain.
I ran into a few issues that nudged me toward Clojure:
1. Although Python has a richness of libraries, there were still some niche, domain-specific libraries available only in Java that look really appealing.
2. I looked at learning Java a few times, and I had a hard time justifying spending a lot of time learning it. The gains didn't seem that big for the tedium I was feeling doing the reading/exercises.
3. Lisp syntax is quick and easy to learn.
4. Functional programming makes more sense to me. For example my Python style involves an unreasonable amount of list comprehensions.
5. For scientific/numeric computing, baked in parallelism/concurrency is extremely appealing.
6. I was also considering learning R, but when I saw Incanter have been hoping I could learn Clojure and make use of this excellent library. That way I con't have to move between a general purpose language and a data analysis language.
I suspect I'm not alone.
- devonrt 16y agoClojure has (roughly the equivalent) of problem #1. Java has a lot of, err, great libraries, I guess but many of them are, sadly, hidden behind a Java-esque API. To use them from Clojure you will need to spend time wrapping up the Java-esque nature of the API into something more Clojure-like and unfortunately the answer to the question "How do I do X in Clojure" is often "Use Java library Y." Thankfully Clojure's Java interop is relatively painless. Personally I spent a long time in the Java world and then migrated to Python and Ruby. I was shocked at how easy to use many libraries are in the Python world. Libraries like Feedzirra, Mechanize, Python Twitter Tools and so on don't really have equivalents with respect to ease of use in the Java world.
- swannodette 16y ago> Feedzirra, Mechanize, Python Twitter Tools Except these are exactly the kinds of libraries that are easy to write in Clojure. Yes, it's important to have these excellent utility libraries, but having those is just a function of time and the size of the growing community - nothing inherent to Python itself. But then you start looking at these really, really powerful mature Java libraries like Joda, Lucene, Neo4j, Netty, Colt, LWJGL - and you realize that creating or adopting a simple idiomatic Clojure wrapper for your use case is going to be downright exciting and fun!
- nimrody 16y agoAs far as scientific/numeric computing goes, you would probably find that NumPy/SciPy perform better (assuming you can vectorize your algorithm).
- brehaut 16y agoI can't make an informed comparison[1], but check out http://ideolalia.com/performance-in-clojure-and-factor http://ideolalia.com/performance-in-clojure-and-factor - the author uses penumbra (clojure's gl wrappers) to offload the vectorised computation to the GPU. That plus clojures inherent concurrency support seems like a pretty awesome mix to me. [1] I've used lots of python and some clojure but never done heavy numeric computation in either
- daniel-cussen 16y ago"3. Lisp syntax is quick and easy to learn." Yep. This is what a beginner friend told me when we compared it to Java.