You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies if I'm using the wrong terms, but the distinction clearly exists in Faust while I can't find much explanation about it.
Say I have an abstraction defined like
abstr(K, x) = par (i, N, i*K+ (x : ba.selector(i, N)) ) with { N = outputs(x); };
inputs(abstr) is 2. I can even partially apply it like abstr(7) and inputs(abstr(7)) is 1. And I can further apply that using double parentheses to pass something to it, like:
abstr(7)((1, 2, 3))
But I can't figure out how to convert abstr(7) into something that can simply be passed "a bus as input", i.e. I want to write:
(1, 2, 3) : adapter(abstr(7))
Simply writing ((1, 2, 3)) : abstr(7) doesn't work because of the auto-flattening on the left of : here produces a circuit with 3 outputs.
How do I write this adapter?
I think I need to pass a bus to abst(7) like
(1, 2, 3) : abstr(7)(si.bus(3))
Gives
ERROR : sequential composition A:abstr(7)(_,_,_) The number of outputs [3] of A must be equal to the number of inputs [9] of abstr(7)(_,_,_) Here A = _,_,_; has 3 outputs while abstr(7)(_,_,_) = (0,(_,_,_ : _,!,!) : +),(7,(_,_,_ : !,_,!) : +),(14,(_,_,_ : !,!,_) : +); has 9 inputs
So, oddly enough, the expression on the right of : has 9 inputs, not 3?! Or at least that's what the compiler thinks at some state. If I do pass it 9 inputs, the SVG diagram also look weird. It seems the "extra" inputs don't even reach abstr(7)(si.bus(3)), even though the Faust compiler wanted them!
Is this a bug in Faust, or am I missing something?
Ok, I figured that part out, it's because of how ba.selector is implemented with cuts, so I need <: not :.
I guess I need to see if I can abstract this process now... to an adapter abstraction.
And the automated glue looks like this:
busAdapter(N, someAbstr) = si.bus(N) <: someAbstr(si.bus(N));
ok = busAdapter(3, abstr(7));
process = ok;
Produces the same diagram. Of course, one needs to size the bus for the abstraction, so that number needs to be an argument to busAdapter. And, of course, something like process = (1, 2, 3) : ok; also works now. I guess answered my own question.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Apologies if I'm using the wrong terms, but the distinction clearly exists in Faust while I can't find much explanation about it.
Say I have an abstraction defined like
inputs(abstr)is 2. I can even partially apply it likeabstr(7)andinputs(abstr(7))is 1. And I can further apply that using double parentheses to pass something to it, like:But I can't figure out how to convert
abstr(7)into something that can simply be passed "a bus as input", i.e. I want to write:Simply writing
((1, 2, 3)) : abstr(7)doesn't work because of the auto-flattening on the left of:here produces a circuit with 3 outputs.How do I write this
adapter?I think I need to pass a bus to
abst(7)likeGives
So, oddly enough, the expression on the right of
:has 9 inputs, not 3?! Or at least that's what the compiler thinks at some state. If I do pass it 9 inputs, the SVG diagram also look weird. It seems the "extra" inputs don't even reachabstr(7)(si.bus(3)), even though the Faust compiler wanted them!Is this a bug in Faust, or am I missing something?
Ok, I figured that part out, it's because of how
ba.selectoris implemented with cuts, so I need<:not:.I guess I need to see if I can abstract this process now... to an
adapterabstraction.And the automated glue looks like this:
Produces the same diagram. Of course, one needs to size the bus for the abstraction, so that number needs to be an argument to
busAdapter. And, of course, something likeprocess = (1, 2, 3) : ok;also works now. I guess answered my own question.Beta Was this translation helpful? Give feedback.
All reactions