Author Archive

Using refs in Clojure to Scope State

I mentioned a couple of posts ago about a technique for scoping state I used when I programmed in Scheme more often than I do now.  As I’ve been picking up Clojure as my hacking language of preference, I was surprised to find that it doesn’t support the same idioms.  In Clojure, any variables referenced [...]

Read the rest of this entry »

Elisp Bytecode Compilation for Speed

My Emacs startup time was stretching beyond 10 seconds, which seemed a bit offputting even for a text editor cum operating system. I do have a fair amount of elisp loading at startup, however, and though I have played with byte-code-cache, I determined there must be an easier way to compile all my elisp files [...]

Read the rest of this entry »

Fine Grain Scoping in Scheme With Let

In Java, there are four scopes: public, package friendly, protected and private.  These are useful, but rather coarse.  It would be nice to be able to specify a variable that was only visible to a select set of methods.  For example, suppose you wanted to develop a counter that could not be modified without being [...]

Read the rest of this entry »

Rationality

It took me 30 years, but I woke up this Sunday morning and realized that rational numbers can be expressed as the ratio of two integers.

Read the rest of this entry »

Fibonacci

By far the most brain-bendingly elegant definition of all the Fibonacci numbers I have ever encountered: (def fibs (lazy-cat ‘(1 2) (map + fibs (drop 1 fibs)))) Found over an the clojure-euler wiki.

Read the rest of this entry »

Project Euler

Just watched the December 2007 Google Authors session with Randall Munroe, creator of the XKCD webcomic.  Really good talk; he seems like a real geek, which is awesome.  He inspired me to sign up for Project Euler, which I have.  I did the first problem in a couple of minutes, and visited the forum to [...]

Read the rest of this entry »

Creating Executable Jars With Clojure

Clojure is a superb new-ish lisp for the JVM that is quickly becoming my preferred hacking playground.  As with any new language, as soon as you write anything worthwhile, you want to figure out how to distribute it.  In Clojure’s case, even though Clojure is functional and is dynamically compiled, the process of creatng an [...]

Read the rest of this entry »

Macbook failure

My Macbook (13″, purchased May ’07) just ceased to boot (black screen on startup).  Tried all the standard tricks, no luck.  Took it in to the Apple store and they tested and declared that one of the memory (RAM) slots had failed, but it would boot if I removed the RAM from that slot.  They [...]

Read the rest of this entry »

Trying to figure out if there is anything in the canonical definition of streams (lazy lists) that says that you need to keep the initial elements of the stream after use (if, for example, you’re recursing down the list and the head elements are getting garbage collected). Can streams be used as iterators when traversed [...]

Read the rest of this entry »

Discovered Backpack a while back (February), a service from 37Signals that allows you to manage your data online in a variety of ways.  It seems like a shame to use their service when you have your own domain, so I decided that some of their features I could make use of with a “journal” approach [...]

Read the rest of this entry »