Clojure states within states within states

前端 未结 3 1947
梦谈多话
梦谈多话 2021-02-13 02:45

I\'d love to hear what advice the Clojure gurus here have about managing state in hierarchies. I find I\'m often using {:structures {:like {:this {:with {:many \'levels}}

3条回答
  •  你的背包
    2021-02-13 03:30

    I would prefer to use one atom at top level as that would make things really simple and also that indicate that the data represent a state which is modified at once n all by an operation. If you put atoms at each level then it would become way too complex to figure out what is going on. Also if in your case the nesting is going way too deep then I would suggest you to sit back and think carefully whether you need such a structure or there can be any better alternate possible because this will certainly lead to complexity until the nested data is recursive (i.e same structure at each level)

提交回复
热议问题