Archive for May, 2006

Better Abstractions

Wednesday, May 24th, 2006

A common complaint about Object-Oriented Programming (OOP) is that classes can make simple data hard to deal with: “I don’t want a DirectoryList object, I just want a list of strings.” I would say this is not a flaw inherent in OOP but rather in the way it is commonly used. “Encapsulation” and [...]

Types Are Not Classes, But Why?

Sunday, May 21st, 2006

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 this is the [...]

A Textual CAPTCHA in Lisp

Thursday, May 4th, 2006

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 [...]