Monthly Archives: February 2012

Practical encounter with defprotocol in Clojure for JSONising MongoDB’s ObjectId

I’ve seen examples that make use of defprotocol in Clojure, but have never tried it out myself. Until now. I’m working on the librarian-clojure project which aims at offering a book manager in Clojure. It’s more for learning Clojure while developing something potentially useful. I managed to encourage Konrad Garus to join the project and […]

Frameworks, Languages Tagged , 2 Comments

Today’s a palindrome redux – a slimmer version of palindrome? function with reduce

After some tinkering with the palindrome? function I presented in the previous blog post I received a bunch of very educative responses that ultimately guided me to the following slimmer version of the palindrome? function. There’s no map function, but the point was to have it if it could improve the function. I could also […]

Languages Tagged 6 Comments

Today’s a palindrome – how to check palindromes in Clojure

There’re countries like Poland that use dates in the format ‘dd.mm.YYYY’, so today’s 21.02.2012. As pointed by @KevlinHenney on twitter it’s a palindrome and I was pleasantly surprised to find it out. I came up with the idea of writing a Clojure function to check if a given string is a palindrome. I remember the […]

Languages Tagged 10 Comments

AOT-compile all namespaces in a Clojure project – :aot :all in project.clj (leiningen)

It’s been a couple of times when I ran across a compilation issue while starting up the librarian-clojure project. I guess refactoring in Clojure or any dynamic programming language is not as easy to achieve as in static languages, and perhaps Ahead-of-time (AOT) Compilation could be a solution. I’m yet to join a project with […]

Languages Tagged 1 Comment

clj-time and Joda Time to pretty-print my son’s age in Clojure

In Clojure’s lein and clj-time to calculate my son’s age I wrote about clj-time to help me calculate my son’s age. What I missed was how to display weeks, days and hours and such in a format like: 4 months and 4 days and 5 hours and 10 minutes. Konrad Garus pointed out at org.joda.time.format.PeriodFormatterBuilder […]

Languages Tagged Leave a comment

(clojure.java.browse/browse-url “http://clojure.org”)

While reviewing the sources of RESTful Clojure webapp skeleton w/Compojure, Ring, Enlive, and ClojureQL I found the clojure.java.browse namespace with the browse-url function I was looking for for some time. By a complete chance I stumbled upon this function which I happily incorporated in the librarian-clojure project. The function requires a URL to be open, […]

Languages Tagged Leave a comment

How I learnt git pull requests

That was an amazing experience that ultimately turned into a git pull request into Midje – a test framework for Clojure. I’m working on a side project – librarian-clojure – which aims at providing a CRUD-like web application to manage books and when a colleague Konrad Garus cloned it to his own repo where he […]

Frameworks, Languages Tagged , Leave a comment

Mastering lein run

In hangman with lein run, Incanter, and opencsv – Counterclockwise is here, too I mentioned the hangman project in which I’d come across lein run . I decided to use it in a side project of mine – librarian-clojure. I ran lein run to see what would happen. Ouch, but not much. The error message […]

Languages Tagged 1 Comment

hangman with lein run, Incanter, and opencsv – Counterclockwise is here, too

It was just yesterday when I once again listened to the presentation of Stuart Halloway – Clojure in the Field and was reminded about supercsv and his arguments to expect a csv parser in the Java SDK distribution. While scanning Clojure mailing list I stumbled upon [ANN] Clojure Hangman from Jozef Wagner and hoping to […]

Languages Tagged 5 Comments

Clojure’s lein and clj-time to calculate my son’s age

It’s not as easy as I initially thought to calculate the exact age of my son when the days fly by quickly and the time interval is usually measured in weeks or (less often) months, or hardly thus far – years. That’s why I thought about setting up a Clojure project with lein‘s help to […]

Languages Tagged 3 Comments