porky11
porky11

Reputation: 962

Anonymous methods in common lisp

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?

Upvotes: 3

Views: 168

Answers (1)

Rainer Joswig
Rainer Joswig

Reputation: 139261

See MAKE-METHOD-LAMBDA.

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

Upvotes: 2

Related Questions