2

GitHub - koss-null/lambda at 0.3.0

 1 year ago
source link: https://github.com/koss-null/lambda/tree/0.3.0
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Lambda

Lambda gopher picture

Is a library to provide map, reduce and filter operations on slices in one pipeline. The slice can be set by generating function. Also the parallel execution is supported. It's strongly expected all function arguments to be clear functions (functions with no side effects).

###Basic example:

res := pipe.Slice(a).
	Map(func(x int) int { return x * x }).
	Map(func(x int) int { return x + 1 }).
	Filter(func(x int) bool { return x > 100 }).
	Filter(func(x int) bool { return x < 1000 }).
	Parallel(12).
	Do()

Usage examples you may found in: pkg/example/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK