flowsamples 0.29.1

A set of sample 'flow' programs
flow = "router"

[[process]]
alias = "readline"
source = "lib://flowruntime/stdio/readline"

[[process]]
alias = "to_json"
source = "lib://flowstdlib/fmt/to_json"

[[connection]]
from = "readline"
to = "to_json"

[[process]]
alias = "accumulate_triples"
source = "lib://flowstdlib/data/accumulate"
input.partial = { once = [] }
input.chunk_size = { always = 3 }

# read in each segment line one at a time to accumulator
[[connection]]
from = "to_json"
to = "accumulate_triples/values"

# Loop back the partial arrays
[[connection]]
from = "accumulate_triples/partial"
to = "accumulate_triples/partial"

# Track top path to 'A' points
[[process]]
alias = "A_tracker"
source = "path_tracker"
input.forward_route = { once = "" }
input.forward_distance = { once = 0 }
input.other_route = { once = "" }
input.other_distance = { once = 0 }
input.forward_string = { always = "A" }
input.cross_string = { always = "BC" }

[[connection]] # A - top distance
from = "accumulate_triples/chunk/0"
to = "A_tracker/forward"

[[connection]] # B - bottom distance
from = "accumulate_triples/chunk/1"
to = "A_tracker/other"

[[connection]] # C - cross-over distance
from = "accumulate_triples/chunk/2"
to = "A_tracker/cross"

# Track top path to 'B' points
[[process]]
alias = "B_tracker"
source = "path_tracker"
input.forward_route = { once = "" }
input.forward_distance = { once = 0 }
input.forward_string = { always = "B" }
input.cross_string = { always = "C" }
input.other = { always = 0 }

[[connection]] # B - bottom distance
from = "accumulate_triples/chunk/1"
to = "B_tracker/forward"

[[connection]] # C - cross-over distance
from = "accumulate_triples/chunk/2"
to = "B_tracker/cross"

[[connection]]
from = "A_tracker/route"
to = "A_tracker/forward_route"

[[connection]]
from = "B_tracker/route"
to = "B_tracker/forward_route"

[[connection]]
from = "A_tracker/distance"
to = "A_tracker/forward_distance"

[[connection]]
from = "B_tracker/distance"
to = "B_tracker/forward_distance"

[[connection]]
from = "A_tracker/route"
to = "B_tracker/other_route"

[[connection]]
from = "B_tracker/route"
to = "A_tracker/other_route"

[[connection]]
from = "A_tracker/distance"
to = "B_tracker/other_distance"

[[connection]]
from = "B_tracker/distance"
to = "A_tracker/other_distance"

######## Print out the shortest route and it's length to each point 'A' - and the last one is the destination

[[process]]
alias = "print"
source = "lib://flowruntime/stdio/stdout"

#[[process]]
#alias = "index"
#source = "lib://flowstdlib/control/index"
#input.previous_value = { once = "" }
#input.select_index = { always = -1 }
#input.index = { once = -1 }

#loopback
#[[connection]]
#from = "index/previous_value"
#to = "index/previous_value"

#loopback
#[[connection]]
#from = "index/index"
#to = "index/index"


[[connection]]
from = "A_tracker/route"
#to = "index/value"
#
#[[connection]]
#from = "index/selected_value"
to = "print"

[[connection]]
from = "A_tracker/distance"
to = "print"