Hi,

Am 22.07.2009 um 19:35 schrieb Richard Newman:

Note that predicates don't necessarily have to return literal true or
false: in my opinion at least, it's perfectly reasonable to write

(def my-predicate? #{:foo :bar})

-- it'll behave correctly in if and when, but the return value will actually be a keyword or nil, not true or false.

Be careful with this. Only do this if you know
in advance, that neither false nor nil are in
your set. To be safe use contains?, which makes
the whole thing again a predicate.

(defn my-predicate?
  [elem]
  (contains? set-I-have-not-full-control-over elem))

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to