首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用来自自定义命名空间的核心函数

使用来自自定义命名空间的核心函数
EN

Stack Overflow用户
提问于 2014-01-21 06:44:34
回答 2查看 109关注 0票数 0

我试图从自定义命名空间中选择referqualify基本核心函数,但没有成功:

代码语言:javascript
复制
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) 

我敢肯定这里有一些很简单的事情,有人能给我建议吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-01-21 06:51:24

您应该使用refer clojure.repl来使用doc宏。

代码语言:javascript
复制
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
票数 2
EN

Stack Overflow用户

发布于 2014-01-21 07:32:19

首先(use clojure.repl),然后尝试(doc memoize)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21251029

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档