Moxley Stratton

Code Blog

Switching to Octopress From Wordpress

octopress post in atom

Wordpress has been my blogging platform for the last two years, and Drupal for a few years before that. Both are written in PHP and both were installed and maintained on a traditional shared hosting account. I would have stuck with Wordpress if it weren’t for it’s lack of robust Markdown language support. Writing a coder’s blog requires code samples, usually in multiple languages. Github’s flavor of Markdown has proved to be an excellent language for authoring content that includes code samples, and Octopress supports it by default.

Octopress is a wrapper around Jekyll, and Jekyll is well suited for publishing a blog to a Github’s Pages service. Since Jekyll only generates a static site, it can be much faster than a PHP solution like Wordpress or Drupal. When used in conjunction with the Atom text editor, Octopress becomes a powerful blogging platform.

Sometimes Clojure Is More Concise Than Ruby

I find that 90% of the time, Clojure is more verbose than Ruby. Here’s one simple example where Clojure wins a conciseness battle:

;; Subtract two vectors in Clojure
(def a [10 9 8])
(def b [1 2 3])
(map - a b)
;; (9 7 5)
# Subtract two vectors in Ruby
a = [10, 9, 8]
b = [1, 2, 3] { |(a, b)| a - b }
# [9, 7, 5]

What is it about Ruby that makes it less concise in this example?

In my opinion, the OOP nature of Ruby gets in the way. In OOP, there is a message receiver (the object), plus zero or more arguments. In Clojure, there is no receiver, only arguments. In Ruby, the two arguments to Clojure’s map call have to be split up into the receiver and the first argument. Additionally, the arguments to Ruby’s map arrive as a single array instead of of two distinct scalar arguments. This requires the destructor parentheses inside the map block.

The syntactical division between a receiver and it’s arguments is usually not a problem. But every once in a while, it gets in the way. Another division in OOP is between class and instance. I’ve found that this division can sometimes get in the way too.

Ten Secret Key Bindings From OS X

Did you know that when using these applications:

  • Any application on OS X, except Vim and MS products
  • Bash, or any console program with Readline support


Within the world of application development, there is a conspiracy.

$sql = "SELECT * FROM users WHERE username='" . $username . "'";

Clojure Tutorial for the Non-Lisp Programmer

I intend to keep this tutorial as accurate and up-to-date as possible. If you have any suggestions for changes, please leave a comment at the bottom of this page.

Clojure is a functional lisp dialect that uses the Java Virtual Runtime as its platform. The language home page is at