所以... 简单地说,这是我 core.clj 文件
(ns ffmpeg-in-a-jar.core
(:gen-class)
(:require [ffmpeg-in-a-jar.encoder :as encoder]))
(defn -main
"ffmpeg autoencoder made with Clojure"
[& args]
(println "Files will begin encoding..." ))
在 encoder.clj 文件中,我定义了一个用户自定义的循环计数器
(defn loop-cnt []
(println "How many files to encode?")
(def loopnum (read-string (read-line)))
(println "\n""Files ready to encode"))
(loop-cnt)
它紧随在循环中用于再次请求用户输入之后
(defn queue []
(loop [loopnum loopnum
file-queue []]
(if (not= loopnum 0)
(do
(def file-queue [])
(println "\n""Write filenames one by one")
(def add-queue (read-line))
(recur (dec loopnum) (conj file-queue add-queue)))
file-queue)))
我是用下面这种方式调用的
(loop-cnt)
(def queue-result (queue))
(println "\n""Added to the Encoding Queue:" "\n" queue-result "\n")
我真正的疑问是,编码器究竟是怎么工作的?我用 require 来使它可用,但我还没有在 -main 中调用它,我想我应该这样
(encoder/loop-cnt)
(println "\n" "Added to the Encoding Queue:" "\n" encoder/queue-result "\n")
ns 宏在做一些我不知道的事情吗?