Search code examples
emacsclojureelisp

How to let a second symbol refer to a function


In Clojure I can let a second symbol refer to a function.

(defn sq [x] (* x x))
(sq 7)

-> 49

(def square sq)
(square 7)

-> 49

In Emacs-Lisp, I only know about

(defun square (x) (sq x))

Is there a solution nearer in spirit to the first one?


Solution

  • (defun sq (x) (* x x))
    (defalias 'square 'sq)