hi all and frank
i just made another abstraction today, which might be useful for others as well. i called it [list-match]. it finds a given sequence of numbers in a number stream and outputs a bang on a match.
http://romanhaefeli.net/software/pd/list-match.tar.gz
however, i am not quite sure, if it really deserves the list- prefix, since it expects a number stream and not a list on its left inlet. though, it could be easily modified to find a certain sequence in a list of numbers instead of a number stream. don't know what is generally more useful.
roman
On Mon, 2008-03-03 at 03:30 +0100, Patrice Colet wrote:
Hello, thank you for this usefull [list-range], unfortunately [list-zip] isn't pd-vanilla compatible, I tried to replace [initbang] with [loadbang], but you might know that it wouldn't work in a parent patcher.
PC.
Luke Iannini (pd) a écrit :
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!
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de