我正在尝试refer
以及来自自定义命名空间的qualify
基本核心功能,但没有运气:
cplay.core> (refer 'clojure.core)
nil
cplay.core> (clojure.core/refer 'clojure.core)
nil
cplay.core> (doc memoize)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: doc in this context, compiling:(/private/var/folders/0h/lzx021jx1rl95vhfxmcppmlc0000gn/T/form-init7998067657898575130.clj:1:1)
cplay.core> (clojure.core/doc memoize)
CompilerException java.lang.RuntimeException: No such var: clojure.core/doc, compiling:(/private/var/folders/0h/lzx021jx1rl95vhfxmcppmlc0000gn/T/form-init7998067657898575130.clj:1:1)
我确信这里有一些简单的事情,有人可以提出建议吗?
答案 0 :(得分:2)
您应该refer
clojure.repl
使用doc
宏。
user=> (ns xxx)
nil
xxx=> (clojure.repl/doc memoize)
-------------------------
clojure.core/memoize
([f])
Returns a memoized version of a referentially transparent function. The
memoized version of the function keeps a cache of the mapping from arguments
to results and, when calls with the same arguments are repeated often, has
higher performance at the expense of higher memory use.
nil
xxx=> (refer 'clojure.repl)
nil
xxx=> (doc memoize)
-------------------------
clojure.core/memoize
([f])
Returns a memoized version of a referentially transparent function. The
memoized version of the function keeps a cache of the mapping from arguments
to results and, when calls with the same arguments are repeated often, has
higher performance at the expense of higher memory use.
nil
答案 1 :(得分:1)
首先(use clojure.repl)
,然后尝试(doc memoize)