Skip to content

Instantly share code, notes, and snippets.

@taylorSando
Created November 1, 2015 20:38
Show Gist options
  • Save taylorSando/1d12038fd77fa6f71bd9 to your computer and use it in GitHub Desktop.
Save taylorSando/1d12038fd77fa6f71bd9 to your computer and use it in GitHub Desktop.
A simple selector
(defn is-predicate-keyword? [k]
(= (last (name k)) (last "?") ))
(reduce
(fn [acc [k v]]
(if (is-predicate-keyword? k)
(if (true? v)
(conj acc (apply str (butlast (name k))))
acc)
acc))
[]
{:x :value
:x? true
:y? false
:z true})
;; should output ["x"]
(is-predicate-keyword? :hello)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment