Broken Binary Searches Oh My!

So it turns out that nearly every binary search algorithm is broken. Why? Fixed-sized integers, a holdover from machine programming that still lingers in supposedly modern languages like Java. LtU’ers are haggling to decide if it’s a type error, a bad data structure, a language defect, a failure of correctness proofs, or just a bug.… Continue reading Broken Binary Searches Oh My!

Pushing to Lists

Fiddling with some Common Lisp code a few weeks ago, I needed to push items onto the end of a list. After thinking for a moment, I wrote this: (defun push-end (object place) (nconc place (list object)) Since I was fiddling in LispWorks at the time, I discovered that LispWorks already defines its own push-end… Continue reading Pushing to Lists

Idiomatic Macros for Common Lisp

Every programming language has idioms–patterns used so frequently that they are almost considered part of the language itself. (See these C idioms for examples.) Common Lisp, with almost unlimited possibilities for syntax, depends more heavily on idioms to remain comprehensible. Some examples are defsomething or define-something for definitions, something-p for predicate tests, and make-something for… Continue reading Idiomatic Macros for Common Lisp

A Textual CAPTCHA in Lisp

Playing with the first in a (hopefully ongoing) series of Common Lisp Quizzes, I wrote a simple text-only CAPTCHA (completely automated public Turing test to tell computers and humans apart). My solution and others are posted at CL Quiz #1. CAPTCHA> (generate-captcha) “You started out with forty-nine Lisp Machines. Not through any fault of your… Continue reading A Textual CAPTCHA in Lisp

Programming by Linguists II

Given the task of designing a programming language, which must be exactly defined for engineering purposes, what would a linguist — as opposed to a mathemetician — do?