get-by-pattern

leiningen.compile

  • (get-by-pattern m k)
Gets a value from map m, but uses the keys as regex patterns,
trying to match against k instead of doing an exact match.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source leiningen/compile.clj:44 top

(defn get-by-pattern
  "Gets a value from map m, but uses the keys as regex patterns,
  trying to match against k instead of doing an exact match."
  [m k]
  (m (first (drop-while #(nil? (re-find (re-pattern %) k))
                        (keys m)))))
Vars in leiningen.compile/get-by-pattern: defn drop-while first keys nil? re-find re-pattern
Used in 0 other vars

Comments top

No comments for get-by-pattern. Log in to add a comment.