Leiningen導入メモ

Clojureの開発環境構築のためLeiningenを導入したのでメモ。

導入

GitHub - technomancy/leiningen: Automate Clojure projects without setting your hair on fire.」の「Installation」の項のとおり。(= lein.bat をダウンロードしてパス通して、「lein self-install」する)

On Windows most users can get the batch file. If you have PowerShell, wget.exe or curl.exe already installed and in PATH, you can just run "lein self-install". If you have Cygwin you should be able to use the shell script above rather than the batch file.

動作確認
lein version

lein help

lein search string

ちなみに私の環境は「Leiningen 2.1.3 on Java 1.7.0_04 Java HotSpot(TM) 64-Bit Server VM」。

lein repl
(help)

(doc concat)
(find-doc "substring")
(source concat)

;タブキーによる補完も可能

(exit)

HelloWorld

新規プロジェクト作成
lein new app my-stuff
ビルド、ローカルリポジトリへインストール
cd my-stuff
lein install
実行
lein run

あるいは

lein repl

(require 'my-stuff.core)
(my-stuff.core/-main)
ドキュメント表示
(doc my-stuff.core/-main)
ソース表示
(source my-stuff.core/-main)
テストの実行
lein test