我有这样如何在cl-defun togather中使用&key和&rest?
(cl-defun foo (a b c d e &rest f)
nil)
参数c
,d
和e
功能是时间nil
80%。
为了使它看起来更好,我这样做:
(cl-defun foo (a b &rest f &key c d e &allow-other-keys)
nil)
当不提供c
,d
和e
,它的罚款。
但是,如果使用其中之一,f
会得到错误的参数。 例如:
(foo 1 2 :c 6 3 4 5)
;; ==> expected: a=1, b=2, c=6, f= (3 4 5)
;; ==> real case: a=1, b=2, c=6, f= (:c 6 3 4 5)