> On 16. Jul 2020, at 20:05, Oleg Nesterov <o...@redhat.com> wrote: > > On 07/16, Till Bovermann wrote: >> >> import("stdfaust.lib"); >> dsBus2int_6 = si.bus(6) : \(x0, x1, x2, x3, x4, x5).(left_shift((x0, x1, x2, >> x3, x4, x5))) with { >> left_shift((x, xs)) = left_shift(xs) & ((x > 0) << 1) ; >> left_shift(x) = x > 0; >> }; > > not that it matters, but si.bus(6) above is not needed.
thanks for pointing this out, I am aware of that this does not matter in this particular case (I like to understand the in/out dimensionality of my definitions and am somehow missing haskell type signatures... and this is the closest I can get :) ) > >> process = (1, 0, 0, 1, 1, 1) : dsBus2int_6; >> ``` >> >> Now I'd like to write a version that takes an N-dimensional stream (N < 32) >> with the interface >> >> ``` >> process = insignal : dsBus2int(N) with { >> N = 12; >> insignal = si.nus(N); // or something else... >> }; >> ``` >> >> What I need to do, is to turn the parallel composed items of `si.bus(N)` >> into a list that can be processed by the `left_shift` recursive expression >> without the step of explicitly declaring the parameter-list `x0, x1, ...` in >> the lambda expression... > > Heh ;) I too tried to implement something like this but didn't find a > clean solution. > > IIRC, I had to do something like > > var(1, op) = \(x1). (op((x1))); > var(2, op) = \(x1,x2). (op((x1,x2))); > var(3, op) = \(x1,x2,x3). (op((x1,x2,x3))); > var(4, op) = \(x1,x2,x3,x4). (op((x1,x2,x3,x4))); > var(5, op) = \(x1,x2,x3,x4,x5). (op((x1,x2,x3,x4,x5))); > ... > > var(32,op) = ...; > > now you can do > > process = insignal : var(N, dsBus2int); > > as long as N is constand and <= 32. uh. this is a working solution, however less than elegant. But if not even you did come up with a programmatic (rather than brute force) way of this kind of type conversion, I guess I just stop searching and use brute force... :) cheers and thanks! Till _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users