2014-01-21 81 views
0

我試圖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) 

我敢肯定有簡單的東西怎麼回事,任何人都可以建議?

回答

2

你應該referclojure.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

第一(use clojure.repl),然後嘗試(doc memoize)