1

How do i read in data from csv files into a vector of vectors.

In other words each row would be a vector and each column would be an element inside the vector. It would be like a 2D array [row][col]

4

1 回答 1

0

您应该简单地使用现有的 csv 库,例如clojure-csvdata.csv

例如 data.csv 就像

(require '[clojure.data.csv :as csv]
         '[clojure.java.io :as io])

(with-open [in-file (io/reader "in-file.csv")]
  (doall
    (csv/read-csv in-file)))

(示例取自这里

csv/read-csvvec将返回一个惰性向量序列,您可以使用(如果您真的需要)将其转换为字符串向量的向量。

于 2013-01-15T14:02:07.000 回答