scittle 2022-12-05

Something I am observing in the https://github.com/raymcdermott/aoc22 ... the atoms do not seem to be respected per namespace .... for example each ns has this: (def part-1-visible? (r/atom false)) and the buttons toggle its value. But if its set in one ns, it's set in them all. Is that expected or am I holding it wrong?

@raymcdermott I debugged this locally and added to the home-screen:

(defn home-page
  []
  (let [solution-data (edn/read-string @solutions)]
    [:div.m-3.p-3.border-0
     [days solution-data]
     [:div
      (str @day1/part-1-visible?)
      (str @day3/part-1-visible?)]]))
You can quite clearly see that the values can be different at different times, so maybe there's something else going wrong. As you're having quite a lot of state scattered around, it's difficult to keep track of things. It's usually good to put more state together in one atom, e.g. for the entire app. Scittle also has a re-frame plugin which I think is quite good for this multi-screen type of thing

ok - I'll make each of the atoms named by the ns

reframe will be a decent size re-write so 🤷🏼‍♂️

are you saying you have something better to do than writing Clojure?

no but I have to catch up with days 4 and 5 🙂

oh it's already that late?

good luck :-D

I'm on holiday next week so I can catch up properly then 🙂

what I find odd is that there is an atom called data that is not polluted across the namespaces ... must be something else

as I've shown before, it is not a namespace cross-pollution problem, since the atoms can be set independently

yeah I think there is a function that is being re-defined ... gonna put that in the helper

not that ... it's that a bunch of the divs have the same targetID FFS 🙂

😆 1