Clojure无法读取输入的CSV文件

时间:2018-09-28 05:31:25

标签: clojure anglican

我正在尝试将this csv file作为列表阅读。我下载了csv文件,并在大猩猩REPL笔记本中运行了以下代码,该笔记本也与csv文件位于同一目录中。

{
  "took": 57,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
      {
        "_index": "index_name",
        "_type": "index1",
        "_id": "1",
        "_score": 1,
        "_source": {
          "field1": "a",
          "field2": "b"
        },
        {
          "field1": "c",
          "field2": "d"
        },....
      }
    ]
  }
}

大猩猩REPL引发以下错误。

(use 'nstools.ns)
(ns+ message-example
     (:like anglican-user.worksheet)
     (:require [clojure-csv.core :as csv]
               [clojure.java.io :as io]))

(defn take-csv
  [fname]
  (with-open [file (io/reader fname)]
    (csv/parse-csv (slurp file))))

(def data
  (map (comp read-string first) (take-csv "txtdata.csv")))

我无法理解我在做什么错。你能帮忙吗?

0 个答案:

没有答案