The doc & source functions
If you are not using a Clojure aware editor or spend a lot of time in the REPL you can also view the documenation of a function by calling the
doc function and see the source by calling the
Make sure you are in the
user namespace before calling the
doc function. If you are in another namespace, either change back using
(ns 'user) or see the next section on using these functions in another namespace.
(doc doc) (doc map) (doc filter) (doc cons) (source doc) (source map)
Using doc & source function from another namespace
source functions are only included in the
user namespace. If you switch to another namespace or your editor places you in the current namespace of your project, these funcitons will not be available unless you including
core.repl in the current namespace.
You could also
clojure.repl library in your own code, however if you have a good editor it should provide these features without including this library. Therefore the following code is shown only as an example and not a recommended approch.
(ns foobar (:require [clojure.repl :refer :all]))