On Jan 26, 2006, at 1:36 PM, Frank Barknecht wrote:
Hallo, Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
But with pd-0.39 this issue is solved thanks to the [list] object, that automatically converts everything to a full-blown list-list, if one is needed. This is another reason to upgrade to 0.39 soon, if someone hasn't done so yet.
Sadly, this doesn't fix the problems [route] and [print] have with lists. See [pd has some odd cases of list handling] in doc/pddp/all_about_lists_vs_anythings.pd
Maybe I'm just too used to the way lists and selectors work in Pd, but I don't see where the problem with [route] is (I agree, that [print] sucks.)
First: [prepend] is an external so it has its own rules and cannot be an argument against the way, Pd handles selectors and lists .The Pd object to use is [list prepend]. It always outputs list-lists.
That takes care of two examples in the pddp-patch.
"one 2 three" vs. "list one 2 three":
[route one] behaves correctly here. If one wants to get "2 three" as a result for the second message, then one should use [list trim] in front of route. Fixing the complaint in the pddp-patch actually would make [route one] imply a [route list] or [list trim] internally which is inconsistent and not always wanted so it's better to keep it explicit with [list trim].
"1 two 3" vs. "list 1 two 3"
If one can accept that numbers can never be selectors, then the automatic conversion of selector-less lists starting with a float to list-lists is not unusual. And once it is accepted, that "1 two 3" actually is *the same* as "list 1 two 3" in the same way, that "float 3.141" is the same as "3.141" I also don't see a real problem.
The only possible difficulty is to understand, that "one 2 three" is *not* the same as "list one 2 three" and that [route] thus will behave differently here.
The only case where I could follow the difficulties is the automatic conversion of "list x" to "symbol x" in [route]. This is consistent with converting "list 1" to "float 1" but of course is different from the auto-conversion of "1" to "float 1" because "x" is not the same as "symbol x" immediatly.
However: In my view "list x" being equivalent to "symbol x" has advantages in practice, because if after some operations you end up with a list-list containing only one symbol, you probably want a symbol actually. At least that is my experience.
Btw: While testing around some cases, I actually think I found a bug in [select] which is illustrated in attached patch.
Now that this behavior is all mapped out, its not impossible to figure it out and understand. But I find that when I am working with processing messages, its far from intuitive. And it was not straightforward to learn.
My quick answer to the above is that I think that [route symbol] should always output a symbol and [route list] should always output a list just like how [route bang] always outputs a bang and [route float] always outputs a float. That seems consistent and logical to me. Then if I want to convert lists to bangs, symbols, floats, or undefined sets, I could do so afterwards, with [list] or whatever.
I'll have to explore the 0.39 [list] object a bit more to see how it changes my concerns with the list processing stuff.
.hc
________________________________________________________________________ ____
"Terrorism is not an enemy. It cannot be defeated. It's a tactic. It's about as sensible to say we declare war on night attacks and expect we're going to win that war. We're not going to win the war on terrorism." - retired U.S. Army general, William Odom