clojurelibraries

Get API documentation for Clojure libraries


I'm new to Clojure, and I would like to know where is all the documentation for all the libraries such as those found on clojars.org?

For example using lein I do the following to the 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"]])

then uselein deps to install all the libraries

Core.clj

(ns Program-name.core
(:use [speech-synthesis.say :as say])(use [clarity.component]))
(use 'clarity.form)

so how would I import and get the API information for org.clojars.jeffsigmon/maryclient?

note: I read that that the API documentation is stored in the libraries and you have to import them to access it


Solution

  • The API docs are in the code in the form of docstrings

    e.g.

    (defn my-func
     "This is the doc string"
     [a b c]
       ...)
    

    You can access the doc strings in the 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...
    

    Various IDEs also give access to the docs. e.g. in emacs, with swank you can use slime-describe-symbol accessed via the shortcut C-c C-d d