Anonymous methods in common lisp

163 views Asked by At

I want to save a generic function as a variable:

(defvar *gf* (make-instance 'standard-generic-function)

But when adding a method I have to define call-next-method and next-method-p myself:

(add-method *gf*
            (make-instane 'standard-method
                          :function (lambda (args next-methods)
                                      (flet ((call-next-method () ...)
                                             (next-method-p () ...))
                                        (apply (lambda () ...) args)))))

How do I call a method to define call-next-method? Is there a simpler way to do this?

1

There are 1 answers

0
Rainer Joswig On

See MAKE-METHOD-LAMBDA.

If you Google for it, you will find various informations about the function. For example MAKE-METHOD-LAMBDA considered harmful.