Dict and Append
I have the need to send a series of values into a dict and I would like to be able to append to existing values for any key. As it turns out, the "append newkey $1" method works perfectly for a "top-level" key, whether it already exists or not (that is, you can also create nonexistent keys using the append message). However, it seems that dict does not allow you to use the very same approach to append nested keys with new values. So, "append newkey::newsubkey $1" will just return an error. Now, you can create nested keys using the "replace" message, but even after doing so, I can still not use the append message to add new values to that subkey.
If anyone has advice on how to append to existing key data when that key is nested, I would greatly appreciate it.
Here’s a quick patch to demonstrate:
----------begin_max5_patcher---------- 763.3oc0X0saaBCE9ZxSgEZWlEYCXHoWs8bLUE4.dotBLHiSZ5p5697ejPRQ pzVfwt.jNGis+Nem+r4kEd96JOQq8A2A9Evy6kEddFUZEdNYO+BxozbRs4y7 Kn00j8T+k1wjzSRi9zbJQznkkYzUt6wuG.aT96RtjSJnlg9ofQxaFo7fLmJk OWQsHw2GbeqIUy9iY.TvJnSM+PAiqliASAWTZWIiVjSaEQl9.iueqflJsqeX vJ7RPBRsbfvD8az5UPv85I75hE5WKGI5.kLCoCbnlCFU9nlJAJ.siJpu6t5B RddWjCd9QN30nKjCBgFE1QPqxIozdvPQyOFJAF2hgBweIFhSeRYmugfxKIY6 H78cQIgeBJwrVeHZA8Qok.Ke.M7QLT+N.NvwMH0ZpRYWBhVBvcwMAyuvkHcr gBzaZEzrdp4Ez7iW1DOXzRFKUt5Hi9TGl949O8H5F9tdQTjocQHxDkuYyH.3 3gAvV50g2fDaUJckqAMviTUQ4Y2TGG7MTG1Ed1lZ5h9vAiRt40TT2bSzbM8r 4X.IiQSNcV.3GZyEvo0xm6fX9L85zKKqjSDpETQSMOC.cE890GftDsjK8+bS plbjlsUYTp4rkHkB1tCR6cQ7Nyad9TUXRVqba8tITFtjJ1R4jc4FbCMiYbCC uynlUTkS6pMx+KdCWwOmy.EN4NCyF4my32dYSCX05u1CUWdPj1PYtJBfKvMS kdv3DMQ15aPW8MOvxxn71cExX0ZHlcFiuIRounA2CzDNYnA0CzDOYnIrGnIY 53l9PNQSGbB5AbvuCbJXYUkLtzkJEEjn+cFXSA2VBW1kgC9gCPZ3MvODpALJ zThZi8LGWI.gMEuvNo+UVV3WvxhfQsLsFIqs4bZilsEM71VB5h6X7M.7va.3 MvIz.RFgnqXyewT0ZGeF+ZgQ.95+g6Pm1GYRtsn2ka2KzaOIg5RDGU2dvg.C vUmp6wRgVLYoQjwshF.3KnGYMeuUCQnNljTcfmCB6A2NsN1egdedcweAuz5Q IB -----------end_max5_patcher-----------
(edited by admin – pasted patcher as compressed)
- This topic was modified 10 months by Ben Bracken.
I can see this here and we will take a closer look. In the meantime, you will need to use the ‘get’ message and then append the new data to the key’s current value.
I’m now using the workaround you suggested, using the ‘get’ message followed by an ‘append’ with the first new value and iterating through that in order to refresh those nested key values. It is OK for now, though it would be awesome to have ‘append’ functionality throughout various levels of the dict structure.
Also, thanks for fixing my giant paste.
Forums > MaxMSP