[PD] unexpected behaviour in [route]
r at raakvlak.net
Tue Mar 1 08:30:51 CET 2011
Mybad, seems it's yet another leftover from my max-days where this was
perfectly possible :)
The route-help talks about the first element of a MESSAGE it receives,
not the type of the first ARGUMENT that is is given upon creation -
which seems to make all the difference. See my example patch in the
Jonathan's explanation (below) seems to explain why that would be the case.
> Date: Sun, 27 Feb 2011 15:43:53 -0800 (PST)
> From: Jonathan Wilkes <jancsika at yahoo.com>
> Subject: Re: [PD] unexpected behaviour in [route]
> 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.
More information about the Pd-list