Defining aliases to standard Common Lisp functions?

后端 未结 3 950
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 18:27

Lisp is said to enable redefinitions of its core functions. I want to define an alias to the function cl:documentation function, such that

(doc         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 18:50

    I use a simple macro for this:

    (defmacro alias (to fn)
        `(setf (fdefinition ',to) #',fn))
    

    e.g.

    (alias neg -) => #

    (neg 10) => -10

    Other answers include detail about how to make this permanent.

提交回复
热议问题