Function Pipelining Improvements
The following is an example of what we could do with function pipelines.
fn add x y
echo $((x + y))
end
add 2 3 | add 3
Taking some inspiration from the D programming language, 2
and 3
from the first invocation would be x
and y
respectively; whereas in the second invocation, x
would be read from stdin
directly, and y
would be assigned 3
. Parsing rules would depend on the specified type parameters. So, for example, the following could be valid:
fn add x:int y:int
echo $((x + y))
end
echo "1 4" | add