我是Clojure的新手,我想知道所有库(如clojars.org上的库)的所有文档在哪里
例如,我使用lein对project.clj执行以下操作
(defproject Program-name "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[facts/speech-synthesis "1.0.0"]
[org.clojars.jeffsigmon/maryclient "4.3.0"]
[speech-synthesis "1.0.0"]
[clarity "0.5.6"]])然后使用lein deps安装所有库
Core.clj
(ns Program-name.core
(:use [speech-synthesis.say :as say])(use [clarity.component]))
(use 'clarity.form)那么,如何导入和获取org.clojars.jeffsigmon/maryclient的API信息呢?
注意:我读到API文档存储在库中,您必须导入它们才能访问它。
发布于 2012-08-15 07:36:24
API文档以docstring的形式出现在代码中。
例如:
(defn my-func
"This is the doc string"
[a b c]
...)您可以访问REPL中的文档字符串:
$ lein repl
user> (doc println)
-------------------------
clojure.core/println
([& more])
Same as print followed by (newline)
user> (apropos "print")
(*print-radix* *print-miser-width* *print-pprint-dispatch* print-table
print-length-loop pprint-indent pprint *print-suppress-namespaces*
*print-right-margin* *print-pretty* with-pprint-dispatch ...)
user> (find-doc "print")
... lots of functions related to print with docs...各种IDE还允许访问文档。例如,在emacs中,使用swank可以使用通过快捷方式slime-describe-symbol访问的C-c C-d d
发布于 2012-08-15 07:30:49
使用doc,find-doc,apropos函数对REPL,使用lein repl启动一个repl。
顺便说一句:如果库jar不包括.clj文件,则不能使用它们。
https://stackoverflow.com/questions/11965078
复制相似问题