[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function specs

Hi, while working on notes for a AAAI tutorial that I'm giving with
Larry Masinter, I was informed that Common Lisp provides no means
for defining a functional property of a symbol.  I.e. you can't
do the MacLisp

(defun (foo bar) (x) (mumble-frotz x))

or even the LispMachine Lisp

(defun (:property foo bar) (x) (mumble-frotz x)).

I was shocked.  I often write programs which work by dispatching to
functions stored on property lists.  Short of flavors or some such 
thing this is the cleanest style for coding many problems.

Now without at least this minimal form of function-spec you're forced 
to do something much grosser:

Option 1 is to do

(putprop 'foo #'(lambda (x) (mumble-frotz x)) 'bar)

in which case the compiler will probably not compile
the lambda expression.

Option 2 is to build a macro

(defmacro deffunny (name (symbol indicator) &body body)
  (let ((standin (gensym)))
    `(progn 'compile
	    (defun ,standin ,args ,@body)
	    (putprop ',symbol (fsymeval ',standin) ',indicator))))

which is vintage 1973 MacLisp whose demise was welcomed by all when the
extended defun was introduced.

Can someone please explain to me what is being gained by not having


Howie Shrobe