diff --git a/Chapter04/Activity4.01/src/packt-clj/game_values.clj b/Chapter04/Activity4.01/src/packt-clj/game_values.clj index 9ce19bc..3dfcf6b 100644 --- a/Chapter04/Activity4.01/src/packt-clj/game_values.clj +++ b/Chapter04/Activity4.01/src/packt-clj/game_values.clj @@ -1,6 +1,5 @@ (ns packt-clj.game-values) - (def game-users [{:id 9342 :username "speedy" @@ -63,22 +62,19 @@ :experience-level 8 :status :active}]) - (defn max-value-by-status [field status users] - (->> - users - ;; step 1: use filter to only keep users who - ;; have the status we are looking for - (filter #(= (:status %) status)) - ;; step 2: field is a keyword, so we can use it as - ;; a function when calling map. - (map field) - ;; step 3: use the apply max pattern, with a default - (apply max 0))) + (->> users + ;; step 1: use filter to only keep users who + ;; have the status we are looking for + (filter #(= (:status %) status)) + ;; step 2: field is a keyword, so we can use it as + ;; a function when calling map. + (map field) + ;; step 3: use the apply max pattern, with a default + (apply max 0))) (defn min-value-by-status [field status users] - (->> - users - (filter #(= (:status %) status)) - (map field) - (apply min 0))) + (->> users + (filter #(= (:status %) status)) + (map field) + (apply min))) diff --git a/Chapter06/Exercise6.07/train_routes.clj b/Chapter06/Exercise6.07/train_routes.clj index 326c949..45e6776 100644 --- a/Chapter06/Exercise6.07/train_routes.clj +++ b/Chapter06/Exercise6.07/train_routes.clj @@ -55,7 +55,7 @@ (= position destination) path (get-in route-lookup [position destination]) - (conj path destination) + [(conj path destination)] :otherwise-we-search (let [path-set (set path)