Generic stream processors written in Go
This is a collection of generic, reusable, channel based stream processors that perform various operations on channels and their values. It's inspired by component based programming and ranges popularised by the D language. Each operation is designed to be concurrent and if possible will execute in parallel. This is kind of an experiment to see how far I can leverage this. I've no idea if this is even useful.
package main
import (
"os"
)
func join(a, b string) string {
return a + " " + b
}
func main() {
text := "Lorem adipiscing elit ipsum sed neque dolor non libero sit consequat magna amet placerat bibendum"
FromString(text, " ").
Stride(3).
Take(2).
Reduce(join).
WriteTo(os.Stdout)
// Output: Lorem ipsum
}