小编Tia*_*Oca的帖子

在 VS CODE 中运行 (lein) REPL

有没有办法在 VS Code 中使用 lein 的 REPL?我的意思是,使用tasks.js 或其他东西。

我想要一个集成环境来运行、测试和构建我的 clojures 应用程序。我想也许我可以使用 VS Code 实现类似的目标,因为它支持第三方编译器。我可以使用lein run,但它不起作用lein repl

我已阅读任务的文档,但没有任何与 REPL 相关的内容。

这是我使用的tasks.js代码:

{
    // See http://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "lein",
    "tasks": 
    [
        {
            "taskName": "run",
            "showOutput": "always",
            "args": ["run"],
            "isBuildCommand": true,
            "isWatching": false
        },

        {
            "taskName": "repl",
            "showOutput": "always",
            "args": ["repl"],
            "isWatching": true
        }
    ],

    "isShellCommand": true
}
Run Code Online (Sandbox Code Playgroud)

editor clojure leiningen visual-studio-code

4
推荐指数
1
解决办法
6090
查看次数

不在尾部位置

我如何使用类似于recur尾部位置的东西?

看看我的代码:

(defn -main [& args]

  (println "Hi! Type a file name...")

  (defn readFile[])
    (let [fileName(read-line)]
    (let [rdr (reader fileName)]
      (if-not (.exists rdr) 
        ((println "Sorry, this file doesn't exists. Type a valid file name...")
         (recur)))
         (defn list '())
         (doseq [line (line-seq rdr)]
           (if-not (= "" line)
             (concat list '(line)))
             (list))))

(defn fileLinesList (readFile))
  ...
  ...)
Run Code Online (Sandbox Code Playgroud)

我知道我不能recur在这里使用......但我不知道如何在clojure中实现它.

我是Clojure的新手,我来自OOP环境.所以...

在这种情况下有没有办法使用递归? 什么是另类?

lisp recursion functional-programming tail-recursion clojure

0
推荐指数
1
解决办法
121
查看次数