Lisp HUG Maillist Archive

DEFSUBST

Why can't I use  this with personal lispworks ?
 (defsubst square (x) (* x x))

I get this error :
Error: Undefined operator DEFSUBST in form (DEFSUBST SQUARE (X) (* X
X)).

Thanks in advance for help.


Re: DEFSUBST

Pierre-Yves Andri wrote:
> Why can't I use  this with personal lispworks ?
>  (defsubst square (x) (* x x))

DEFSUBST isn't defined by Common Lisp.  Assuming you want similar 
behavior to the operator of the same name in emacs lisp, you might try 
the following:

(defmacro defsubst (name lambda-list &body forms)
   `(progn
      (declaim (inline ,name))
      (defun ,name ,lambda-list
        ,@forms)))

Note: the Hyperspec, a handy reference on Common Lisp, should be 
accessible via Help -> Manuals -> ANSI Common Lisp Standard.


Mike


Updated at: 2020-12-10 08:38 UTC