First, load the clojure.repl lib
First you need to load the clojure.repl library. You should be able to do this by typing:(use 'clojure.repl)
If this fails then see this post http://fernmac.blogspot.co.uk/2013/09/cant-get-use-clojurerepl-to-work-in.html
What functions are available in a library
For example, what functions are in the repo library:Type:
(dir clojure.repl)
Lookup documentation for a function
If you want to lookup the documentation for "when" for example, type:(doc when)
Find definition by matching it's name
If we want to find all the definitions that contain the word "map" in their names then use apropos.Type:
(apropos "map")
Find all documentation that contain a word
If you want to look up all definitions that have the word "stream" in it's documentation then type:(find-doc "stream")
Look at the source code of a function
If you want to see the code for a function, yours or the Clojure functions.To find the source code of the defn function, type:
(source defn)
Cheat-sheet
you can visit the Clojure cheat-sheet at http://clojure.org/cheatsheet or you can query via the REPL.
No comments:
Post a Comment