source-fn

added

ns
clojure.repl

type
function

(source-fn x)

Returns a string of the source code for the given symbol, if it can
find it.  This requires that the symbol resolve to a Var defined in
a namespace for which the .clj is in the classpath.  Returns nil if
it can't find the source.  For most REPL usage, 'source' is more
convenient.

Example: (source-fn 'filter)

                (source-fn 'max)

;;=> "(defn max
     \\"Returns the greatest of the nums.\\"
      {:added \\"1.0\\"
      :inline-arities >1?
      :inline (nary-inline 'max)}
      ([x] x)
      ([x y] (. clojure.lang.Numbers (max x y)))
      ([x y & more]
      (reduce1 max (max x y) more)))"