如何在REPL中显示Clojure版本?


Answers:



30

很接近。

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

诸如此类的大多数内置“全局”变量都具有Common Lisp样式的星号“耳罩”。


2
您也可以只键入clojure-version,REPL将打印toString值。看中了!
艾萨克(Isaac)2010年

23

只需输入即可解决问题*clojure-version*

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

0

额外的例子

user=> (clojure-version)
"1.10.1"

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

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

从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}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.