This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-23
Channels
- # beginners (22)
- # cider (6)
- # clara (1)
- # cljs-dev (77)
- # clojure (23)
- # clojure-austin (5)
- # clojure-dusseldorf (1)
- # clojure-france (16)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-russia (26)
- # clojure-spec (5)
- # clojurescript (120)
- # datomic (1)
- # events (1)
- # hoplon (158)
- # leiningen (5)
- # off-topic (2)
- # om (24)
- # onyx (19)
- # other-languages (1)
- # ring-swagger (4)
- # sql (1)
- # vim (1)
I’m trying to render a simple 2D grid (with reagent) and I’m missing something:
(def app-state
(r/atom
{:board
[nil nil nil]
[nil nil nil]
[nil nil nil]}))
;; UI components
(defn grid
[]
[:div
(for [row (:board @app-state)]
[:div.row
(for [col row]
[:div.tile])])])
I think that the app state is wrong, maybe
{:board [ [nil nil nil]
[nil nil nil]
[nil nil nil] ]}
really I don’t know where is the problem, I’m trying to make it works but I can’t…. 😔
@mruzekw I’ve solved it, but I don’t know why it doesn’t work with the other form…. (defn grid [] [:div (for [row (:board @app-state)] (`do` [:div.row (for [col row] [:div.tile])])]))
Hey y’all. I’m confused about how to write a recursive function that continuously iterates a value… the way you would in an iterative numerical solution to a problem
I’m doing an n-armed bandit, which means I’ve got functions that continually refine an array of n floats, which are the estimates of the values of n states
This is what I have:
(defn run-experiment []
(let [b (generate-bandit 10 0 1) ; The bandit, i.e. the true value function
v (vec (repeat 10 0.0)) ; Our estimation of the value function
p (partial epsilon-greedy-policy b 0.1)] ; Epsilon greedy
(loop [values v]
(let [return (p values)]
(recur (assoc values (first return) (second return)))))))
generate-bandit just gives an array of 10 floats which are the true values (which I’m trying to iterate towards)
epsilon-greedy-policy is a function that takes the bandit (true values), an epsilon value, and a vector, and applies an epsilon-greedy algorithm to the value array, returning which value was chosen and what the new updated value is