nomad-software / stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stream

Generic stream processors written in Go


Description

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.

Example

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
}

Documentation

https://pkg.go.dev/github.com/nomad-software/stream

About

License:MIT License


Languages

Language:Go 100.0%