This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Lisp


Erik Sigra wrote:
> 
> Hi,
> I just looked at kernel/lisp.[ch] without getting any wiser. It was hard for
> me to just look at the whole mess and try to understand what all the
> identifiers are supposed to mean; for example ATYPE, CONS, cons, caddr, car,
> cadr, cdddr, cddr, cdr, MTYPE, TTYPE, UTYPE and many more.

Heh, another bit of datedness - when I first wrote all that, everybody
"just knew" Lisp.  Ten years later, it's become an obscure specialty...

There are books out there on Lisp (or Scheme), it's worth adding
to one's store of knowledge, and there are free implementations
too if you want to experiment.

I'll add some comments to the code, but here's the basic rundown.
Lisp is a dynamically-typed language, in which you get a fixed set of
object types, each of which carries its type around.  enum lisptype
is the collection of types in Xconq, and Obj is the object's struct.
Strings and numbers are easy, the object just contains one.  Symbols
are like strings, but uniquified, and you can attach values to them
via setq.

Finally, you can have lists of objects.  A list object (cons) just has
pointers to two other objects, which may be of any type.  By convention,
these two elements are called the car and cdr, after the names of
a couple fields in a 1950s IBM machine that hosted the first Lisp
implementation.  It's useful to think of them as "first" and "rest",
but not ideal, because you can construct binary trees and other kinds
of non-list things.  (In Xconq however, the cdr must always be a list.)
Also, you can use a-d combos to specify other accessors, such as cadr
to get the second element of a list.

Xconq defines unit types etc as additional types of objects, similar
to numbers, but this was never as valuable as I originally imagined.

Since Lisp has mostly fallen out of use (does AutoCAD still use it?),
I've speculated on alternatives, such as XML.  So far XML seems like
an overly complicated way to accomplish what are basically simple
tasks, so there's not much incentive to change yet.

Stan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]