flowsamples 0.46.0

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

[[output]]
name = "filename"
type = "string"

[[output]]
name = "size"
# Workaround for https://github.com/andrewdavidmackenzie/flow/issues/747
#type = "array/number"

[[output]]
name = "bounds"
type = "array/array/number"

# Args
[[process]]
alias = "args"
source = "context://args/get"

############# filename
[[connection]]
from = "args/string/1"
to = "output/filename"

############## parse size
[[process]]
alias = "split_size"
source = "lib://flowstdlib/data/ordered_split"
input.separator = { always = "x" }

[[connection]]
from = "args/string/2"
to = "split_size/string"

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

[[connection]]
from = "split_size"
to = "size_to_json"

# Accumulate two size Numbers into array of Numbers
[[process]]
alias = "accumulate_size"
source = "lib://flowstdlib/data/accumulate"
input.chunk_size = { always = 2 }
input.partial = { once =  [] }

[[connection]]
from = "size_to_json"
to = "accumulate_size/values"

# loopback
[[connection]]
from = "accumulate_size/partial"
to = "accumulate_size/partial"

[[connection]]
from = "accumulate_size/chunk"
to = "output/size"

# parse upper left bound
[[process]]
alias = "split_upper_left"
source = "lib://flowstdlib/data/ordered_split"
input.separator ={ always = "," }

[[connection]]
from = "args/string/3"
to = "split_upper_left/string"

[[connection]]
from = "split_upper_left"
to = "upper_left_to_json"

# Convert strings to json (Numbers)
[[process]]
alias = "upper_left_to_json"
source = "lib://flowstdlib/fmt/to_json"

# parse lower right bound
[[process]]
alias = "split_lower_right"
source = "lib://flowstdlib/data/ordered_split"
input.separator ={ always = "," }

[[connection]]
from = "args/string/4"
to = "split_lower_right/string"

# Convert strings to json (Numbers)
[[process]]
alias = "lower_right_to_json"
source = "lib://flowstdlib/fmt/to_json"

[[connection]]
from = "split_lower_right"
to = "lower_right_to_json"


# Accumulate upper_left x and y into a point (array of 2 numbers)
[[process]]
alias = "accumulate_upper_left"
source = "lib://flowstdlib/data/accumulate"
input.chunk_size = { always = 2 }
input.partial = { once = [] }

[[connection]]
from = "upper_left_to_json"
to = "accumulate_upper_left/values"

# loopback
[[connection]]
from = "accumulate_upper_left/partial"
to = "accumulate_upper_left/partial"


# Accumulate lower_right x and y into a point (array of 2 numbers)
[[process]]
alias = "accumulate_lower_right"
source = "lib://flowstdlib/data/accumulate"
input.chunk_size = { always = 2 }
input.partial = { once = [] }

[[connection]]
from = "lower_right_to_json"
to = "accumulate_lower_right/values"

# loopback
[[connection]]
from = "accumulate_lower_right/partial"
to = "accumulate_lower_right/partial"

# Accumulate bounds points into bounds (array/array/number)
[[process]]
alias = "accumulate_bounds"
source = "lib://flowstdlib/data/accumulate"
input.chunk_size = { always = 2 }
input.partial = { once = [] }

# loopback
[[connection]]
from = "accumulate_bounds/partial"
to = "accumulate_bounds/partial"

[[connection]]
from = "accumulate_upper_left/chunk"
to = "accumulate_bounds/values"

[[connection]]
from = "accumulate_lower_right/chunk"
to = "accumulate_bounds/values"

[[connection]]
from = "accumulate_bounds/chunk"
to = "output/bounds"