Hello.
Are messages like
$1-something-$2
supposed to be expanded correctly by PD?
I'm puzzled because I only get the first dollar expanded while the second is considered as literal. For example I get things like
1043-something-$2
I read the manual section but I found no mention to limitations of this kind. I attached an example.
Maurizio Umberto Puxeddu.
hi, only the $-variable at the beginning is expanded. to have special expansions u can use makesymbol or makefilename (i think from zexy). marius.
----- Original Message ----- From: "Maurizio Umberto Puxeddu" umbpux@tin.it To: PD-list@iem.kug.ac.at Sent: Monday, September 09, 2002 10:49 AM Subject: [PD] $ expansion
Hello.
Are messages like
$1-something-$2
supposed to be expanded correctly by PD?
I'm puzzled because I only get the first dollar expanded while the second is considered as literal. For example I get things like
1043-something-$2
I read the manual section but I found no mention to limitations of this kind. I attached an example.
Maurizio Umberto Puxeddu.
I read:
I'm puzzled because I only get the first dollar expanded while the second is considered as literal. For example I get things like
from m_atom.c:
/* convert an atom into a string, in the reverse sense of binbuf_text (q.v.)
- special attention is paid to symbols containing the special characters
- ';', ',', '$', and ''; these are quoted with a preceding '', except that
- the '$' only gets quoted at the beginning of the string.
*/ . . .
regards,
x
On Mon, 9 Sep 2002, CK wrote:
I read:
I'm puzzled because I only get the first dollar expanded while the second is considered as literal. For example I get things like
from m_atom.c:
/* convert an atom into a string, in the reverse sense of binbuf_text (q.v.)
- special attention is paid to symbols containing the special characters
- ';', ',', '$', and ''; these are quoted with a preceding '', except that
- the '$' only gets quoted at the beginning of the string.
*/
Ok, I was trying to use PD without looking at the internals... thanks.
Is there a rationale for that? Like conflict with other features, backward compatibility with Max?
Maurizio Umberto Puxeddu.
Hi, Maurizio Umberto Puxeddu hat gesagt: // Maurizio Umberto Puxeddu wrote:
On Mon, 9 Sep 2002, CK wrote:
I read:
I'm puzzled because I only get the first dollar expanded while the second is considered as literal. For example I get things like
from m_atom.c:
/* convert an atom into a string, in the reverse sense of binbuf_text (q.v.)
- special attention is paid to symbols containing the special characters
- ';', ',', '$', and ''; these are quoted with a preceding '', except that
- the '$' only gets quoted at the beginning of the string.
*/
Ok, I was trying to use PD without looking at the internals... thanks.
It's also explained in the HTML-manual:
""" 2.6.5. dollar signs
In message or object boxes, message arguments starting with a dollar sign and a number (like "$1" or "$3-bazoo") are variables which are substituted with values supplied as part of the environment the message is passed in. """
Note the "starting with a dollar".
Frank Barknecht _ ______footils.org__
On Mon, 9 Sep 2002, Frank Barknecht wrote:
""" 2.6.5. dollar signs
In message or object boxes, message arguments starting with a dollar sign and a number (like "$1" or "$3-bazoo") are variables which are substituted with values supplied as part of the environment the message is passed in. """
Note the "starting with a dollar".
Well probably I'm not smart but the sentence is also ambiguous. I considered "$3" the variable and expected it to be substituted in whatever position it is found.
Maurizio Umberto Puxeddu.
Sounds like I should add another sentence...
thanks Miller
On Mon, Sep 09, 2002 at 05:45:23PM +0200, Maurizio Umberto Puxeddu wrote:
On Mon, 9 Sep 2002, Frank Barknecht wrote:
""" 2.6.5. dollar signs
In message or object boxes, message arguments starting with a dollar sign and a number (like "$1" or "$3-bazoo") are variables which are substituted with values supplied as part of the environment the message is passed in. """
Note the "starting with a dollar".
Well probably I'm not smart but the sentence is also ambiguous. I considered "$3" the variable and expected it to be substituted in whatever position it is found.
Maurizio Umberto Puxeddu.
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
You can use this, if you like it:
"In message or object boxes, Pd performs the so-called "dollar sign expansion". A dollar sign followed by a number is a variable which is substituted with a value supplied as part of the environment the message is passed in. This expansion only happens at the beginning of an argument: "$1" and "$3-bazoo" are expanded but "bazoo-$4" is not.
In the case of message boxes, the environment consists of the arguments of the "list" message (possibly extrapolated from "bang," "float," or other) that the message box is responding to. Thus, if a message box gets "23 skidoo" and if it contains the text, "$2 until $1," out comes the message, "skidoo until 23".
Object boxes contain text which forms a message to be sent to Pd to create and initialize the object. Here, $1, etc., are taken from the context in which the patch was loaded. When the patch is a new document or opened from a file the "$" variables are undefined. But if the patch is an abstraction (see the next section) they are taked from the abstractions' creation arguments.
As a special case of dollar sign expansion, inside abstractions $0 is expanded to a counter which is guaranteed to be unique to that abstraction. The dollar sign expansion mechanism and the special $0 variable can be used to make local objects. For example sends and receives with names like "$0-bear" can be used as local send/receive pairs."
Best,
Maurizio Umberto Puxeddu.
On Tue, 10 Sep 2002, Maurizio Umberto Puxeddu wrote:
As a special case of dollar sign expansion, inside abstractions $0 is expanded to a counter which is guaranteed to be unique to that abstraction. The dollar sign expansion mechanism and the special $0 variable can be used to make local objects. For example sends and receives with names like "$0-bear" can be used as local send/receive pairs."
I would also add:
"In one-off subpatches (see below) $0 expands to the same value of the parent patch. This is consistent with the nature and use of this kind of subpatches."
Maurizio Umberto Puxeddu.