Category Archives: programming

Asynchronous Function Decorators

Introduction tl;dr Function decorators are a pattern for extracting reusable “ideas” from your code. This document describes how to write a bookend (“before-and-after”) decorator in CoffeeScript that works with callbacks (instead of return values). Let’s say that you have a critical section of code and you want to use a mutex to lock the code. [...]
Posted in programming | 1 Comment

Understanding run n with conde in the Reasoned Schemer

I’m working through The Reasoned Schemer and had some trouble seeing clearly how results are returned when using run n. After Googling a bit, I found a clear walkthrough of the logic on an obscure message board. I’m reposting here to make sure it doesn’t disappear. The key insight is that the n in run [...]
Posted in programming | Leave a comment

Binary Search Revisited

As ubiquitous as it is, the standard binary search algorithm can still be further optimized by using bit operations to iterate through its sorted list, in place of arithmetic. Admittedly, this is primarily an academic discussion, since the code improvement does not decrease the logarithmic complexity of the standard algorithm. Nevertheless, a well-developed programming intuition [...]
Also posted in code | Tagged , | 7 Comments