【问题标题】:How to let a second symbol refer to a function如何让第二个符号引用一个函数
【发布时间】:2013-03-21 19:53:18
【问题描述】:

在 Clojure 中,我可以让第二个符号引用函数。

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

-> 49

(def square sq)
(square 7)

-> 49

在 Emacs-Lisp 中,我只知道

(defun square (x) (sq x))

在精神上是否有更接近第一个的解决方案?

【问题讨论】:

标签: emacs clojure elisp


【解决方案1】:
(defun sq (x) (* x x))
(defalias 'square 'sq)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-18
    • 2019-02-16
    • 2019-05-10
    • 1970-01-01
    • 2016-05-02
    相关资源
    最近更新 更多