Last active
August 29, 2015 14:03
-
-
Save amacdougall/80c073adb4e06738d452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Bogey (sets the :current boolean for each player) | |
(defn select-player [app player] | |
(om/transact! app :players (fn [players] | |
(mapv (fn [p] | |
(assoc p :current (= p @player))) | |
players)))) | |
;; Birdie -- but I feel like it's more cognitive load | |
(defn select-player [app player] | |
(let [set-current #(assoc % :current (= % @player))] | |
(om/transact! app :players #(mapv set-current %)))) | |
; NOTE: See core.cljs for the usage with (partial select-player app player). That part is cool. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment