[Clojure]
- REPLを自分のプロジェクトの名前空間で起動
- How to Run Code Using Leiningen?
user> (in-ns 'myproject.core)
- 名前空間内のシンボルを全て表示
- How to list the functions of a namespace?
user> (require 'myproject.core) user> (keys (ns-publics 'myproject.core))
- Clojureのファイル編集後にREPLに反映
- How to reload a clojure file in REPL
;; まず読み込んでシンボル一覧表示 user> (require 'myproject.core) user> (keys (ns-publics 'myproject.core)) ;; 〜ファイル編集〜 ;; (refresh)を使う user> (use '[clojure.tools.namespace.repl :only (refresh)]) user> (refresh) ;; シンボル一覧表示 → 更新されてる user> (require 'myproject.core) user> (keys (ns-publics 'myproject.core))
- REPLからshellを呼び出し(たぶんLinux/Mac/msys上でしかうまく動かない)
- clojure.java.shell
user> (use '[clojure.java.shell :only [sh]]) user> (println (:out (sh "cowsay" "Printing a command-line output"))) ________________________________ < Printing a command-line output > -------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || nil