我该如何从另一个命名空间bene-cmp.core调用bene-csv.core中的函数?我尝试了多种:require和:use,但都没有成功。
这是bene-csv中的函数:
以下是bene-cmp.core的头文件:
如果我修改bene-cmp.clj的头部
这是bene-csv中的函数:
(defn ret-csv-data
"Returns a lazy sequence generated by parse-csv.
Uses open-csv-file which will return a nil, if
there is an exception in opening fnam.
parse-csv called on non-nil file, and that
data is returned."
[fnam]
(let [ csv-file (open-csv-file fnam)
csv-data (if-not (nil? csv-file)
(parse-csv csv-file)
nil)]
csv-data))
以下是bene-cmp.core的头文件:
(ns bene-cmp.core
.
.
.
(:gen-class)
(:use [clojure.tools.cli])
(:require [clojure.string :as cstr])
(:use bene-csv.core)
(:use clojure-csv.core)
.
.
.
当前在(bene-cmp.core)中的调用函数是一个存根。
defn fetch-csv-data
"This function merely loads the two csv file arguments."
[benetrak-csv-file gic-billing-file]
(let [benetrak-csv-data ret-csv-data]))
如果我修改bene-cmp.clj的头部
(:require [bene-csv.core :as bcsv])
并且修改调用ret-csv-data的部分。
(defn fetch-csv-data
"This function merely loads the two csv file arguments."
[benetrak-csv-file gic-billing-file]
(let [benetrak-csv-data bcsv/ret-csv-data]))
我遇到了这个错误
由于没有找到变量 bcsv/ret-csv-data,导致出现了 java.lang.RuntimeException 的错误。
那么,我该如何调用 fetch-csv-data 呢?谢谢。