When you have two inputs that are needed for the next piece of functionality, you need a JoinedPipe
.
JoinedPipe
s produce a Tuple
of two inputs.
Note: If you are using JoinedPipe
you need to call Verify()
with the join.
var input1 = new InputPipe<long>("value1");
var input2 = new InputPipe<long>("value2");
var join = input1.JoinTo(input2);
will produce:
Sometimes you will want a special type of Join which takes one thing and applies it to each element of a separate list.
For example, if you had:
var apply = "#";
var to = new[] {1, 2};
You can combine them to produce the following output:
var result = "[(#, 1), (#, 2)]";
For reference you can do this manually (although it creates a bad visualization):
prefix.JoinTo(values).Process(t => t.Item2.Select(i => Tuple.Create(t.Item1, i)));
However, if you use the ApplyTo()
method, you will end up with a much better-rendered result.
Sometimes you will want a special type of Join which takes two enumerables of the same element type and concatenates them into a list.
For example, if you had:
var concat = new List<int> {1, 2};
var with = new[] {3, 4};
You can combine them to produce the following output:
var result = "[1, 2, 3, 4]";
For reference you can do this manually (although it creates a bad visualization):
part1.JoinTo(part2).Process(t => t.Item1.Concat(t.Item2).ToList());
However, if you use the ConcatWith()
method, you will end up with a much better-rendered result.
the FunctionPipe
uses the name of the function, but if you pass in a lambda it will format that nicely. For example:
var input = new InputPipe<int>("input");
input.Process(p => p.ToString());
will look like: