Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 957
porky11 Avatar asked May 16 '26 11:05

porky11


1 Answers

See MAKE-METHOD-LAMBDA.

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

like image 71
Rainer Joswig Avatar answered May 18 '26 17:05

Rainer Joswig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!