You're viewing version 1.2.0 of source. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

source

clojure.repl

  • (source n)
Prints 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.

Example: (source filter)

1 Example top

  • user=> (source max)
    ;; prints in console:
    (defn max
      "Returns the greatest of the nums."
      {:added "1.0"}
      ([x] x)
      ([x y] (if (> x y) x y))
      ([x y & more]
       (reduce max (max x y) more)))
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/repl.clj:43 top

(defmacro source
  "Prints 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.

  Example: (source filter)"
  [n]
  `(println (or (source-fn '~n) (str "Source not found"))))
Vars in clojure.repl/source: defmacro source concat list or println seq str
Used in 0 other vars

Comments top

No comments for source. Log in to add a comment.