Skip to main content
5 of 10
added 126 characters in body
Raffzahn
  • 236.2k
  • 23
  • 682
  • 976

Is there any particular reason you can't do LISP in 18-bits?

No, as already commented, LISP can of course be done with any machine word size. It's just that a 36 bit word could hold all elements of a "CONS" (aka pair), the core management object of LISP, on the computer LISP was developed for (*1).

On a 36 bit machine any access to a list will always retrieve a CONS at once, whereas on an 18 bit machine two fetches are necessary. More so, a 36 bit register does always hold a complete CONS, Both makes a CONS as well atomic within the underlying hardware, all without further ado.

The address space was still 18-bits, so it's not memory size.

Its not about address length but encoding. In fact, the usable address space for 36 bit Lisp implementations was only 15 bit, good for 32 KiWords. This was quite fine in 1958 where even a top end computer like the IBM 704 maxed out at 32 KiWords.


A basic element of a list, a Cons, consists of two pointers:

  • CAR - pointing to the list item and
  • CDR - pointing to the next list entry

A pointer needs to be qualified, as it may point to another list(CONS), or a leaf (ATOM). It a few bits are needed to be added to each pointer.

Now, the original LISP was developed on an IBM 704, a computer with 36 bit word size and 15 bit address size. wich gives nicely room to hold two 15 bit address pointers plus the needed qualifiers:

  • 3 bits CAR qualifier
  • 15 bits CAR address
  • 3 bits CDR qualifier
  • 15 bits CDR address

That way both pointers could be easy moved into the index registers to walk thru. In fact, the very first LISP implementation consisted of just two macros called ... well ... CAR and CDR, accessing either half of a CONS for addressing. Everything else was constructed from there.

And yes, this can be of course be done as well on an 18 bit machine. Except now a CONS will cover two (18 bit) words, effectively halving the available memory as now only even addresses are valid - or each and every access will need to include a shift operation to turn a Cons address into a memory address.

Like so often it's not about an implementation being impossible, or the difference being huge, but the little advantage that will pay out big when done often enough - like with every access or iteration.


*1 - And was still good for quite some time after.

Raffzahn
  • 236.2k
  • 23
  • 682
  • 976