[Top][All Lists]

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

Re: Metaprogramming

From: Teemu Likonen
Subject: Re: Metaprogramming
Date: Sun, 15 Sep 2019 10:32:59 +0300

Shyam Nath [2019-09-15T13:13:09+10] wrote:

> I want to redefine functions by manipulating the pre-existing
> function; is there any way to do this?

You can keep the original function code in a variable. Use that variable
to define the global function first and later all modified versions of

    (defvar function-code (lambda (...) ...))
    (setf (symbol-function 'modifiable-function) function-code)

I think it is better to keep your defuns static and make them call
other functions which are stored in a variable or other predefined

    (defvar modifiable-function (lambda (...) ...))

    (defun static-function (...)
      ;; ...
      (funcall modifiable-function ...)
      ;; ...

///  OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]