1 minute read

Code kata


Write a function to determine if a vector contains a set of items.


(defn containsv [v & items]
  (some (set items) v))


Using a set as the predicate supplied to some allows you to check whether any of the truthy values in the set are contained within the given sequence. This is a frequently used Clojure idiom for searching for containment within a sequence.

comments powered by Disqus