Search code examples
common-lispclisp

common lisp function/macro aliases


I would like to set aliases in common lisp(clisp to be exact) for commands that are used a lot, such as "defun" and "lambda" etc, is it possible to do this?

This is actually kind of a duplicate of this question, but I can not comment and the solution does not work for defun or lambda in both sbcl and clisp


Solution

  • Macros:

    CL-USER 5 > (setf (macro-function 'dm) (macro-function 'defmethod))
    #<Function DEFMETHOD 410009A014>
    
    CL-USER 6 > (dm m1+ ((v vector)) (map 'vector #'1+ v))
    #<STANDARD-METHOD M1+ NIL (VECTOR) 4130003913>
    
    CL-USER 7 > (m1+ #(1 2 3 4))
    #(2 3 4 5)