为什么不打印数据集?

时间:2014-02-01 01:51:15

标签: clojure

以下代码似乎运行良好。我看到它打印"在主"但是我没有看到正在打印的数据集。 small-sample.csv包含如下几行。打印数据集的正确方法是什么?

我修改了代码,现在看到该程序抛出异常。如果我删除了打印件,我没有得到异常,但我看不到输出。不确定我做错了什么?

;;small-sample.csv file
Gomez,Addams,father
Morticia,Addams,mother
Pugsley,Addams,brother
...

(use 'incanter.core
     'incanter.io)

(ns getting-data.core
  (:require [incanter.core :as incanter]) (:require [incanter.io :as io])
)

(defn -main
  "Command-line entry point."
  [& raw-args]
  (try
    (println "inside main")
      (print((io/read-dataset "data/small-sample.csv")))
  (catch Exception e (prn "in catch1"))))
)

1 个答案:

答案 0 :(得分:1)

我认为你应该简单地删除io/read-dataset中的括号,如下所示:

(print (io/read-dataset "data/small-sample.csv"))

来自docs

  

返回从文件或URL读取的数据集。

额外的括号尝试评估数据集