Re: Add REMOVE to map put/nested_put (maybe?)
- Posted by jimcbrown (admin) Apr 25, 2013
- 1157 views
OTOH, I can't think of a more elegant way to do what you are trying to do. (nested_remove() ? That's superfluous. Rename nested_put() to nested_transform(), and then a REMOVE operation? But nested_put() is so much easier to type.)
It's been swirling around in my head for a few days now, and I feel the same way. How about nested_update(), and/or simply update().
I don't like nested_transform. I prefer nested_put, since it matches put. We'd have to change put to transform, which doesn't sound right.
Why? I don't see why nested_transform() can just call put()/nested_put() when it needs to, and call a remove function the other times. (Of course, that's significantly less elegant than just nested_put(REMOVE).)
I think the solution is to enhance put / nested_put (which implementation actually calls put) with some additional operations.
Matt
Does put() do a REMOVE already? How is that done currently?