1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
= "sequence"
= "sequence.md"
# The number the sequence should start at
[[]]
= "start"
= "number"
# limit of the sequence - inclusive
[[]]
= "limit"
= "number"
# 'step' is the amount to add each time
[[]]
= "step"
= "number"
# The sequence of numbers we will generate
[[]]
= "number"
= "number"
# the last value is output when the sequence ends (may not be == limit if step is not 1)
[[]]
= "last"
= "number"
# compare_switch will pass all numbers that are less than the limit on the "right-lte" output
[[]]
= "lib://flowstdlib/control/compare_switch"
# For the first time around, pass the start number of the sequence into "compare_switch"
[[]]
= "input/start"
= "compare_switch/right"
= "first"
[[]]
= "input/limit"
= "compare_switch/left"
= "limit"
# connect the /right-lte output of compare_switch to the output of this process - the sequence of numbers being generated
[[]]
= "compare_switch/right-lte"
= "output/number"
# while the sequence is running - loopback the left value (limit) to compare against next time
[[]]
= "compare_switch/left-gt"
= "compare_switch/left"
= "feedback-limit"
# An add process to add one to the last output of the sequence each time, up to the penultimate one
[[]]
= "lib://flowstdlib/math/add"
[[]]
= "input/step"
= "add/i2"
= "step"
# Take generated number of the sequence and pass it to 'add' to add one to it for the next number in the sequence
[[]]
= "compare_switch/right"
= "add/i1"
= "previous"
# a tap process that controls the flow of the 'next' value from 'add' to 'compare_switch' at the end of sequence
[[]]
= "next-tap"
= "lib://flowstdlib/control/tap"
# After the first iteration, each time take the sum from the adder (i.e. possibly the next number in the sequence)
# and pass it into the compare_switch function to pass it through) if it's less than the limit
[[]]
= "add"
= "next-tap/data"
[[]]
= "not-last/lt"
= "next-tap/control"
[[]]
= "next-tap"
= "compare_switch/right"
= "next"
# a tap process that controls the feedback of the 'step' value to 'add'
[[]]
= "step-tap"
= "lib://flowstdlib/control/tap"
# pass the 'step' value to the tap for the loopback
[[]]
= "add/i2"
= "step-tap/data"
= "step"
# feedback the step, if it's not the last iteration
[[]]
= "step-tap"
= "add/i2"
= "feedback-step"
# a comparer to see if this is the last iteration
[[]]
= "not-last"
= "lib://flowstdlib/math/compare"
# pass the limit to the comparer each time
[[]]
= "compare_switch/left"
= "not-last/right"
= "limit"
# pass the previous value generated to the comparer each time
[[]]
= "compare_switch/right"
= "not-last/left"
= "previous"
# pass the result of the comparison to the tap that allows the value to pass or disapear on the last iteration
[[]]
= "not-last/lt"
= "step-tap/control"
= "not-last"
# When compare_switch determines the next value is too large (greater-than-or-equal to the limit) then
# the flow will end, output that value - whose presence indicates it's the end of the sequence
[[]]
= "compare_switch/right-gte"
= "output/last"