{"action":"created","issue":{"url":"https://api.github.com/repos/aaronc/freactive/issues/47","labels_url":"https://api.github.com/repos/aaronc/freactive/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/aaronc/freactive/issues/47/comments","events_url":"https://api.github.com/repos/aaronc/freactive/issues/47/events","html_url":"https://github.com/aaronc/freactive/issues/47","id":87870091,"number":47,"title":"Question: are cursors more update-efficient than a massive atomic hash-map?","user":{"login":"alexandergunnarson","id":4691106,"avatar_url":"https://avatars.githubusercontent.com/u/4691106?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandergunnarson","html_url":"https://github.com/alexandergunnarson","followers_url":"https://api.github.com/users/alexandergunnarson/followers","following_url":"https://api.github.com/users/alexandergunnarson/following{/other_user}","gists_url":"https://api.github.com/users/alexandergunnarson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandergunnarson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandergunnarson/subscriptions","organizations_url":"https://api.github.com/users/alexandergunnarson/orgs","repos_url":"https://api.github.com/users/alexandergunnarson/repos","events_url":"https://api.github.com/users/alexandergunnarson/events{/privacy}","received_events_url":"https://api.github.com/users/alexandergunnarson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-12T22:36:30Z","updated_at":"2015-06-19T20:26:26Z","closed_at":null,"body":"I often tend to put my application state in an all-encompassing one-or-two-level-deep hash-map wrapped in an atom. Let's say that a DOM element ```:div#a``` reactively (i.e., via the ```rx``` macro) changes its color based on ```(-> @state :div#b :style :color)```. Now let's also say that ```:div#c``` reactively changes its color based on ```(-> @state :div#d :style :color)```. Div A depends on div B, and C on D, but [A and B] do not affect [C and D] at all, and vice versa.\r\n\r\nNow suppose that ```(swap! state assoc-in [:div#b :style :color] :white)``` is called. Because the value of ```state``` is atomically modified, are the colors of divs A *and* C considered \"dirty\" and thus the values must be recalculated by calling the functions which ```rx``` created for each of them respectively? Or does freactive know that only div B's color was changed and so C's does not need to be recomputed?\r\n\r\nThis brings me to the question in the title: would cursors be more efficient in this case? Instead of writing code like so:\r\n\r\n```\r\n[:div#a {:style {:color (rx (-> @state :div#b :style :color))}}]\r\n```\r\n\r\n...should I write code like this?:\r\n\r\n```\r\n[:div#a {:style {:color (let [c (cursor state (comp :color :style :div#b)]\r\n                          (rx @c)\r\n```\r\n\r\nThat is, would cursor ```c``` only be invalidated if div B's color changed and not on every modification to ```state```?\r\n\r\nThanks for your time!"},"comment":{"url":"https://api.github.com/repos/aaronc/freactive/issues/comments/113632227","html_url":"https://github.com/aaronc/freactive/issues/47#issuecomment-113632227","issue_url":"https://api.github.com/repos/aaronc/freactive/issues/47","id":113632227,"user":{"login":"pkobrien","id":10262321,"avatar_url":"https://avatars.githubusercontent.com/u/10262321?v=3","gravatar_id":"","url":"https://api.github.com/users/pkobrien","html_url":"https://github.com/pkobrien","followers_url":"https://api.github.com/users/pkobrien/followers","following_url":"https://api.github.com/users/pkobrien/following{/other_user}","gists_url":"https://api.github.com/users/pkobrien/gists{/gist_id}","starred_url":"https://api.github.com/users/pkobrien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkobrien/subscriptions","organizations_url":"https://api.github.com/users/pkobrien/orgs","repos_url":"https://api.github.com/users/pkobrien/repos","events_url":"https://api.github.com/users/pkobrien/events{/privacy}","received_events_url":"https://api.github.com/users/pkobrien/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T20:26:26Z","updated_at":"2015-06-19T20:26:26Z","body":"Can you explain why ```(rx @c) is redundant``` in this case?"}}