Alex Collins – Blog

Things I'm learning; lessons or otherwise…

Category Archives: Clojure

Clojure’s Concurrency: easy atoms

by atc on August 5, 2012, no comments

Clojure’s atoms let one transactionally and atomically store values. When one uses an atom, Clojure manages the mutation of the value and guarantees atomicity. Such a feature is very useful in a highly concurrent application. Much like Java’s Atomic* classes, but somewhat more powerful. This is a brief introduction. Atomic Values To define an atom, […]

Clojure’s Concurrency: Futures and Agents in Harmony

by atc on July 29, 2012, no comments

I’ve previously written on the wonders of Clojure’s agents, giving the programmer a wonderfully easy way of writing asynchronous code with very little effort. Here’s a slightly more complex example for those wanting more context. Combining Futures and Agents We’ll use this (deliberately poor) inefficient find-primes in a (future) to allow for asynchronous processing in […]

00 (agent) – Clojure’s Concurrent Agents in action

by atc on July 29, 2012, 2 comments

or Clojure’s concurrency agents – a simple example Clojure has some fantastic concurrency idioms. Agents are but one example of what’s available to the JVM lisper — alongside refs, atoms and vars — that make concurrent programming very easy. I thought I’d articulate my understanding to help embed the knowledge but to also provide a […]

Clojure LIX Parser

by atc on June 17, 2012, no comments

I’m loving the challenge that Clojure (or LISP in general) is giving me. I have to approach problems in an entirely new way. One of my go-to challenges when learning a new language is to write a LIX parser and I’ve just finished it in Clojure. Of course, it’s open source and available on Github.

Leiningen and standalone clojure programs

by atc on January 27, 2012, no comments

Hacking away at various clojure-related stuff lead me to start using Leiningen. “Lein” is a build tool similar to Maven (and interoperates in fact…) to help you concentrate on coding. At some point in the day’s coding I wanted to run my code standalone instead of in a REPL. I needed a main entry point […]

Learning Programming Languages

by atc on January 26, 2012, no comments

I’m a hacker. Hackers like learning. Every year I try and learn a new programming language: it helps me to get better at thinking, I learn new ways of programming, it’s fun and I keep abreast with technology. In picking up a new language I run through certain easy problems that help me tackle the […]