开发者

How to display Clojure version in REPL?

Such as:

(pri开发者_如何学JAVAntln clojure-version)

?


Even shorter :

user> (clojure-version)
"1.2.0-beta1"
user> 

Oops, I have to upgrade...


Very close.

user> (println *clojure-version*)
{:major 1, :minor 2, :incremental 0, :qualifier }
nil

Most builtin "global" variables like this have Common Lisp-style asterisk "earmuffs".


Just typing *clojure-version* will do the trick.

*clojure-version*
=> {:major 1, :minor 3, :incremental 0, :qualifier nil}


Extra repl examples

user=> (clojure-version)
"1.10.1"

user=> (println (clojure-version))
1.10.1
nil

user=> (print (clojure-version))
1.10.1nil

Use from clj

$ clj -M -e "(clojure-version)"
"1.10.1"

$ clj -M -e "(print (clojure-version))"
1.10.1

$ clj -M -e "*clojure-version*"
{:major 1, :minor 10, :incremental 1, :qualifier nil}


clojure -M -e '(println "Java" (System/getProperty "java.version") "Clojure" (clojure-version))'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜