我想按照Clojure Data Analasys Cookbook中的例子进行操作 . 我正在使用LightTable来玩这个程序 . 第一个示例显示了如何读取.csv数据 .
我使用了lein new getting-data . 然后我将两个依赖项添加到项目文件中
(defproject getting-data "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[org.clojure/clojure "1.5.1"]
[incanter/incanter-core "1.4.1"]
[incanter/incanter-io "1.4.1"]
]
)
然后在core.clj文件中我说如下,使用LightTable中的cmd-shift-enter来评估程序,但我得到了这些例外:
(use 'incanter.core 'incanter.io)
clojure.lang.Compiler $ CompilerException:java.lang.RuntimeException:无法解析符号:在此上下文中使用,编译:(/ Users / idf / Documents / clojure / getting-data / src / getting_data / core.clj:1: 1)
(read-dataset "data/small-sample.csv")
clojure.lang.Compiler $ CompilerException:java.lang.RuntimeException:无法在此上下文中解析符号:read-dataset,编译:(/ Users / idf / Documents / clojure / getting-data / src / getting_data / core.clj: 4:1)
不确定我做错了什么?
2 回答
"Unable to resolve symbol: use in this context"意味着光表环境基本上无法评估任何事情:没有任何与incanter相关的问题 . 不使用光表,我可以某种方式徘徊在没有
clojure.core
引用的命名空间中 . 它应该在您真正想要运行的其余代码之前(clojure.core/refer 'clojure.core)
工作,但当然这不应该是必要的 .把你的代码
在生成的core.clj文件中移动并按strg-enter . 现在它应该评估编辑器中的所有内容 . 或者打开项目并打开一个Instarepl,LightTable应该询问你应该将repl挂钩到哪个项目 .
尊重fricke