113

What real world applications are people using Clojure for?

I use Groovy for glue stuff, Java for big systems, Python/Perl scripts for parsing and glue. I could see myself calling into Clojure from Java but I can't see where I would use it in its own right. It strikes me it would be easier to use almost any scripting language for adhoc tasks.

I'm not a Groovy expert or a fanboy by any means but it strikes me that it has a better support framework, tools and a lot of the language constructs (closures, functional programming). The same could be said for Scala.

Could it be that its future is as a language that is embedded in other systems?

nmichaels
  • 49,466
  • 12
  • 107
  • 135
Fortyrunner
  • 12,702
  • 4
  • 31
  • 54
  • 25
    Everything except making me a sandwich. – wheaties Nov 23 '10 at 20:26
  • 13
    @wheaties: Have you tried `(sandwich me BLT)`? – FrustratedWithFormsDesigner Nov 23 '10 at 20:30
  • Groovy is also older than Clojure as well. Tools aren't magically written and stable overnight. – Rayne Nov 23 '10 at 20:30
  • 3
    Why would you not use Clojure for "big systems", too? ISTM that, being less verbose than Java, your systems would not need to be so big in Clojure. :-) – Ken Nov 25 '10 at 03:55
  • My definition of a big system is one with half a dozen developers, a large code base and a large user base. – Fortyrunner Nov 27 '10 at 17:23
  • 2
    Looking at the answers - I guess that people are using it for some cool stuff. I wonder how many enterprises will choose it for long term development stuff though? – Fortyrunner Nov 27 '10 at 17:23
  • 1
    I know it's been a long time, but it takes a sharp mind to program in a functional language. Sharp minds are expensive, so I don't know about Clojure's LTD potential from a business standpoint – not until it becomes far more pervasive than it is even today (five years later). – Sean Allred Apr 24 '15 at 02:35

5 Answers5

109

I've used Clojure for:

  1. Scraping web pages
  2. Shell scripts
  3. Building websites
  4. Playing around with OpenGL
  5. Writing async webservers
  6. HTML Templating
  7. Running parallel tasks (fetching multiple URLs and process in parallel)
  8. Playing around with real time audio
  9. Simulations

That's the practical / fun stuff.

But Clojure has plenty of theoretical depth as well. Ideas that will become increasingly more relevant as the mainstream comes to really understand the potential of Functional Programming.

A personal opinion, but Clojure flat out provides better language constructs for organizing software correctly (without causing undue pain for the working programmer) of all the languages I've used thus far academically and professionally - C, C++, Objective-C, Java, JavaScript, Python, Ruby.

Which isn't to say Clojure is perfect. But it seems to me that it's built on a better foundation than most of what's out there.

dnolen
  • 18,496
  • 4
  • 62
  • 71
  • Are you David Nolen? the guy who gave the talk on "Clojurescript: Lisp's Revenge" . It was an awesome talk! – Amogh Talpallikar Jun 04 '14 at 04:48
  • 1
    // , What do you mean by, "provides better language constructs for organizing software correctly"? E.G. http://dev.clojure.org/display/community/Library+Coding+Standards? – Nathan Basanese Jun 25 '15 at 03:28
  • Shell script? Did you have any issues with the slow startup time of Clojure? – masnun Sep 05 '15 at 08:59
  • 2
    @maSnun on modern hardware startup time is around 1 second or less. This is fine for shell scripts. – dnolen Sep 05 '15 at 15:10
  • 1
    @dnolen Thanks for taking the time to reply. I am a new clojure enthusiast and it takes like 20 secs when I try to run the jar file I create with lein uberjar. I am on OS X, Macbook with core i5 and 16GB RAM. Do you use any special optimizations? – masnun Sep 05 '15 at 15:31
  • 5
    @maSnun uberjars aren't for shell scripts, they are for application deployment. Optimizing applications is a JVM general question, nothing specific to Clojure. You can write hash bang shell scripts with Clojure as easily as any other scripting language and that's what I would recommend. – dnolen Sep 09 '15 at 13:15
22

Maybe start with Rich Hickey's rationale.

As for real-world apps, how about this roll call of production use from the google group?

Alexander Falk
  • 499
  • 8
  • 21
Corbin March
  • 25,526
  • 6
  • 73
  • 100
19

Clojure is being used extensively for processing large volumes of data. It is very well suited to data mining/commercial-AI (ie: Runa) and large scale predictions (aka WeatherBill). Clojure's concurrency story really helps in these data heavy domains where parallel processing is simply the only answer.

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
14

Well, that is a difficult question to answer. What do you want to do? There isn't a whole lot that Clojure isn't really suited for. I mean, it isn't really great for one off command-line scripts because of the JVM startup time (unless you're using cake or something similar), but that can be said for any JVM language.

Clojure is especially suited to concurrency tasks. It was built from the ground up to be an awesome language for concurrency, and it's STM system is fantastic. If you need to do some hardcore concurrency related stuff, Clojure might be especially suited to that task.

However, one must remember that Clojure is a general purpose language. It isn't only suited to certain niches, and it tends to be useful for many or all of the things that the other JVM languages might be suited to.

Clojure was designed to be a fantastic language in it's own right, and not necessarily a glue language. You can build systems from the ground up in Clojure without ever touching Java code directly. Not that it doesn't make a nice glue language, I know lots of people have used it as such.

If you have something in mind, the best thing to do is to consider what the solution would look like in whatever languages that are options. If it looks/feels better in Groovy, go with Groovy. They're both radically different languages, and they both have their purposes.

Rayne
  • 31,473
  • 17
  • 86
  • 101
  • Even then I found myself writing CLI Clojure scripts, just because I found the language pleasant to write and did not mind the startup time in my case. – nha Sep 11 '16 at 15:19
7

You can use Clojure anywhere you would use Groovy or java. Why would you want to do that ? Some people like lisp. Those will be choosing clojure over Groovy. Some people dislike lisp. Those will be choosing Groovy.

Vagif Verdi
  • 4,816
  • 1
  • 26
  • 31
  • 2
    It's not a mater of choice only, clojure has tons of features which non other language has ) somehow no one mentioned anything, i barely remember talks in conferences so i won't be able to write a proper answer in here – holms Feb 27 '18 at 21:27