[PD] [pdconv16_r] Topic idea: Nested lists

Roman Haefeli reduzent at gmail.com
Mon Oct 31 13:53:10 CET 2016


How can Pure Data's capabilities for dealing with different data sets
be extended? Does it make sense to adopt concepts from scripted
languages to the dataflow paradigm? Examples: tuples, dictionaries,
multi-dimensional arrays, [...]

PROPOSAL:
Syntax for nesting lists so that lists can be organized in a
hierarchical manner and sublists (as opposed to only atoms) can be
access with dollargs.

Reserved symbol atoms '{' and '}' could be used to enclose sublists
(Since those characters are forbidden now, introduction wouldn't break
anything).  

An example nested list containing two sublists:

'list { a b c } { 1 2 3 }'

The third element of the the first list would be accessed like this:

[list $1(   <- returns 'list a b c'
|
[list $3(   <- returns 'symbol c'

Dollargs would strip the encompassing curly braces and return only the
content of the specified sublist:

[list $2(   <- returns 'list 1 2 3'

To extract the second sublist without losing its encapsulation, one
would use:

[list { $2 }(  <- returns 'list { 1 2 3 }'

The same syntax can be used for dollargs used in arguments. This allows
to pass a whole list or even a list of lists through a single dollarg:

[myabstraction { animal mammal cat }]

and inside this abstraction, we have:

[oscformat $1 miau]  <- instantiates [oscformat animal mammal cat miau]


Whether to use curly braces or something different as list markup and
whether to separate markup symbols with spaces or not is to be
discussed. Also, the feasibility to implement the proposed idea would
be an important discussion point, since the proposer only considered a
user point-of-view. 





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20161031/98aca27c/attachment-0001.sig>


More information about the Pd-list mailing list