It's worth considering how *nested* accessors would work in the
context of immutability.

The nested maps approach works really nicely, due in part to functions
like assoc-in:

; From Mark Volkmann's tutorial
(assoc-in person [:employer :address :city] "Clayton")

What would the above update look like if 'address' was accessed using
functions like get-address and set-address?

Functions like assoc-in clearly rely on a uniform way of getting/
setting fields (i.e. maps).

My *hunch* is that the right avenue is to extend/implement clojure's
map classes if injecting behaviour is ever necessary. (A standard/
supported way to do this would be nice.)

I'd be happy using constructor functions like (make-complex-number)
and (make-person) which can hide detail of their implementations, but
I'd also like to benefit from all that goes with the idiomatic use of
maps.

(My 2c)
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to