On 07/18, Yann Orlarey wrote:
>
> Hi Oleg,
>
> Here is an implementation of apply. It's the closest I've found ;-). The
> idea is to pass to the op function a list of selectors that simulate the
> formal parameters but that can be created in arbitrary numbers.

(Heh ;) I tried to do something similar but I used ba.selector(i, N) rather
 than route(). ba.selector doesn't work and I am not surprised).

> tsum((x, xs)) = sin(x)/cos(x) + tsum(xs);
> tsum(x) = sin(x)/cos(x);
>
> apply(N,op) = par(i,N,_) <: op(selectors(N))
> with {
> selectors(N) = par(i,N,selector(N,i));
> selector(N,i) = route(N,1,i+1,1);
> };

Ah, thanks a lot Yann! It seems to work.

Hmm. If only I understood why does it work ;) Say,

        apply(N,op) = op(par(i,N, route(1,1,1,1)));

doesn't. It acts the same as si.bus() and has the same problem. Looks
like, "<:" above is essential part.

        apply(N,op) = op(route(N,N, par(i,N, (i+1,i+1))));

        process = apply(4, tsum);

doesn't even compile. Apparently because, unlike par(), route() doesn't
match to (x,xs). Indeed, isBoxPatternOp() doesn't even check isBoxRoute...
Please consider this as a feature request ;)

Thanks!

Oleg.



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to