Monthly Archives: September 2010

Greatest common denominator in Scheme.

Here I’ve implemented Euclid’s famous functions for calculating the greatest common denominator. I’ve also implemented a slight addition that allows us to calculate the integer coefficients x and y such that d = gcd(a, b) = ax + by. These algorithms were adapted from Thomas Cormen’s exercises on pages 859-860 of Introduction to Algorithms, 2nd [...]

Posted in Programming | Tagged , , , | Comments closed

Writing a simple PLT Racket program with a test case.

I’m considering deploying a small PLT Racket web server so I thought I should brush up on the most recent version of Scheme that I’m familiar with: PLT Racket. The following is a small sample program and the syntax for testing that function. #lang racket   (require test-engine/racket-tests)   (define (my-factorial x) (cond [(= x [...]

Posted in Programming | Tagged , , | Comments closed

A first adventure in Windows batch scripting.

Scripting on a Unix terminal is so darn easy – the tools are documented in the man pages, online or from a buddy on the phone. Windows batch scripting was another beast entirely. It took me nearly an hour to craft this simple script, which honestly would have been as easy as a more/grep/awk pipe [...]

Posted in Programming | Tagged | Comments closed