On Jun 16, 2:59 am, Colin Yates <colin.ya...@gmail.com> wrote: > Thanks for all the help, all of you. The Clojure community has a reputation > for being helpful :) > > The example of age as a property which might change from a value to a > function was indeed a strawman, but it was just an example. So the > consensus seems to be that yes, that requirement is hard to solve, but as > Sean states, it isn't a particularly common occurrence. KISS with maps > seems to be the way to go. > > Thanks again!
FWIW, in Common Lisp the two main record-like types of objects (structs and classes) are defined using macros that have the option of generating accessor functions for you. Also typically when using raw lists as data structures it is considered good practice to define functions that abstract the access to their elements. If defining functions manually for your maps is tedious, consider coding a macro that does it for you. Note that, unlike accessor methods in OO classes, accessor functions for maps/lists cannot be polymorphic in the type of the data structures they access, so they typically end up encoding the name of the data structure in their own name, e.g person-age. Cheers, Alessio -- 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