[PD] A couple new list-abs

Luke Iannini (pd) lukexipd at gmail.com
Mon Mar 3 02:33:43 CET 2008


Hallo,
Here're two new list-abs, list-range and list-zip.

list-range spits out sequences from n1 to (n2 - 1), optionally
separated by a positive or negative "step" interval m.  It's based on
Python's range() function[1].  You can either use it as a shortcut by
specifying creation arguments and [bang(ing it, or send in one, two or
three arguments to get a new sequence (n1 (for 0...n1-1), n1 n2, or n1
n2 m).

list-zip interleaves lists of equal length to produce a new list.  It
defaults to two lists, but uses dynamic patching to modify its inlets
to accept an arbitrary number of lists.  So, for example, [1 2 3 4(
and [A B C D( would become [1 A 2 B 3 C 4 D(.  list-zip is based on
Python's zip() function[also 1].

Regrettably[2] list-zip requires [initbang] for its dynamic inlet
creation, but list-range is a purely vanilla affair, requiring only
the existing list-abs from Frank's library.

Inside the help for list-zip, you'll find a recreation of
list-enumerate using 4 objects.

Cheers
Luke

[1] http://docs.python.org/lib/built-in-funcs.html (sorry, they don't
have links to the individual functions)
[2] only regrettable that this isn't included in vanilla yet!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list-range_and_list-zip.zip
Type: application/zip
Size: 3984 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080302/0f8c573c/attachment.zip>


More information about the Pd-list mailing list