[PD-dev] list object operators
Frank Barknecht
fbar at footils.org
Sat Feb 18 19:47:21 CET 2006
Hallo,
Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:
> On Tue, 10 Jan 2006, Frank Barknecht wrote:
> > what to do with "mixed" lists that also include symbols and gpointers
> > etc., but the basic concept looks very useful to me.
>
> That's a damn good question. The most forward-compatible thing you can
> do is abort on everything you don't know how to handle. If stuff was
> accepted loosely, people would start depending on that behaviour, and
> later introducing a proper behaviour would be impossible.
Now I feel guilty for introducing a naive version in list-emath
(pointwise math), that just passes every non-float element in the
left-hand list unchanged and tries to ignore non-floats in the right
hand list by setting them to the identity element of the respective
math operators +, -, * and / (other operators aren't supported, which
is another disadvantage)
So [list-emath OP] behaves like this:
[5 5 x 5] + [1 2 3 x] ==> [6 7 x 5]
[5 5 x 5] * [1 2 3 x] ==> [5 10 x 5]
Maybe I should change that ...
However I think for things like adding a constant or multiplying with
a scalar, my naive approach of ignoring non-floats should be fine:
[x 1 y 0 z 2] + 1 ==> [x 2 y 1 z 3]
[x 1 y 0 z 2] * 0.5 ==> [x 0.5 y 0 z 1]
[point 1 0 2] * 0.5 ==> [point 0.5 0 1]
Ciao
--
Frank Barknecht _ ______footils.org_ __goto10.org__
More information about the Pd-dev
mailing list