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?

7
  • 25
    Everything except making me a sandwich.
    – wheaties
    Nov 23, 2010 at 20:26
  • 13
    @wheaties: Have you tried (sandwich me BLT)? Nov 23, 2010 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, 2010 at 3:55
  • 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? Nov 27, 2010 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). Apr 24, 2015 at 2:35

5 Answers 5

108

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.

6
  • Are you David Nolen? the guy who gave the talk on "Clojurescript: Lisp's Revenge" . It was an awesome talk! Jun 4, 2014 at 4:48
  • 1
    // , What do you mean by, "provides better language constructs for organizing software correctly"? E.G. dev.clojure.org/display/community/Library+Coding+Standards? Jun 25, 2015 at 3:28
  • 2
    @maSnun on modern hardware startup time is around 1 second or less. This is fine for shell scripts.
    – dnolen
    Sep 5, 2015 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 5, 2015 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 9, 2015 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?

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.

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.

1
  • 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, 2016 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.

1
  • 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, 2018 at 21:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.