Re: Add REMOVE to map put/nested_put (maybe?)
- Posted by jimcbrown (admin) Apr 24, 2013
- 1234 views
I was going to open this as a ticket but I thought maybe I should collect some feedback first. The functions put and nested_put provide operations for modifying the value stored in a key, and most of these have complimenting operations (ADD/SUBTRACT, MULTIPLY/DIVIDE, etc.). While whole values can be removed from the map using remove, there exists no method to remove a value added with APPEND. Thus, I propose we add a new REMOVE operation that would remove things from a list of values as shown below. Thoughts?
Well, the other operations ultimately put something back into the map after running the various transformations on it. Using a nested_put() with a REMOVE operation is somewhat counter-intuitive, since the 'put' does the opposite - it pulls something out, and puts nothing back in its place.
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.) So, I'd be willing to go along with this.