[PD] heads or tails?
barknech at ph-cip.uni-koeln.de
Thu Aug 15 19:19:09 CEST 2002
Adam T. Lindsay hat gesagt: // Adam T. Lindsay wrote:
> I was wondering if there's a regular way of extracting the head and the
> tail (meaning everything but the first element... think car/cdr) of an
> arbitrary list message. I'm rooting through the docs, and am not able to
> come up with an elegant way of doing this. (looked through the past two
> months of archives, and didn't find much)
I think, the "cdr" part doesn't exist, but I would be very happy if
I'm going to be proved wrong. Maybe ZEXY has some things inside to
handle "cdr" cases, but I'm not that familiar with ZEXY.
> Why do I want to do this?
> I'm trying to write an abstraction that takes in a netreceive and
> dispatches it to a receiver that's labelled with the first name in the
> list, e.g. a netsend of:
> foo bar baz;
> ...results in a message of "bar baz" being sent to [r foo].
You might want to explore ";"-messages, like the well known
[; pd dsp 1(
They work like named sends. If you have a colon message like:
[; $1 $2(
and you send it a list with, say, "volume 17" a receiver [r volume]
will get the value "17".
> I have a hack with a set number of arguments making heavy use of
> [trigger], variable substitution, and "add2" and "set" message boxes, but
> I can't get it to work with arbitrary-length messages.
Wll, with arbitrary lenght messages, the ";" trick will fail. You
might get a bit farther with [textfile]
Frank Barknecht _ ______footils.org__
More information about the Pd-list