【问题标题】:Defining aliases for setf functions in Common Lisp在 Common Lisp 中为 setf 函数定义别名
【发布时间】:2017-06-20 01:04:47
【问题描述】:

根据this question,可以像这样创建函数的别名:

(defun some-function () ...)
(setf (fdefinition 'sfunc) #'some-function)

但是:

(defun some-function () ...)
(defun (setf some-function) () ...)
(setf (fdefinition 'sfunc) #'some-function)

> (setf (sfunc) ...)
; caught STYLE-WARNING:
;   undefined function: (SETF SFUNC)

没有为 setf 函数创建别名。如何为 setf 函数创建别名?

【问题讨论】:

    标签: common-lisp


    【解决方案1】:
    (setf (fdefinition '(setf sfunc)) (fdefinition '(setf some-function)))
    

    【讨论】:

      猜你喜欢
      • 2012-07-12
      • 2014-08-06
      • 2010-10-26
      • 2020-09-14
      • 1970-01-01
      • 2022-11-16
      • 1970-01-01
      • 1970-01-01
      • 2011-12-24
      相关资源
      最近更新 更多