This would definitely work if S didn't produce its output from X. Given that it does, I don't see how the strategy above can implement
f(x[0], x[0])
f(x[0], x[1])
f(x[1], x[2])
f(x[1], x[3])
f(x[2], x[4])
f(x[2], x[5])
...
with a single pass over x.Thanks for the explanation. I see now that X is read at different rates from different consumers. You need to have a buffer that might grows infinitely in the general case (I remember reading about CSDF, cyclo-static dataflow graphs, where the buffer size is (can be?) bounded).
I don't understand how the issue would appear in that case. Buffering one value seems to be sufficient to upsample S to the "clock" of X, ie. project S to the instants where X is defined (flow Z below) while filling missing instants with the previously known value:
That would look as follows in Signal: C is the clock which alternates between false and true ($ refers to the last value), "X when C" is filtering, "E cell C" is projection of values of E to the instant of C, defaulting to the previous known value at logical instants where E is not present but C is true.The clock calculus in Signal (etc.) is way to assess if a program can be generated to use constant (static) memory allocation and constant time. There are programs which fail to do so, but you then need to refine them to add explicit operations (https://www.irisa.fr/prive/talpin/papers/date08.pdf)