有一些关于SO的相关问题,但我似乎无法弄清楚这一点。我有一个非常简单的测试代码:
(ns test
(:gen-class)
(:require [clojure.java.io :as io]))
(defn tail-file
[path handler-func]
(org.apache.commons.io.input.Tailer/create
(io/file path)
(proxy [org.apache.commons.io.input.TailerListenerAdapter] []
(handle [this line] (handler-func line)))))
(defn -main
[& args]
(tail-file "c:/tmp/test.txt" println)
(read-line))
这导致:
Exception in thread "Thread-0" clojure.lang.ArityException: Wrong number of args (2) passed to: core/tail-file/fn--28
这很奇怪,因为tail-file有两个参数([path handler-func])。