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
(ns demo.ui | |
(:require | |
[reagent.core :as r])) | |
(defonce state (r/atom {:game-board [[:x :o :x] [:o nil nil] [nil nil nil]] | |
:current-player :x})) | |
;; "how can i represent any moment of my app as a dictionary" | |
(defn flip0 [player] | |
(if (= player :x) |
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
(ns demo.core) | |
;; inputs are "litres/s" | |
;; bucket is leaking 1 l/s | |
;; bucket has capacity of 10 | |
;; does the input overflow the bucket? | |
(defn leaky-bucket-overflowing? | |
[limit list] | |
(->> list |
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
;; 2 blue balls, 6 yellow balls | |
;; opt a - take 3, win if there are not 2 blue | |
;; opt b - take 1, win if it isn't blue | |
;; which option better? | |
;;(def bag {:blueballs #{'x 'y} :yellow-balls #{'a 'b 'c 'd 'e 'f}}) | |
;;(def bag [1 1 0 0 0 0 0 0]) | |
(def prototype-bag |
OlderNewer