In your quote of Miller's help patch you left off half the sentence. Here's the full quote:
"Route checks the first element of a message against each of its arguments, which may be numbers or symbols (but not a mixture of the two.)"*
The part before the comma is wrong-- that's not how [route] works. The reality is:
the selector against its arguments. Subsequent args are assumed to be symbol atoms (and if you try to use a float as a subsequent arg it will be treated as an empty symbol). 2) If the first arg is a float, then [route] is put in "list" mode and checks the first element of an incoming list against its arguments. Subsequent args are assumed to be floats (and if you try to use a symbol it will be treated as the value "0").
So what you quoted is the answer, as long as the questioner magically realizes to ignore everything before the comma.
-Jonathan
--- On Sun, 2/27/11, Pedro Lopes pedro.lopes@ist.utl.pt wrote:
From: Pedro Lopes pedro.lopes@ist.utl.pt Subject: Re: [PD] unexpected behaviour in [route] To: "Jack" jack@rybn.org Cc: pd-list@iem.at, "rene beekman" r@raakvlak.net Date: Sunday, February 27, 2011, 11:49 PM
The first paragraph of route-help states: "which maybe numbers or symbols (but not a mixture of the two unless the datatypes are defined explicitly)" Its the answer.
See the help patch.
On Sun, Feb 27, 2011 at 10:40 PM, Jack jack@rybn.org wrote:
This is not a bug.
Just do something like this to avoid any problem :
[route number number number ...]/[route word word word ...]
++
Jack
Le dimanche 27 février 2011 à 22:46 +0200, rene beekman a écrit :
I'm preparing some patches for courses that I teach and I noticed
behaviour in [route] that I found unexpected or at least inconsistent.
Attached is a patch that demonstrates the problem.
In short: when mixing types of arguments for [route], the object will
fail to properly route a float if the float is preceded by a symbol
argument.
For example:
[route 12 nobug] will route 12 properly
[route bug 12] will send any incoming 12 to its last ('undefined')
output
This is with Pd Extended 0.42.5 on Mac OS 10.6.6
Is this a bug or am I overlooking something?
Rene
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