Coder Social home page Coder Social logo

go2go-snippets's Introduction

Go2Go Snippets

To better understand the impact of the Go generics proposal, this repository collects a list of solutions to problems that could benefit from generics and links to implementations that run on The go2go Playground. Multiple implementations for the same problem are highly encouraged. Having a variety of solutions to look at and compare will help the community learn about approaches to generics that may and may not be useful.

Pull requests are welcome, both for solutions to the problems below and solutions of new problems! Just modify this file to a link to a go2go example that includes a main method demonstrating correct usage. Maintainers may run format on your submission and modify the link before merging, but we will preserve your original commit in the history.

If you are copying from an online source, please make sure 1) you are able to do so and 2) include a link back to the original material.

If you see an implementation in this list that you have questions about or want to discuss, start a conversation in the issue tracker. Please follow the Go Community Code of Conduct.

Data structures

  • Queue: FIFO access to a list
    • enqueue and dequeue (standard example) (go2go)

Algorithms

  • Min/Max: find smallest/largest element in a collection
    • using a numeric interface (go2go)
  • Reverse: reverse an ordered collection
  • Union/Intersection: perform basic set theory
    • using 'sets' -- maps with empty structs for values (go2go)
  • Transform Collections: apply a function to each element of a collection and return the modified collection.
    • mapping over slices (go2go)
  • Average/Standard Deviation: compute statistical moments of a collection
    • TODO
  • Shortest Path: find shortest path in a graph
    • TODO

Concurrency

  • Channel Join: combine two channels into one
    • async implementation (go2go)
  • Parallel allOf: call a list of functions in parallel, returning a slice of results
    • retrieve response code from parallel HTTP requests (go2go)
  • Parallel oneOf: call a list of functions in parallel, return the first function to finish, cancelling the remainder and not leaking any goroutines.
    • TODO
  • Channel Timeout: read from a channel with a timeout
    • TODO

go2go-snippets's People

Contributors

kalexmills avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.