为什么一些clojure函数在其名称的末尾或开头有点?

Sam*_*Sam 1 clojure

(.parse (java.text.SimpleDateFormat. "yyyy-MM-dd") date)

为什么java.text.SimpleDateFormat.以点结尾?为什么.parse以点开头?

Syl*_*ter 5

这些是区分函数和Java方法.

(.parse (java.text.SimpleDateFormat. "yyyy-MM-dd") date)
Run Code Online (Sandbox Code Playgroud)

是相同的:

(.parse (new java.text.SimpleDateFormat "yyyy-MM-dd") date)
Run Code Online (Sandbox Code Playgroud)

这与以下Java代码相同:

(new java.text.SimpleDateFormat("yyyy-MM-dd")).parse(date)
Run Code Online (Sandbox Code Playgroud)

你当然可以做更多的事情,所以如果你想在你的Clojure代码中使用一个库,你可能想看看Clojure的Java互操作页面.