Hi Oleg, In Faust 2.48.0, the necessary changes have been made so that par, seq, sum, and prod can now accept 0 iterations.
We have (neglecting the variable i) : - par(i,0,F),F = F - seq(i,0,F):F = F where par(i,0,F) = route(0,0) and seq(i,0,F) = _,_,... are the neutral elements for parallel and sequential composition. The neutral element for sequential composition depends on the number of inputs and outputs of F. Cheers, Yann Le mer. 31 août 2022 à 22:26, Oleg Nesterov <o...@redhat.com> a écrit : > On 08/26, Yann Orlarey wrote: > > > > I published the version with the 'any' patch. > > Great, thanks Yann! > > can I suggest another patch then? > > With this patch par(i, 0, whatever) has zero inputs and zero outputs, > just like "0:!". To me this looks usefull, and I do remember someone > else on faudiostream-users wanted this feauture, but I can not recall > who and when. > > If nothing else, lets look at fi.filterbank, > > filterbank(O,lfreqs) = an.analyzer(O,lfreqs) : delayeq(nb) > with { > nb = ba.count(lfreqs); > fc(n) = ba.take(n, lfreqs); > ap(n) = highpass_plus_lowpass(O,fc(n)); > delayeq(1) = _,_; // par(i,0,...) does not fly > delayeq(nb) = par(i,nb-1,apchain(nb-1-i)),_,_; > apchain(0) = _; > apchain(i) = ap(i) : apchain(i-1); > }; > > note the "does not fly" comment above. With this patch delayeq(1) > doesn't need a special handling. > > Oleg. > --- > > diff --git a/compiler/evaluate/eval.cpp b/compiler/evaluate/eval.cpp > index 632616c2e..e19638377 100644 > --- a/compiler/evaluate/eval.cpp > +++ b/compiler/evaluate/eval.cpp > @@ -904,7 +904,7 @@ static string evalLabel(const char* src, Tree visited, > Tree localValEnv) > static Tree iteratePar(Tree id, int num, Tree body, Tree visited, Tree > localValEnv) > { > if (num == 0) { > - evalerror(yyfilename, -1, "iteratePar called with 0 iteration", > id); > + return boxRoute(boxInt(0), boxInt(0), boxPar(boxInt(0), > boxInt(0))); > } > > Tree res = eval(body, visited, pushValueDef(id, tree(num - 1), > localValEnv)); > >
_______________________________________________ Faudiostream-devel mailing list Faudiostream-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-devel