My December present to myself was a series of books. One of them was called “Mastering Clojure Data Analysis” by Eric Rochester. It contains a comprehensive set of examples on analysing and visualising data using Clojure. I found it quite interesting mainly because a couple of use-cases covered in the book correllated very well with daily work, so I thought “why not?”. Once I got the book, I realised what’d be the biggest challenge. It’s first written in 2014, and Clojure tooling made an enormous leap in this 5 years. Obstacle? No, challenge! I really wanted to get my hands dirty with some of the examples in there, but I also resisted to use outdated libraries and tools. Also long time ago wanted to start using deps.edn and it was also a good opportunity to to do that. So, long story short, the process began. I read through and roughly got 60% of the idea of the first Chapter (facebook graph analysis). But for sure, real problem solving goes second, but setting up the tooling goes first!

Goodbye project.clj!

(defproject network-six "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :plugins [[lein-cljsbuild "0.3.2"]]
  :dependencies [[org.slf4j/slf4j-simple "1.7.5"]
                 [org.clojure/clojure "1.5.1"]
                 [org.clojure/data.json "0.2.2"]
                 [me.raynes/fs "1.4.4"]
                 [org.clojure/clojurescript "0.0-2202"]]
  :cljsbuild {:builds [{:source-paths ["src-cljs"],
                        :compiler {:pretty-printer true,
                                   :output-to "www/js/main.js",
                                   :optimizations :whitespace}}]})

Hello deps.edn!


{:paths ["src/clj"]
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        org.clojure/clojurescript {:mvn/version "1.10.597"}
        org.slf4j/slf4j-simple {:mvn/version "1.7.5"}
        org.clojure/data.json {:mvn/version "0.2.7"}
        me.raynes/fs {:mvn/version "1.4.6"}
        cljsjs/d3 {:mvn/version "5.12.0-0"}}
 :aliases {:dev {:extra-deps {com.bhauman/figwheel-main {:mvn/version "0.2.3"}
                              com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}
                 :extra-paths ["src/cljs" "target" "resources"]}}}

Also figwheel isn’t used in the book, but I expect it to be a nice way to provide me with a quick feedback loop. Following this scenario, I quickly found that my Emacs couldn’t properly cider-jack-in-cljs any more. This post came in really handy. In a nutshell, this describes how to patch the standard emacs jack-in commands with -Adev flag. I think recently this functionality would be available in the clojure layer out of the box.

Second surprise was on the frontend part. Of course, I wanted to use the most recent stuff, but without prior usage of D3 wasn’t quite hard to notice that it made a huge step forward. Who else got stuck on the first chapter with the frontend part, could find some SOF answers like this very useful.