hi
sorry, if this has been already discussed, but i couldn't find the topic in the archives. route outputs a list with one argument instead of outputting a float. this is then a problem, when you try to connect a [route] to the right inlet of an audio-obj like [+~]. doing this will cause the error 'inlet: expected 'signal' but got 'float' '. this can easily be solved by inserting a [f ] before the audio-obj. but is this behaviour of route intended?
roman
see attached patch:
#N canvas 123 196 285 252 10; #X obj 104 59 route 12; #X msg 104 38 12 $1; #X floatatom 104 21 5 0 0 0 - - -; #X obj 38 128 *~; #X obj 37 89 sig~ 1; #X obj 38 149 avg~; #X floatatom 38 171 5 0 0 0 - - -; #X obj 120 132 *~; #X obj 120 153 avg~; #X floatatom 120 176 5 0 0 0 - - -; #X obj 133 111 f; #X text 152 152 <- from zexy; #X text 134 192 ^this works; #X text 50 207 ^this causes errors; #X connect 0 0 3 1; #X connect 0 0 10 0; #X connect 1 0 0 0; #X connect 2 0 1 0; #X connect 3 0 5 0; #X connect 4 0 3 0; #X connect 4 0 7 0; #X connect 5 0 6 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 10 0 7 1;
route outputs a list with one argument instead of outputting a float. this is then a problem, when you try to connect a [route] to the right inlet of an audio-obj like [+~]. doing this will cause the error 'inlet: expected 'signal' but got 'float' '. this can easily be solved by inserting a [f ] before the audio-obj. but is this behaviour of route intended?
well, seems that the list to float conversion isn't really working when converting messages to signals ...
i would consider it as bug, but i'm not sure, if miller does ... anyway, please file a bug report at sf, that this won't get lost somewhere in the archives...
more generally, it might be a good idea to think of an improved list handling (similar to scheme or python) ... or forbid empty lists (= bang, which is done) and one element lists (which should be atoms)
cheers ... tim
Tim Blechmann wrote:
more generally, it might be a good idea to think of an improved list handling (similar to scheme or python) ... or forbid empty lists (= bang, which is done) and one element lists (which should be atoms)
Not sure about scheme, but given its relation to Lisp, this may be true: empty lists are allowable in Lisp, and very useful. Just today I was working on a problem in Pd, constructing a list dynamically, where empty lists would have been handy (the cyclone prepend object doesn't do empty lists). It required some obnoxious extra wiring because I needed to take the first atom in the potential list and route it out elsewhere so it could be prepended to the second atom, then I could start adding on the new atoms as they were created.
Lisp is beautiful and easy to use becuase it's logical: there aren't (m)any exceptions to the rules. A list can hold anything. That can be nothing, atoms, or other lists. The more exceptions you add the more confusing things get imho.
Of course Lisp also ends up with obnoxious things like trying to select an atom and it being the wrong type because it's actually a one-atom list.
Just my two cents.
Ian
cheers ... tim
On Sun, 13 Feb 2005, Ian Smith-Heisters wrote:
Lisp is beautiful and easy to use becuase it's logical: there aren't (m)any exceptions to the rules. A list can hold anything. That can be nothing, atoms, or other lists. The more exceptions you add the more confusing things get imho.
I think Lisp has got it the right way for lists, I mean for including the cases of size 0 and 1. Lists and sets were invented to represent plurality, but they nevertheless include singular (1) and nothingness (0) because they are also valid answers to queries of the type "give me the list of things with such property...". The Pd way appears to be that those queries would be answered by dodging the question complaining that there are not enough things with such property to make a "real" (plural) list.
Of course Lisp also ends up with obnoxious things like trying to select an atom and it being the wrong type because it's actually a one-atom list.
That's a weak argument against Lisp. You can replace every occurrence of CAR with CAR2 defined like
(defun car2 (my-list) (if (listp my-list) (car my-list) my-list))
and it's true that it would be cumbersome to do it for every function that processes lists, but then, code that doesn't treat atoms as 1-lists tends to work better when it comes to handling nested lists.
If I have a two-element list (A B), with both elements being lists themselves, then if I remove B, is the result (A), or just A ? why ? (that's where the Pd way can get really annoying, though nested lists aren't yet implemented in Pd)
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju
Mathieu Bouchard wrote:
Of course Lisp also ends up with obnoxious things like trying to select an atom and it being the wrong type because it's actually a one-atom list.
That's a weak argument against Lisp. You can replace every occurrence of CAR with CAR2 defined like
I didn't intend it as an argument against Lisp, but rather a gripe about the eccentricities of Lisp, or perhaps my own stupidity. Dealing with things like this might be even more annoying in a dataflow language like Pd, but maybe not.
I guess this gets back to a question someone raised earlier in the conversation about where Pd wants to go. Do we want a high level application, like Eyesweb or Isadora, or a programming language? It looks right now like we want somewhere in between. I know I do, if I wanted to program everything I'd do it in C (or Lisp (CLM)), but I need more control than something like Eyesweb offers (dealing with a dastardly problem right now that seems unsolvable given the nature of Eyesweb in combination with my little knowledge of it). Does your average Pd user want to think about converting 1-lists to atoms?
The problems in Pd seem to arise at the borders of either side of the somewhere-between-app-and-language niche Pd has carved out. Like trying to build lists dynamically, or on the other side, just wanting a fancy drum machine I can drop in bada-boom. But then, RRADICAL fixes the latter, and things like the Python and Ruby plugins help on the other end.
Speaking of which... I've been thinking about porting the MAX Lisp object to Pd when I have more time.
(defun car2 (my-list) (if (listp my-list) (car my-list) my-list))
and it's true that it would be cumbersome to do it for every function that processes lists, but then, code that doesn't treat atoms as 1-lists tends to work better when it comes to handling nested lists.
If I have a two-element list (A B), with both elements being lists themselves, then if I remove B, is the result (A), or just A ? why ? (that's where the Pd way can get really annoying, though nested lists aren't yet implemented in Pd)
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://iem.at/cgi-bin/mailman/listinfo/pd-list
Hallo, Ian Smith-Heisters hat gesagt: // Ian Smith-Heisters wrote:
Speaking of which... I've been thinking about porting the MAX Lisp object to Pd when I have more time.
There is a scheme/guile external around, but I don't have the URL handy. Search the archives. ;)
Frank Barknecht _ ______footils.org__
_ __latest track: fqdn _ http://footils.org/cms/show/38
On Mon, 14 Feb 2005, Ian Smith-Heisters wrote:
Mathieu Bouchard wrote:
Of course Lisp also ends up with obnoxious things like trying to select an atom and it being the wrong type because it's actually a one-atom list.
That's a weak argument against Lisp. You can replace every occurrence of CAR with CAR2 defined like
I didn't intend it as an argument against Lisp, but rather a gripe about the eccentricities of Lisp, or perhaps my own stupidity.
Ok, so let me say, it's a weak argument against a bunch of programming languages.
Dealing with things like this might be even more annoying in a dataflow language like Pd, but maybe not.
I wouldn't say it's because it's dataflow. I see "dataflow" in general as open-ended with a lot more to explore. Within that large dataflow-land there's a tiny dot called puredata that's still near the start in many respects.
I guess this gets back to a question someone raised earlier in the conversation about where Pd wants to go. Do we want a high level application, like Eyesweb or Isadora, or a programming language? It looks right now like we want somewhere in between.
Whenever both at once are possible, pick both. You can use Pd as a tool to make high-level applications.
Does your average Pd user want to think about converting 1-lists to atoms?
It's not just about your average Pd user, you know. It's about all the users at once.
Now, about those 1-element lists, I think the problem introduced by not having them is more difficult to solve than the problem introduced by having them. But that kind of thing would appear mostly in cases where lists are grown gradually (or reduced gradually). Not everyone does that.
and things like the Python and Ruby plugins help on the other end.
Well I don't think it's much relevant... I think Pd should have better support for collections.
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju
hi Ian,
Ian Smith-Heisters wrote: ...
working on a problem in Pd, constructing a list dynamically, where empty lists would have been handy (the cyclone prepend object doesn't do empty lists). It required some obnoxious extra wiring because I needed to take
it does, since alpha51: 'list' (or 'bang') in the left inlet outputs an object's state, 'list' in the right inlet clears its state.
Be careful with recursion, though, Pd is not that sort of a language...
Krzysztof
On Mon, 21 Feb 2005, Krzysztof Czaja wrote:
it does, since alpha51: 'list' (or 'bang') in the left inlet outputs an object's state, 'list' in the right inlet clears its state. Be careful with recursion, though, Pd is not that sort of a language...
I've already done some recursion in Pd, but only to see whether it would work.
The problem about it is that Pd is too much dependent on object-state instead of call-state, so it's not easy to just pile things on the call/return stack and unpile them, because a lot of critical data is stored in other locations that don't follow the call/return stack at all. So it's basically a mess.
Fortunately, this isn't too often "required". There's always one more workaround for anything, so there's always one more way to solve a problem without using recursion, but it's a pity that in Pd there is so much of a disincentive to use recursion.
(The worst offenders are actually my own externals... I've done some progress in rearranging things so that in the future it will be easy to fix the problem.)
Sometimes I may talk about data recursion vs control recursion; we're talking about the latter, as data recursion is just any kind of feedback that _doesn't_ use the call/return stack.
I remember talking to Miller (at Andrey Savitsky's show?) about a test suite for Pd, and how that could be structured. It would be cool if, from the code of a test for basic functionality of an object, a test for control-recursion (and one for data-recursion) could be automatically generated, because it would give us a list of all classes that currently support those features, although no documentation mentions those cases.
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju
Hallo, Tim Blechmann hat gesagt: // Tim Blechmann wrote:
route outputs a list with one argument instead of outputting a float. this is then a problem, when you try to connect a [route] to the right inlet of an audio-obj like [+~]. doing this will cause the error 'inlet: expected 'signal' but got 'float' '. this can easily be solved by inserting a [f ] before the audio-obj. but is this behaviour of route intended?
well, seems that the list to float conversion isn't really working when converting messages to signals ...
Or you could see it another way around: Converting floats to signals is done automaticallyi and working just fine. Converting 1-element lists of only one float to a float is also working fine. Converting 1-element lists to signals however is not done automatically. In any case, this definitely is not a problem of [route].
Automatic conversion to my knowledge is only defined for a 1-element list containing a float, which is silently the same as a float, if a float is called for. The example patch however uses [*~] which is intended to multiply two signals. To multiply a signal with a float, an argument to [*~] should be used, like [*~ 0] or similar. If you change the patch to be like that, the error goes away.
(The issue is different for the first inlet of objects btw. [list 440(---[osc~] works fine, even [list 440 10 92 38 stuff(--[osc~] works.)
Frank Barknecht _ ______footils.org__
_ __latest track: fqdn _ http://footils.org/cms/show/38