(defn next-unsolved-problem [solved-problems last-problem-id] (when-let [unsolved (->> (get-problem-list (> :_id last-problem-id)) (remove (comp (set solved-problems) :_id)) (seq))] (apply min-key :_id unsolved)))