Skip to content

Instantly share code, notes, and snippets.

View tfrisk-old's full-sized avatar

Teemu Frisk tfrisk-old

  • Helsinki
View GitHub Profile
@tfrisk-old
tfrisk-old / gist:6841473
Last active December 24, 2015 18:09
Search map entries with specific values in Clojure vector of maps.
(def testmap [
{:id "123" :name "name1"}
{:id "369" :name "name3"}
{:id "246" :name "name2"}])
; finds matches but doesn't return them correctly
(defn find-items-by-name [searchtext]
(doseq [entry testmap]
(let [{:keys [id name]} entry]
(if (= name searchtext) (println "found text" searchtext "at id" id)))))