Archive for the ‘lisp’ Category

JavaScript is the new black …

Tuesday, April 3rd, 2007

JavaScript is a very powerful language and the more I use it the more I see it’s power. It’s very LISP like with its use of associative arrays to manage objects and it’s use of functions as first class objects.

In JavaScript you can create a new function and associate that function with a variable. When a function is invoked with ‘new’ then the result is an object. For example:

// assign a function to a variable.
var func = function(x,y) {return x + y;}
// create an object
var point = new Point(x,y);

An object can have functions added to it at runtime. We call these functions methods since they are associated with an instance and have access to the variable ‘this’.

The function object has access to the arguments to the function as an array. So you could iterate through the variable list of arguments and take an appropriate action. For example, you could convert each parameter into a method call on the object and call it. Very powerful.

For a quick and cheap reference to what JavaScript can do I recommend the book JavaScript Pocket Reference by David Flanagan (2nd Edition) from O’Reilly.

ANSI Common Lisp

Saturday, February 10th, 2007

ANSI Common Lisp by Paul Graham is probably a Lisp book everyone interested in the language should own. It’s very good but not really for the beginner, for whom I would suggest The Little Lisper: Trade Edition. Daniel P. Friedman, Matthias Felleisen as a better starting point.

Paul Graham has a lot of interestng things to say and he writes very well, so check out his essays from time to time.

There are a lot more books on Lisp listed on the links page.

If you have a hard time locating older books I suggest trying BibliOz or another second hand book store.