Anna Pawlicka

Programmer. Hiker. Cook. Always looking for interesting problems to solve.


About | Archive | Talks

Clojure is addictive (even though it’s breaking my brain)

21 Jun 2013 | clojure

I’m currently reading Clojure in Action, and going through 4clojure exercises. I have also set up a github repo for my solutions. Feel free to suggest better solutions!

I’m getting used to the syntax (parentheses are not scary at all!). And I’m slowly (but surely?) changing the way I think of data structures and functions.

I make mistakes. Some are embarrassing.
When asked to write a function that reverses a sequence (but not using reverse or rseq), my initial solution was this:

(fn [coll]
  (loop [r (rest coll) result (conj () (first coll))]
    (if (empty? r)
      result
     (recur (rest r) (conj result (first r))))))

I was not really using what Clojure has to offer. It can be done as a one-liner:

#(reduce conj () %)

But I’ll get there!


Older · View Archive (25)

Clojure reading list

I’ve been looking into online tutorials, books, online courses and anything else that can help with learning Clojure.

Newer

Pretty charts with dimple.js

I have spent half a day trying to create a bar chart with d3 library. It’s been quite painful so I could not have been happier when I learned about dimple.js. Dimple is powered by d3, but it does not overwhelm the user with the typical complexity of d3. A simple bar chart can be created in just a few minutes! Have a look below for the step by step example of how to create and customise a chart.