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
I use a simple macro for this:
(defmacro alias (to fn)
`(setf (fdefinition ',to) #',fn))
e.g.
(alias neg -)
=> #<Compiled-function ... >
(neg 10)
=> -10
Other answers include detail about how to make this permanent.
You are not trying to redefine (i.e., change the definition of) the system function documentation, you want to define your own function with a shorter name which would do the same thing as the system function.
This can be done using fdefinition:
(setf (fdefinition 'doc) #'documentation)
There is no standard way, different implementation may do it differently, but, generally speaking, there are two common ways.
The code in question will be evaluated anew every time lisp starts.
The modified lisp world is saved to disk.
Even though @sds has already answered pretty thoroughly I just wanted to add that the utility library serapeum has defalias