Writings
clojure and why calculating is better than scheming
Last week while attending Clojure/West in Portland I came across a paper called Why calculating is better than scheming. In a nutshell, this paper is a critique to Abelson and Sussman‘s classic textbook SICP - Structure and Interpretation of Computer Programs, used by MIT for many years to teach their introductory programming course.
If you haven’t read SICP, you should. It’s an amazing book. It uses Scheme, a dialect of Lisp, as the vehicle to present fundamental programming concepts.
Writings
Purely functional data structures in Clojure: Leftist Heaps
This post is part of a series about Chris Okasaki’s Purely Functional Data Structures. You can see all posts in the series by visiting the functional-data-structures category in this blog.
Last year I started reading a book called Purely Functional Data Structures. It’s a fascinating book and if you’ve ever wondered how Clojure’s persistent data structures work, it’s mandatory reading.
However, all code samples in the book are written in ML - with Haskell versions in the end of the book.
Writings
bouncer validation lib for clojure
Today I’m releasing bouncer, which was extracted from a project I’ve been working on.
It’s a validation library for Clojure apps and it lets you write code like this:
(def person {:name "Leo"}) (validate person :name required :age [required number]) If you’d like to see more examples and a detailed guide check out the github repository. The README should get you started.
This post however isn’t only about announcing bouncer. It’s also about the motivation and implementation details behind it.
Writings
So long 2012: Year highlights
Keeping the tradition of end-of-year blog posts, here are my year highlights for 2012:
Clojure I started clj-syd - the Sydney Clojure User Group - back in January and it has seen a major uptake. We consistently get an average of 25 people each month and there’s no shortage of talks and topics to discuss. It’s a great crowd and I’m proud to have started it and of being part of it.
Writings
Monads in small bites - Part IV - Monads
This is Part IV of my Monads tutorial. Make sure you read the previous parts:
Part I - Functors
Part II - Applicative Functors
Part III - Monoids
Part IV - Monads (this post)
A quick recap In Part I we learned about Functors, which are things that can be mapped over using a normal function - fmap is used for that.
Writings
Monads in small bites - Part III - Monoids
This is Part III of my Monads tutorial. Make sure you read the previous parts:
Part I - Functors
Part II - Applicative Functors
Part III - Monoids (this post)
Part IV - Monads
Monoids Simply put, Monoids describe types containing a binary function and an identity value.
When applied to the identity value and a random value x, said function leaves its argument x untouched, returning it as a result.
Writings
Monads in small bites - Part II - Applicative Functors
This is Part II of my Monads tutorial. Make sure you read the previous parts:
Part I - Functors
Part II - Applicative Functors (this post)
Part III - Monoids
Part IV - Monads
Applicative Functors In Part I I talked a little about Haskell type signatures and introduced Functors, which provide a way to map standard functions over values which are wrapped inside a Functor - we used fmap for that.
Writings
Monads in small bites - Part I - Functors
Today I join the already bloated group of people who wrote monad tutorials. It’s a bit of a ritual, really.
Different than most tutorials though I aim to take a different approach. The good news is that I won’t be comparing monads to burritos :)
People say one needs to have his/her own epiphany in order to understand Monads and reading explanations from others is of little help. My goal is to disprove that.
Writings
This is what we built in 24 hours
Last week our current client - ninemsn - ran the 3rd edition of their HackDay.
It’s akin to Atlassian’s ShipIt days so if you’re not familiar with the concept, you should check their page but here’s the gist:
We’re given 24 hours to work on whatever we like as long as it’s related somehow to the business
We’re also free to use any technology we want
Writings
Clojure, leiningen 2 and Heroku: AOT compilation gotchas
Recently I upgraded the clojure project I’m working on to Leiningen 2 in order to start using nrepl - since swank-clojure is now deprecated. Little did I know this would lead me to a small debugging adventure.
Heroku I use Heroku as my deployment platform and my project had been running on it for a few weeks without any issues. I also use Heroku’s PostgreSQL solution.
However, by upgrading to Leiningen 2, my project started throwing some weird exceptions during deployment - it couldn’t connect to my database any longer.