aboutsummaryrefslogtreecommitdiff
path: root/challenge-224/tyler-wardhaugh/clojure/src/c224/t1.clj
blob: ea41f23a17f58a6a3c6c1c32e1c5a46880c13cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(ns c224.t1)

(def DEFAULT-INPUT ["abc" "xyz"])

(defn special-notes?
  [source target]
  (let [s (-> source frequencies)
        t (-> target frequencies (update-vals -))]
    (->> (merge-with + s t)
         vals
         (every? (complement neg?)))))

(defn -main
  "Run Task 1 with a given input N, defaulting to the first example from the
  task description."
  [& args]
  (let [[SOURCE TARGET] (or args DEFAULT-INPUT)]
    (println (if (special-notes? SOURCE TARGET) "true" "false"))))