andrewdavidmackenzie / flow

Exploration of a data-flow programming paradigm
MIT License
25 stars 2 forks source link

Initializers should be applied gradually #1418

Open andrewdavidmackenzie opened 1 year ago

andrewdavidmackenzie commented 1 year ago

When an array is an initializer, currently the entire array is serialized and sent when the initializer is applied.

However, only one element should be sent, and the next one the next time it goes idle etc.

Thus, this example:

flow = "print-sequence"
docs = "DESCRIPTION.md"

[[process]]
alias = "sequence-of-sequences"
source = "lib://flowstdlib/math/sequence"
input.start = { always =  0 }
input.step = { always = 1 }
input.limit = { once = [1, 2, 3] }

[[connection]]
from = "sequence-of-sequences/sequence"
to = "stdout"

# Print the sequence-of-sequences to stdout
[[process]]
source = "context://stdio/stdout"

produces

0
1
2
0
1
2
0
1
2
3

instead of

0
1
0
1
2
0
1
2
3
andrewdavidmackenzie commented 2 months ago

alternatively, set a priority on the initializers input and then TAKE them in the correct order.