企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 线程 所有的Clojure方法都实现了 `[java.lang.Runnable](http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html)` 接口和 `[java.util.concurrent.Callable](http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html)` 接口。这使得非常容易把Clojure里面函数和java里面的线程一起使用。比如: ``` (defn delayed-print [ms text] (Thread/sleep ms) (println text)) ; Pass an anonymous function that invokes delayed-print ; to the Thread constructor so the delayed-print function ; executes inside the Thread instead of ; while the Thread object is being created. (.start (Thread. #(delayed-print 1000 ", World!"))) ; prints 2nd (print "Hello") ; prints 1st ; output is "Hello, World!" ```