 (defn mark-completed [id]
   (if-let [user (session/session-get :user)]
     (do
-      (when (not-any? #(= % id) (get-solved user))
-                      
+      (when (not-any? #{id} (get-solved user))
         (update! :users {:user user} {:$push {:solved id}})
         (update! :problems {:_id id} {:$inc {:times-solved 1}}))
       (flash-msg "Congratulations, you've solved the problem!" "/problems")) 
     (flash-msg "You've solved the problem! If you log in we can track your progress." "/problems")))
 
 (defn get-tester [restricted]
-  (reduce #(conj %1 (symbol %2)) secure-tester restricted))
+  (into secure-tester (map symbol restricted)))
 
 (def sb (sandbox*))
 

        func-name (:function-name p)
        sb-tester (get-tester (:restricted p))]
    (try
      (loop [t tests]
        (if (empty? t)
          (mark-completed id)
          (let [testcase (replace-str "__" code (first t))]
            (if (sb sb-tester (read-string testcase))
              (recur (rest t))
              (do
                (session/flash-put! :code code)
                (flash-error "You failed the unit tests."
                           (str "/problem/" id)))))))
      (catch Exception e
        (do
          (session/flash-put! :code code)

  (:require [sandbar.stateful-session :as session]))

(defn get-solved [user]
  (set
   (:solved (fetch-one :users
                       :where {:user user}
                       :only [:solved]))))

(defn get-problem [x]
  (fetch-one :problems :where {:_id x}))
