我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Go是否具有标准的功能原语?

Does the standard 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.

近期文章

  • 您如何在项目的模块内部构造用于测试的导入?
  • 在Go中使用http包时如何检索最终的URL目标?
  • 去数组的方法
  • Jmoiron SQLX Golang通用接口
  • 戈兰超范围界面{}
  • 异常期间在golang中运行测试用例
  • GO zip.NewWriter()创建空的zip档案
  • 获取Golang中Stripe所有计划的数组
  • 如何在Go中获取文件的排他锁
  • Google图表查询语言如何工作?
  • 从网址转到lang解析JSON
  • 我可以创建只能与defer一起使用的函数吗?
  • 带条件语句(if)问题的范围
  • 在哪里保留Web应用程序的私钥和凭据?
  • 如何将切片[] interface {}连接到字符串中?
  • 去打印日期到控制台
  • 自定义MarshalJSON()永远不会在Go中被调用
  • 从具有动态循环的通道读取goroutine,获取waitgroup在返回上一个之前已被重用
  • Golang中的无限for循环[重复]
  • glog标志重新定义错误

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华