Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/eblume/proto

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/eblume/proto

  • v0.0.0-20121219175714-96b560c0b3d4
  • Source
  • Go
  • Socket score

Version published
Created
Source

proto

proto gives Go operations like Map, Reduce, Filter, De/Multiplex, etc. without sacrificing idiomatic harmony or speed. It also introduces a convenience type for these functions, Proto, which is a stand-in for the empty interface (interface{}), which is used to box values being sent to these operations.

Documentation

Please see documentation.{txt,html} for the automatically generated documentation - or better yet, just run:

godoc github.com/eblume/proto | less

That's probably a better idea since there's a decent chance the documentation might be lagging behind the current code base, since it has to be run manually (at this moment).

You can also take a look at the *_test.go files for an even better look in to how to use Proto. I will make one disclaimer, which is that code written with Proto has some unavoidable boilerplate in the form of casting to/from the Proto type - this boilerplate is annoying but is much less obvious and significant with larger code bases that use Proto-style channels in chains.

Examples

Double every integer in a slice:

inputs := []Proto{0, 1, 2, 3, 4, 5, 6}
sent := Send(inputs)
doubler := func(a Proto) Proto {
    return a.(int) * 2
}
mapped := Map(doubler, sent)
doubled := Gather(mapped)

Double every integer, chained:

doubled := Gather(Map(func(a Proto) Proto {
    return a.(int) * 2
}, Send([]Proto{0, 1, 2, 3, 4, 5, 6})))

License

Please see COPYING for more details on the licensing of this software.

FAQs

Package last updated on 19 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc