Take the 2-minute tour ×

I have been following clojure for some time, and some of its features are very exciting (persistent data structures, functional approach, immutable state). However, since I am still learning, I would like to understand how to apply in real scenarios, prove its benefits and then evolve and apply for more complex problems. i.e. what are the easy wins with clojure (e.g. in an e-commerce setup) that can be used to learn as well as ascertain its benefits.

I have investigated clojure based web frameworks, but I am not keen on them, as they need hand-written javascript (as against gwt). So for me, it is more about backend processing. Can someone explain where they applied clojure (in real deployments), and how did it prove useful (and the cons, if any, of using clojure)

Further analysis: Lazy evaluation is an oft example of power of Lisp. Clojure being a Lisp, offers the same advantage. So, a real world example of such an application (in context of clojure) would help me gain insight.

share|improve this question
It would help us if you were more specific, like in which areas you would apply Clojure or another programming language. In other words, what are your day-to-day problems now? In which languages do you currently implement? I chose processing csv files, because I had a real need to pull some badly working C code out of a 4GL application. That created a need for a separate step, and using Clojure to process the csv files along with an http call worked out perfectly. –  octopusgrabbus Sep 18 '11 at 16:03
am working primarily in java and associated j2ee stuff. working in an ecommerce startup I touch a lot of areas - content management, inventory management, catalogue ingestion, checkout etc. Parsing csv and injecting into database is one of the aspect that I deal. How was doing it via clojure better than using a CSV parser lib in java and servlets/jsp. –  142857 Sep 18 '11 at 16:40
In my case better or worse would be comparing to Python. I programmed in C/C++; sustained in Java; and then went straight to 4GL and web languages. It was not better or worse in Clojure. Taking a small, isolated problem and writing it in Clojure, posed minimal risk for our production environment. My original question to you was more about what intrigues you or gets you fired up. Find that; then find a small containable project; and implement in Clojure. You've mentioned csv files. There is a place to start. –  octopusgrabbus Sep 18 '11 at 21:14
You mention the need for hand-written Javascript when using Clojure web frameworks. The new ClojureScript provides an interesting alternative now and there are the first frameworks that offer tight integration of server-side Clojure and client-side ClojureScript. Check out noir and pinot. –  Christian Berg Dec 20 '11 at 16:11

1 Answer 1

up vote 5 down vote accepted

You have mentioned that you work with CSV files. I found these to be very helpful, because I had to parse a csv file -- used clojure-csv; then extract certain columns from that csv file using sequence functions; interleave http form field names using zipmap; and then make http calls to an ASP application using clj-http.client.

(def accumail-url-keys ["CA", "STREET", "STREET2", "CITY", "STATE", "ZIP", "YR", "BILL_NO", "BILL_TYPE"] )

(defn ret-params 
    "Generates all q-parameters and returns them in a vector of vectors."
      (fn [param-vec one-full-csv-row]
        (let [q-param (zipmap accumail-url-keys one-full-csv-row)
              accu-q-param (first (rest (split-at 3 q-param)))
              billing-param (first (split-at 3 q-param))]
          (conj param-vec [accu-q-param billing-param])))

That project was an accelerated Clojure learning exercise.

Two sites 4Clojure.com and http://www.cis.upenn.edu/~matuszek/cis554-2010/Assignments/clojure-01-exercises.html are good places to start working on Clojure exercises. You can build on those.

Also the Clojure Google Group is a very helpful place to get information.

The Univ of Penn CIS exercises, as simple as they might seem, have given me a lot to digest, especially getting the skeleton of a tree, and recently the skeleton problem got a long discussion in the Google Clojure group.

Good luck. cmn

share|improve this answer

Your Answer


