I don't know if I understan correctly the requirements, but this is my
try.


(def v #{[1 2 3]   [9 8 3]   [1 2]   [1]   [1 0 3 4]   [1 2 3 4 5]} )

(defn matching [p v]
  (reduce + (map #(if (= %1 %2) 1 0) p v)))

(defn better-match [p v1 v2]
  (if
    (or
      (> (matching p v1) (matching p v2))
      (and
         (= (matching p v1) (matching p v2)) (< (count v1) (count
v2))))
    v1
    v2))

(reduce #(better-match [1 2 4 4 5] %1 %2) [] v)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to