开发者

Does Go have the standard functional primitives?

开发者 https://www.devze.com 2023-02-12 12:08 出处:网络
Does the stan开发者_高级运维dard library (or a popular agreed-upon library) let me map, filter, fold etc. over slices/maps?No. Go\'s type system doesn\'t cater for the usual form of these primitives b

Does the stan开发者_高级运维dard library (or a popular agreed-upon library) let me map, filter, fold etc. over slices/maps?


No. Go's type system doesn't cater for the usual form of these primitives because it lacks generics.

See also this thread on golang-nuts.


While Go does not have these primitives, it should be pointed out that the standard Go abstraction of a goroutine that you talk to through a channel will trivially give you entirely equivalent functionality in an asynchronous function.

0

精彩评论

暂无评论...
验证码 换一张
取 消