[PD] symbolarray

Claude Heiland-Allen claudiusmaximus at goto10.org
Mon Apr 20 20:13:33 CEST 2009


Frank Barknecht wrote:
> Hallo,
> Chris McCormick hat gesagt: // Chris McCormick wrote:
> 
>> On Fri, Apr 17, 2009 at 03:52:33PM +0200, Frank Barknecht wrote:
>>> Now we still need maps/hashes.
>> Maybe this is something close:
>> <http://lists.puredata.info/pipermail/pd-list/2008-03/060712.html>
> 
> Yeah, but I was thinking of something faster than walking around in a textfile
> would be. :) The really nice thing about data structure arrays is that they are
> very fast. The not so nice things are that they only accept integers for lookup
> and that the structure of the thing they store has to be predefined.
> 
> What I would love would be a "map" type field for [struct] so you could say: 
> 
> [struct item float i]
> 
> [struct example map items item]
> 
> just like for the "array" field. But now the index to lookup a map element
> would be a symbol key.
> 
> The setter could look like this: 
> 
>             [symbol key(
>             | 
>             [mapelement example items]
>  [100\      | 
>  |          |
>  [set item i]
> 
> and a getter like this:
> 
>  [symbol key(
>  | 
>  [mapelement example items]
>  |  
>  [get item i]
>  | 
>  [100\
> 
> All in analogy to [element] for arrays
> 
> Ciao

I just knocked up a little (pointless, maldocumented) example (attached).

It basically creates a new abstraction instance for each symbol in the 
map, and binds it to a receive name - so it's as fast/slow as pd's 
settable send is.  Only maps symbols to lists, no float keys or 
meta-message values, and no deletion is supported (though I think I know 
how it would be possible - query the relevant abstraction for its 
position (sent inside as creation arguments) then cut it using the 
nefarious mouse click emulation...).

Enjoy,


Claude
-- 
http://claudiusmaximus.goto10.org

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: assoc.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090420/1ae37410/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: assoc-elem.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090420/1ae37410/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: assoc-help.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090420/1ae37410/attachment-0001.txt>


More information about the Pd-list mailing list