diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2009-08-19 12:35:36 -0400 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2009-08-19 12:35:36 -0400 |
commit | 35fa51c46e772eec302521eef1382798eb4290b1 (patch) | |
tree | 0e2ddfab93bf73a96b6508de1ad42a29d073c849 | |
parent | b77d22fb567127edf5d3f5caebfbfbd9d7ce4ab2 (diff) |
str_utils2.clj: added map-str and grep from Compojure
-rw-r--r-- | src/clojure/contrib/str_utils2.clj | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/clojure/contrib/str_utils2.clj b/src/clojure/contrib/str_utils2.clj index b70a9ba4..33ed857c 100644 --- a/src/clojure/contrib/str_utils2.clj +++ b/src/clojure/contrib/str_utils2.clj @@ -292,6 +292,20 @@ [#^String s] (seq (.split #"\r?\n" s))) +;; borrowed from compojure.str-utils, by James Reeves, EPL 1.0 +(defn map-str + "Apply f to each element of coll, concatenate all results into a + String." + [f coll] + (apply str (map f coll))) + +;; borrowed from compojure.str-utils, by James Reeves, EPL 1.0 +(defn grep + "Filters elements of coll by a regular expression. The String + representation (with str) of each element is tested with re-find." + [re coll] + (filter (fn [x] (re-find re (str x))) coll)) + ;;; WRAPPERS |