A Polynomial Macro

July 10, 2017

Introduction

In this edition of the blog I am going to cover a very cool macro for conveniently defining polynomials that is also very performant. It's also a great example of how macros work and when you might want to use one.

Continue reading →

Clojure Rising

June 19, 2017

Still Here, Still Doing Clojure

Continue reading →

Another Tetris Clone in Clojure

April 7, 2016

Introduction

Continue reading →

Clojure: Getting Started

December 1, 2015

Introduction

Often people will ask me how to get started in Clojure. Most often they have a Java background, but sometimes they are coming from C++, Python, or some other popular language. Either way, I rehash the same story and spent a bunch of time finding and consolidating the same links as the last time someone asked me this question.

Continue reading →

My Concern with Concerns

October 26, 2015

Introduction

In the Computer Science world we often talk about the value of Separation of Concerns (SoC). This Wikipedia article on the subject says that well-separated code is more modular, maintainable, and reusable. The basic idea is that we separate our code into components by their roles so that those pieces can be used and developed independently as well as assembled into a greater whole.

Continue reading →

Clojure State Management by Example

September 24, 2015

Introduction

Continue reading →

A Clojure Snake Game

August 25, 2015

Introduction

Continue reading →

Clojure is Homoiconic, Java is Not

August 6, 2015

Introduction

Recently I was reading this article regarding what is (or was) new in Java 8 and took an interest in the following section on Lambdas:

Continue reading →

Three Reasons You May Not Want to Learn Clojure

July 22, 2015

Introduction

Continue reading →

Quil, Clojure, and WORA

July 14, 2015

Introduction

Since my last post, I've been playing with the excellent Quil library, a "Clojure/ClojureScript library for creating interactive drawings and animations." Prior to this, I was writing demonstrations using the following scheme:

Continue reading →

A Lunar Lander Game in Clojure

June 24, 2015

Introduction

In a prior post, I spent a great deal of time talking about Predator-Prey systems, ordinary differential equations, and solving these equations in Clojure. In this post, I describe a recent project I did that uses the same ODE solver to do something much more fun - implement a physics-based lunar lander game.

Continue reading →

Differences between Null, Nil, nil, Some, and None

June 11, 2015

Introduction

During a recent code review, a coworker who had the good fortune of jumping straight from Java to Clojure was asking me a few questions about some Scala code she'd been asked to edit. The particular problem involved recursive accumulation of some list data and our conversation drifted towards some questions regarding the different-yet-similar-sounding terms in these JVM languages. Java, Scala, and Clojure together have Null, Nil, nil, Some, and None. Most of these are related in their respective languages to how exceptional behaviors are handled with respect to references and/or collections. Here I explain each of these from the perspective of their host languages and my opinion of the effectiveness of each solution.

Continue reading →

Exercises in Clojure with Commentary

May 27, 2015

Introduction

I was recently browsing some links from my Twitter feed and came across some programming exercises and their solutions. I selected a few that I thought were interesting, solved them, and now I want to present my solutions here along with some commentary on how they were solved. I think the solutions and especially their comments might be helpful to new Clojurists as well as Java developers who are looking for some examples of why Clojure code is so much more concise. Without further ado, here they are.

Continue reading →

Functional Programming from the Fire Hose

May 15, 2015

Earlier this year I gave a presentation at work entitled "Functional Programming (FP) from the Fire Hose." My goal was to present, to a mostly OOP audience, some of the basics of FP while also providing examples that show that FP isn't just academic. You can't sell people on FP with concepts alone. People's eyes just glaze over and roll back into their heads when you start talking functional concepts like first class and higher order functions, immutability, statelessness, referential transparency, homoiconicity, and the like (I won't even say the M-word). With that in mind, I tried to go fast on FP and show several clear examples that demonstrate FP in action, even at a very small scale.

Continue reading →

Predator-Prey Modeling in Clojure

April 28, 2015

Introduction to Predator-Prey Systems

Continue reading →

A-maze-ing Mazes with Clojure

April 11, 2015

Introduction

Mazes can be pretty fun. Children love them. Add a dungeon theme (e.g. monsters, loot, and a dragon boss) and most computer programming adults like them, too.

Continue reading →

Using juxt to Compute Signed Angular Distances

March 31, 2015

Juxt is one of those weird Clojure functions that just doesn't make sense until you see it in action. However, once you get it, you love it. This short example shows a great use of the juxt function.

What does juxt do? It creates a function that is the application of a list of functions to a single argument. In simpler terms, a typical function returns one result for one input. In the case of juxt, you create a function that returns n results for one input. The n results are computed from the n functions that you juxtapose.

Continue reading →

Conway's Game of Life

March 30, 2015

The Project

I wanted to create an interesting project in Clojure that had the following features:

Continue reading →