[PD] unexpected behaviour in [route]

Jonathan Wilkes jancsika at yahoo.com
Mon Feb 28 00:43:53 CET 2011


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:
1) If the first arg is a symbol atom, then [route] is put in "selector" mode and checks 
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.

* The parenthesis should be inside the period.

-Jonathan

--- On Sun, 2/27/11, Pedro Lopes <pedro.lopes at ist.utl.pt> wrote:

From: Pedro Lopes <pedro.lopes at ist.utl.pt>
Subject: Re: [PD] unexpected behaviour in [route]
To: "Jack" <jack at rybn.org>
Cc: pd-list at iem.at, "rene beekman" <r at 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 at 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 at iem.at mailing list

> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




_______________________________________________

Pd-list at iem.at mailing list

UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list





-- 
Pedro Lopes (MSc)
contact: pedro.lopes at ist.utl.pt
website: http://web.ist.utl.pt/Pedro.Lopes / http://pedrolopesresearch.wordpress.com/ | http://twitter.com/plopesresearch





-----Inline Attachment Follows-----

_______________________________________________
Pd-list at iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20110227/6586a829/attachment.htm>


More information about the Pd-list mailing list