I'm trying to get to grips with requesting and caching progressively more detailed information from a data source, and I'd appreciate some pointers on idiomatic ways to achieve this in Clojure.
The current implementation is in Angular, and the actual implementation would be in ClojureScript, but I'm making an assumption that the approach will be similar, and it's the change of perspective with respect to immutability and a Clojure mindset that I'm really interested in. As a simplified version, I have data available at 3 levels. For the purposes of this example, imagine it's job applicants: 1) A compressed index. This is sent in one shot at startup, as an array of structures with minimal information, one small entry for each candidate. Each entry contains values for Location, Salary and Years of Experience. Essentially just enough to establish a sort-order and very basic filter, and small enough in total to transfer in one shot and cache locally 2) A medium index. As entries from the compressed index are rendered on a page of results, I fire off a request for a small batch of extra detail that fills in values such as Name, Address and maybe a link to a profile image. When a page full of these comes back, I attach the extra details to it's entry in the compressed index, and can then display something a bit more readable. 3) A full entry. I someone elects to drill down to an entry, I fire off a background request for full details and then again attach it to the cached list (in fact I speculatively fire off a request for the next N in the list) My natural reaction is to model this as a sequence of maps, and alter the contents of each entry by manipulating the map as more detail comes back a :medium and :full entry that slowly gets populated as more data becomes available. But I can't help feeling that's twisting things to match my old eveythings-mutable-observe-and-refresh view of the world. if I have a main index of, say, 1000 entries, and I update the map for one of those entries, do I always code as if expecting to get a new immutable sequence with only that update applied? Is it just my superstition that makes me recoil a bit from that thought? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.