Thursday, April 28, 2011

50 years ago — April 28, 1961

This is an excerpt from the forth coming LISP 1.5 Programmer's Manual.
Provision is made in LISP 1.5 for allocating blocks of storage for data. The data may consist of list structure or data words. Arrays may have up to three indicies.
To declare an array, us the function array. Its argument is a list of arrays to be declared. Each one must be for list structure or non-list structure.
Suppose ALPHA is to be a 10 x 10 array of list structure and BETA a 5 x 5 x 5 array of non-list structure. The array function is
ARRAY ((
     (ALPHA (10,10) LIST)
     (BETA (5,5,5) NONLIST)    ))
To find the value of B3,4,2: (BETA 3,4,2) or (BETA I J K) with a pair list.
To set ALPHA3,4 to "YES": (ALPHA (QUOTE SET) (QUOTE YES) 3 4)
Array uses marginal indexing for maximum speed. The total number of words used by an array whose size is D1 x D2 x D3 is 4 + D1 + D1D2 + D1D2D3. If the array is 2 dimensional, D1 = 1. If the array is 1 dimensional, D1 and D2 = 1.
To save space, specify the dimensions in increasing order.
ALPHA (3,4,5) takes less words than ALPHA (5,3,4).

Compatability of LISP 1 and LISP 1.5.

  1. EVALQUOTE has two arguments while APPLY has three. To change a LISP 1 program for LISP 1.5 simply eliminate the p-list if it is null. If the p-list is needed, then the function apply is available in LISP 1.5,
  2. Arithmetic in LISP 1.5 is new, improved, and generally incompatible with LISP 1.
  3. LISP 1.5 has many extra features. There [sic, these] are being written up for the new LISP 1 Programmer's Manual. Until it comes, check in Room 26-265.
— Michael Levin
Artificial Intelligence Project
RLE and MIT Computation Center Memo 24
Arithmetic in Lisp 1.5

5 comments:

John Cowan said...

So arrays are closures in Lisp 1.5. Interesting!

Arcane Sentiment said...

The SET feature comes tantalizingly close to inventing message passing years before Simula. I wonder if anyone at the time thought of generalizing it.

CH said...

I thought that Clojure was new with the notation (x 3) to look up the 3rd element of a vector, and similar with maps. But they had (BETA I J K) back in 1961. Interesting.

Do any other moden Lisp implementations let you use a data structure as a function?

Kazimir Majorinc said...

CH - Newlisp, although I'm not that sure its good feature. If code looks "more natural" then metaprogramming is more complicated.

John Cowan said...

In Owl Lisp, which is a pure variant of Scheme, there are "finite functions" which can be seen as either a-lists (you can add or delete mappings from them) or as procedures (when you invoke them with a key and a default, you get back either a value or the default).