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!
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
Patrice Colet a écrit :
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 :
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.
ooops sorry I didn't read this.
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
Hallo, Luke Iannini (pd) hat gesagt: // Luke Iannini (pd) wrote:
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).
Nice one. (RTC-lib has some similar ones like [make-scale] and [make-trans-scale], but I guess, "range" is a good name.) I'll include it if you don't mind, though I'll remove the pddplink. All [list]-abs including help files have to work with pd-vanilla withour error messages.
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.
This is probably better kept out of [list]-abs as it uses a non-vanilla object but also because I'm very cautious about dynamic patching and [namecanvase]. I'd rather not use these in the library.
Frank Barknecht _ ______footils.org__
On Wed, Mar 5, 2008 at 12:27 AM, Frank Barknecht fbar@footils.org wrote:
Nice one. (RTC-lib has some similar ones like [make-scale] and [make-trans-scale], but I guess, "range" is a good name.) I'll include it if you don't mind, though I'll remove the pddplink. All [list]-abs including help files have to work with pd-vanilla withour error messages.
Yes, you are of course welcome to include it (and oops, forgot pddplink was an external). If you want, you can just "svn mv" it from my dir to the list-abs home (that would preserve its history in SVN).
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.
This is probably better kept out of [list]-abs as it uses a non-vanilla object but also because I'm very cautious about dynamic patching and [namecanvase]. I'd rather not use these in the library.
Ciao
Frank Barknecht _ ______footils.org__
I figured as much regarding initbang (though I still think it should be a part of vanilla anyway), but what are your suspicions about dynamic patching/namecanvas? Or perhaps, what would you prefer as a solution? Anyhow, no worries, it will have a safe and happy home in senderfruit/core (or maybe senderfruit/list-abs-too-hot-for-tv).
Cheers Luke
Here's another quick pair, again inspired by Python libraries (sorry, Python just seems to love lists as much as Pd .39+ and I do), this time the random module.
[list-sample n] grabs a random bunch of n unique items from the incoming list and outputs them as a new list.
list-shuffle is a shortcut to [list-sample]ing the same number of items as were in the list originally, which results in a shuffled list.
Cheers Luke
O, forgot to mention, list-sample uses [urn] but I figured you could replace it with [urne].
On Thu, Mar 6, 2008 at 2:48 AM, Luke Iannini (pd) lukexipd@gmail.com wrote:
Here's another quick pair, again inspired by Python libraries (sorry, Python just seems to love lists as much as Pd .39+ and I do), this time the random module.
[list-sample n] grabs a random bunch of n unique items from the incoming list and outputs them as a new list.
list-shuffle is a shortcut to [list-sample]ing the same number of items as were in the list originally, which results in a shuffled list.
Cheers Luke
Hallo, Luke Iannini (pd) hat gesagt: // Luke Iannini (pd) wrote:
Here's another quick pair, again inspired by Python libraries (sorry, Python just seems to love lists as much as Pd .39+ and I do), this time the random module.
[list-sample n] grabs a random bunch of n unique items from the incoming list and outputs them as a new list.
list-shuffle is a shortcut to [list-sample]ing the same number of items as were in the list originally, which results in a shuffled list.
Careful here: [list length] behaves differently in 0.39 and 0.40+! Better use [list-len], which is the consistent. Similar caution is necessary when using [urn], which also has two incompatible implementations. You may want to use urne.pd from RTC-lib, but then RTC-lib already includes a kind of list-shuffle/list-sample called scramble.pd
[scramble] | [list split N]
looks as if it is the same as [list-sample N].
Frank Barknecht _ ______footils.org__
Allow me to chime in. I don't know if this is trivial from the list- abs or maybe comes as a special case in one of them. But here goes.
[list-alter-idx] takes tree inputs
and returns the original list but with element number idx altered.
Makes sense? See attached.
It's whoever not robust as if idx is greater then list-length, it
misbehaves. It depends on list-abs. It's inspired by RTC.