Clojure recur with multi-arityと同様に、別のアリティで繰り返したいと思います。file-list
しかし、私の場合、 let ( ) から別の値を渡さずに使用したいので、let を介して関数を定義します。
(let [file-list (drive/list-files! google-drive-credentials google-drive-folder-id)
download-file (fn
([name]
(download-file ; <-- attempt to recur
name
(fn []
(throw
(ex-info
(str name " not found on Google Drive"))))))
([name not-found-fn]
(if-let [file (->> file-list
(filter #(= (:original-filename %)
name))
first)]
(drive/download-file! google-drive-credentials file)
(not-found-fn))))]
;; #
)
次のエラーが表示されます。Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: download-file in this context