在 Clojure 中做这样的事情最简单的方法是什么?
require 'csv'
Dir["data/*.csv"].each do |file|
File.readlines(file).each do |line|
x, y, z = *CSV.parse_line(line)
# process this data
end
end
最佳答案
这是我见过的最短的:
(require '[clojure.java.io :as io])
(filter #(.endsWith (.getName %) ".csv") (file-seq (io/file dir))))
来自 https://github.com/brentonashworth/one/blob/master/src/lib/clj/one/reload.clj#L28
关于ruby - Ruby 的 Dir.glob() 最简洁的 Clojure 等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5019978/