Displaying posts tagged: programming

Base fun

No Comments
The Lisp reader interprets tokens consisting exclusively of numeric characters as integers. For instance (READ-FROM-STRING "25") returns the integer 25, just as you would expect. But the dynamic environment can trump even such cast iron expectations. The number radix used by the reader equals the prevailing value of the *READ-BASE* variable. So binding that to 8 ...

Drawing with CAPI

No Comments
I have been learning a little about CAPI, the GUI library that comes with LispWorks. I particularly wanted to find out how to draw graphics primitives inside a window, as I wanted to modify Paul Graham's toy ray-tracer to display images on screen. CAPI offers essentially the same 2D graphics programming model as the Java toolkits ...

Keystroke commands in Colorforth

No Comments
It's been years since I last wrote a keystroke driven Colorforth program, so I was trawling through the documentation and old code hoping it would jog my memory. It turns out that one word, pad (guessing it's short for 'keypad'), is all that it takes. Under normal circumstances, that is, when the CF system is in ...

Street Numbers solved!

No Comments
In my drive to optimize the performance of the Street Numbers problem solver, I had not taken the time to look at how others had attacked the problem. This was somewhat deliberate on my part, as I didn't want to 'peek at the answer' before having given it my best shot. But recently I came across ...

The straight 'root'

No Comments
The previous algorithm I wrote for the Street Numbers problem was unable to decide, in a constant number of steps, whether a given street number contained a solution (house.) It needed to amble down the street for some distance before being able to tell for sure, and this distance would increase for higher street numbers. So ...