Little Clojure tip: name sets as if they are predicates (where appropriate).
In Clojure it's quite common to use sets as functions (it acts as a function that tests membership).
(some #{a} coll)
(filter (comp #{1 2 3} :id) coll)
This is idiomatic, if you've done a bit of Clojure you will read this easily, because they are set literals it's quite obvious. But if the set is defined somewhere else, then suddenly it gets a lot less obvious.
(def admin-ids #{53 65 78})
(when (admin-ids (:id user)) ,,,)
In this case I would probably use an explicit contains?
, at least that shows that it has to be a set or map.
(when (contains? admin-ids (:id user)) ,,,)
But you can also name the var as if it's a function
(def admin-id? #{53 65 78})
(when (admin-id? (:id user)) ,,,)
And this way you could refactor this later to actually be a function, e.g. something that checks the database.
@plexus I'm a bit torn there as I often use sorted-sets as lists (like a vector I ran distinct on). I do also use them as predicates. I think the naming depends on what I think I'm going to use them for, which isn't necessarily great.