Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 523 Bytes

chapter20 lambda.md

File metadata and controls

27 lines (17 loc) · 523 Bytes

Lambda

作为从Java转Go的开发者,已经习惯Java的Lambda表达式方式。Go 下是否存在如下的实现。

Functional

如下是一种通过匿名函数实现方式,下面是网上找的例子。

func Test(n int, x string) {
    fmt.Println(n, x)
}
func main() {
    myFunc := func(x string) { Test(123, x) }
    myFunc("hello")
}

Stream API

Stream API,我找到如下几种开源实现方式: