On Thu, Mar 8, 2012 at 9:33 AM, Sean Corfield <seancorfi...@gmail.com>wrote:
> I'm interested in hearing more > about the sort of functions that begin "by unpacking and computing a > large number of values that are all important for subsequent > computations". I'm not seeing this in my code so I assume we're > working on very different problem domains - could you elaborate? > > I can't show my closed-source code, but I'll try to elaborate to give you an idea where I'm coming from. I'm working with trees where the nodes can have a lot of attributes associated with them. I represent the nodes as maps like {:tag ____ :data ____ :children ____ :attribute1 ___ :attribute2 ___} When working with a tree node, not only do I have to destructure/unpack a lot of these attributes, but often, there are several "measurements" I need, which are computationally intensive because computing those measurements generally involves walking the tree. Not all nodes have all the attributes, so there is a fair amount of testing as I'm destructuring and computing these measurements to make sure I'm doing the right thing. I use multimethods, dispatching on :tag, to handle certain types of context-sensitive behavior, but that alone doesn't handle all the dynamic combinations of attributes that can occur. If the helper function is external to the main function, that becomes a lot of stuff that needs to be passed along and immediately destructured at the other end. -- 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