我刚开始学习Clojure。我想使用Netbeans,但我不知道如何设置一个简单的应用程序吐出任何东西。我遵循了Enclojure插件的设置,一切似乎都很好。谁能给一个简短的教程或提示一个设置。
前提条件:
Netbeans 7
EnClojure Plugin
Maven set up correctly
Maven installed
Maven Proxy setup if behind a proxy
Netbeans: Tools > Options > Miscellaneous > Maven
项目设置:Menu File > New Project > Clojure > Clojure 1.2 Maven Project
Projectname= HelloWorld
Default Namespace= com.jfcorbet.helloword
Browse项目:
Projects Window > Source Packages > com.jfcorbet > helloworld.clj
你会看到:
(ns com.jfcorbet.helloworld
;(:import )
;(:require )
)
添加:
(defn hello
"Prints Hello and name parameter"
[name]
(println (str "Hello " name)))
(hello "Jean-François")
并保存。
现在右键单击你的项目并选择"Build with Dependencies",这将使Maven下载clojure和贡献库,并处理依赖项。
然后Rightclick your project and choose "Start Project REPL"
Project window > helloworld.clj > RMB > choose "Load Sources in Repl"
or select source text and RMB > "Evaluate Expr in REPL"