Clojure Development in Spacemacs

I’ve recently been doing some basic Clojure development, and it’s been a huge blast. I’ve played around with it in the past, but never bothered to fully set up a development environment. This time, however, I decided to spend a few evenings perfecting my workflow and becoming familiar with the tools available, focusing on my editor of choice: Spacemacs.
Read more on Clojure Development in Spacemacs…

Rigging up Sublime Text for Clojure Development

I recently started working on a project using Clojure. Since it’s my first experience with the language, I decided to invest a bit a of time setting up Sublime Text so that my editor would be tuned to conquer the oh-so-many parens and the build-and-test workflow provided via Leiningen. I wanted to capture and share this setup to help others get off the ground more quickly, since it took a bit of hunting for plugins and fiddling with Sublime. Read more on Rigging up Sublime Text for Clojure Development…

Pitfalls to Avoid When Moving from Clojure to ClojureScript

I’ve been excited about ClojureScript, its community, and the new tools and libraries that have been appearing, but I’ve only recently started working with it. Using ClojureScript to power a web (or mobile) client to a Clojure backend service seems really compelling. It’d allow for easily sharing code or logic between the different components, as well as a well-designed implementation of modern UI development, via Om Next. It’s also a fun and enjoyable language.

However, while exploring ClojureScript, I’ve run into some areas that left me feeling frustrated. Read more on Pitfalls to Avoid When Moving from Clojure to ClojureScript…

Exploring Logic Programming in Clojure’s core.logic – Overview & Understanding Palindromes

Ever since I saw William Byrd and Dan Friedman present on miniKanren at Clojure/conj a few years ago, I’ve been distantly interested in the topic of logic programming. Recently, my interest has intensified, so I picked up a copy of The Reasoned Schemer and have been working through it.
Read more on Exploring Logic Programming in Clojure’s core.logic – Overview & Understanding Palindromes…

Understanding Homoiconicity in Clojure

For my recent LambdaJam workshop on learning Clojure macros from first principles, I created a set of materials exploring the basic concepts. To really understand macros, you first need to have a good understanding of what makes them so powerful — homoiconicity. In this post, we’ll explore that property of the language.

Read more on Understanding Homoiconicity in Clojure…

Behind the Scenes with CHICKEN Scheme (Part 1)

For the past couple years, I’ve been playing with the Lisp family of languages, namely Common Lisp, Clojure, and Scheme. One of my favorite languages for hobby coding is CHICKEN Scheme, a mature, high-performance implementation of Scheme that compiles to portable C code. CHICKEN’s variety of built-in features and downloadable libraries, excellent FFI support, and helpful community make it a very appealing language.

Recently, I came across SPOCK, a compiler and runtime system for compiling Scheme code into JavaScript. As it turns out, SPOCK and CHICKEN have the same creator: Felix Winkelmann, a software developer in Göttingen, Germany. Intrigued, I got in touch with Felix to ask him about CHICKEN, SPOCK, how he got started, and what keeps him motivated to keep working on CHICKEN after more than a decade.

In this first part of the interview, we discuss how Felix became interested in Scheme and programming, why he created and maintains CHICKEN, and what makes it special. In part 2 (coming soon), we’ll cover SPOCK, how it relates to CHICKEN, and the origins of the names “CHICKEN” and “SPOCK”.

Read more on Behind the Scenes with CHICKEN Scheme (Part 1)…

Experimenting with Clojure’s PersistentHashMap in JRuby

Over the last few months, I have written two blog posts that mention using Hamster (Efficient, Immutable, Thread-Safe Collection) classes in JRuby: Preventing JRuby Concurrency Errors with Hamster and Making Refs in Ruby Using Celluloid Actors.

The latter post was commented on by Mike Busch he mentioned his evaluation of Hamster and comparing it to using Clojure’s persistent data structures in JRuby. He even linked to a simple benchmark for select he had done comparing the two.

Intrigued, I decided to to do some of my own experimentation and ended up extending Hamsterdam so it could use either Hamster Hashes or Clojure Maps internally. The results were mixed. The Clojure Map did turn out to be faster, but there are some (potentially annoying and confusing) side effects of using a Java collection as a primary data structure in JRuby.

Read more on Experimenting with Clojure’s PersistentHashMap in JRuby…

Clojure Conj 2012: Logic Programming, ClojureScript, and the Importance of Small Services

The third Clojure Conj, a conference dedicated to the Clojure community, was held in Raleigh, NC the second weekend in November. I was in attendance, along with fellow atoms Drew Colthorp and Scott Vokes.

For those unaware, Clojure is a modern dialect of Lisp that was built on top of the Java Virtual Machine. Clojure, being a relatively young language, still has a nascent, close-knit community of talented computer scientists.

Logic Programming

One of the major themes at this year’s conference was logic programming. Nearly a third of the talks involved logic programming in some regard. Some were more esoteric than others, such as William Byrd and Daniel Friedman’s talk about writing logic to find examples of quines (even multiquines!) in Scheme. Another talk by Daniel Gregoire showed a practical side of logic programming by using it in web tests, e.g., expressing your test as logical requirements, rather than imperatively.

Read more on Clojure Conj 2012: Logic Programming, ClojureScript, and the Importance of Small Services…

What I Learned on the Way to Clojure

Recently I had my first experience writing Clojure for a real world desktop application. Previous to this experience I had only written a handful of scripts and read a couple of books (Programming Clojure and The Joy of Clojure).

One of the challenges I faced writing Clojure in a complex desktop application versus contrived exercises was the apparent necessity of mutable state. Our application had configuration state that was loaded, updated, and saved. Moreover, certain data in the application could be updated throughout the session and affected a number of areas in it.

Clojure does not strictly prohibit state and it even has easy-to-use programming constructs to support it that are thread safe and even transactional. In the words of Uncle Ben, “with great power comes great responsibility.” It was important for me to reflect on whether mutable state was the right choice. And if it is, what’s the best approach to dealing with mutable state?

Lastly, I found myself speaking in and falling back on imperative programming patterns, and it was yet another challenge to move past it and embrace Clojure properly.
Read more on What I Learned on the Way to Clojure…