apropos

clojure.repl

  • (apropos str-or-pattern)
Given a regular expression or stringable thing, return a seq of
all definitions in all currently-loaded namespaces that match the
str-or-pattern.

1 Example top

  • user=> (apropos "temp")
    ()
    
    user=> (require 'clojure.template)
    nil
    
    user=> (apropos "temp")
    (apply-template do-template)
    
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:165 top

(defn apropos
  "Given a regular expression or stringable thing, return a seq of
all definitions in all currently-loaded namespaces that match the
str-or-pattern."
  [str-or-pattern]
  (let [matches? (if (instance? java.util.regex.Pattern str-or-pattern)
                   #(re-find str-or-pattern (str %))
                   #(.contains (str %) (str str-or-pattern)))]
    (mapcat (fn [ns]
              (filter matches? (keys (ns-publics ns))))
            (all-ns))))
Vars in clojure.repl/apropos:
Used in 0 other vars

Comments top

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