[PD] [list] output
Jonathan Wilkes
jancsika at yahoo.com
Thu Feb 4 20:31:56 CET 2010
--- On Thu, 2/4/10, ypatios <ypatios at gmail.com> wrote:
> From: ypatios <ypatios at gmail.com>
> Subject: Re: [PD] [list] output
> To: "Jonathan Wilkes" <jancsika at yahoo.com>
> Cc: pd-list at iem.at
> Date: Thursday, February 4, 2010, 6:31 PM
> hello
>
>
>
> But as far as I can tell, [list] doesn't do any
> conversion at its outlet--
>
> everything it outputs will have the selector
> "list", and it's up to other
>
> objects like [route] to do any conversion they deem
> necessary.
>
>
>
> For example, take the bug with sigbinops:
>
>
>
> [put anything you want in this message box(
>
> |
>
> [list]
>
> |
>
> [+~ ]
>
>
>
> error: inlet: expected 'signal' but got
> 'list'
>
>
>
>
> [1, 1 2, a, a b, a 2 b (
> |
> [list ]
> |
> [print ]
>
> gives the following (0.42-5):
>
> ######
> print: 1
> print: 1 2
> print: symbol a
> print: list a b
> print: list a 2 b
>
> ######
>
> so [list ] does some kind of conversion. what i don't
> understand is why there is no selector printed in the first
> two messages, where only numbers are present.
As far as your output from [print] goes:
For "1" and "1 2", they are an implicit float and implicit list,
respectively. This is a convenience feature of Pd: you don't have
to type "float 1" every time you want to send a number from a msg box
to a [+] object, for example.
For "list a b" and "list a 2 b", you would expect this because all
non-list messages are converted to lists at the _inlets_ of the
[list] object.
So that leaves "symbol a" unexplained: why isn't it "list a" if my
theory is correct? It's because the [print] object decided to print it
that way: it receives a message "list a" and calls the print_list method,
which decides to print "symbol a" instead of "list a".
Here's a trick that shows clearly what is happening in Pd 0.42-5, using
the -n flag of [print], which suppresses the word "print":
[1(
|
[print]
[1(
|
[print -n]
For the first one, the print_method (x_interface.c) prints the
word "print", followed by a colon, and the float itself. For the second
one, the word "print" is absent, so print_method then decides not to
print a colon either. Only the float is printed.
However, consider the following:
[1(
|
[list]
|
[print -n]
Now the [print] calls the method print_list because the incoming message
is a list. How do I know this? Because of a bug: instead of just
printing the float-atom (as above), the output is ": 1", which matches the
way print_list is telling Pd to format a list with at least one element
that is not a symbol. [1]
Likewise, the output "symbol a" you referred to above enters [print] as
"list a", and gets formatted as "symbol a" because it's a one-element
list, with that element being a symbol-atom.
This is complicated by the fact that objects like [route] do a similar
trick.
Ok, now I'm pretty convinced that [list] always outputs a list.
[1]- On older versions of Pd, you can still see a discrepancy if, for
example, you compare the way [print] formats a gpointer, and a list
containing one gpointer.
-Jonathan
>
> anyways, you should provide [+~ ] operator with an argument
> if you want it to expect messsages instead of a signal
> (check help patch) :-)
>
>
>
> ciao
>
> --
> ypatios
>
>
More information about the Pd-list
mailing list