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!
Despite all of the AJAX/Web 2.0 hype, the fact remains that most web pages are mostly static. The most efficient way to serve static pages is unquestionably to store them as static files on a file-based web server such as Apache. I add new pages to this site once every few days at most, but… Continue reading Static-Dynamic Pages
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
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
In Common Lisp, you can’t do this: (defgeneric g (x)) (defmethod g ((x (and integer (satisfies evenp))) …) Because (and integer …) is not a class. It is a valid type specifier and thus could be used in declarations, but it cannot be used in a method argument list. It’s fairly easy to see why… Continue reading Types Are Not Classes, But Why?
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
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?
Why does Lisp use hyphens instead of underscores or CamelCase? [Read more…]