All Projects → deckarep → Golang Set

deckarep / Golang Set

Licence: other
A simple set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Golang Set

concurrent-resource
A header-only C++ library that allows easily creating thread-safe, concurrency friendly resources.
Stars: ✭ 17 (-99.22%)
Mutual labels:  threadsafe, concurrency
treap
A thread-safe, persistent Treap (tree + heap) for ordered key-value mapping and priority sorting.
Stars: ✭ 23 (-98.94%)
Mutual labels:  threadsafe, concurrency
Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Stars: ✭ 125 (-94.23%)
Mutual labels:  datastructures, set
Spring Boot Data Aggregator
基于注解实现并行地依赖注入(数据聚合),可以看做 Spring Async 注解的升级版
Stars: ✭ 142 (-93.45%)
Mutual labels:  concurrency
Tickthreading
[not yet functional] Multi-threaded minecraft. Performance over correctness. What could go wrong?
Stars: ✭ 141 (-93.5%)
Mutual labels:  concurrency
Competitive Programming
VastoLorde95's solutions to 2000+ competitive programming problems from various online judges
Stars: ✭ 147 (-93.22%)
Mutual labels:  datastructures
Brightfutures
Write great asynchronous code in Swift using futures and promises
Stars: ✭ 1,890 (-12.82%)
Mutual labels:  concurrency
Advanced Http4s
🌈 Code samples of advanced features of Http4s in combination with some features of Fs2 not often seen.
Stars: ✭ 136 (-93.73%)
Mutual labels:  concurrency
Javainterview
最全的Java技术知识点,以及Java源码分析。为开源贡献自己的一份力。
Stars: ✭ 154 (-92.9%)
Mutual labels:  datastructures
Asyncninja
A complete set of primitives for concurrency and reactive programming on Swift
Stars: ✭ 146 (-93.27%)
Mutual labels:  concurrency
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (-93.36%)
Mutual labels:  concurrency
Setreplace
Wolfram Language Package for exploring Set and Hypergraph Substitution Systems
Stars: ✭ 142 (-93.45%)
Mutual labels:  set
Umbrella
"A collection of functional programming libraries that can be composed together. Unlike a framework, thi.ng is a suite of instruments and you (the user) must be the composer of. Geared towards versatility, not any specific type of music." — @loganpowell via Twitter
Stars: ✭ 2,186 (+0.83%)
Mutual labels:  datastructures
Interviews
A list of fancy questions I've been asked during the interviews I had. Some of them I ask when interviewing people.
Stars: ✭ 140 (-93.54%)
Mutual labels:  concurrency
Crawler
An easy to use, powerful crawler implemented in PHP. Can execute Javascript.
Stars: ✭ 2,055 (-5.21%)
Mutual labels:  concurrency
Async Io
Concurrent wrappers for native Ruby IO & Sockets.
Stars: ✭ 138 (-93.63%)
Mutual labels:  concurrency
Ignareo Isml Auto Voter
Ignareo the Carillon, a web spider template of ultimate concurrency built for leprechauns. Carillons as the best web spiders; Long live the golden years of leprechauns!
Stars: ✭ 154 (-92.9%)
Mutual labels:  concurrency
Compas
Core packages of the COMPAS framework.
Stars: ✭ 146 (-93.27%)
Mutual labels:  datastructures
Recipe
RECIPE : high-performance, concurrent indexes for persistent memory (SOSP 2019)
Stars: ✭ 145 (-93.31%)
Mutual labels:  concurrency
Vue Concurrency
A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.
Stars: ✭ 147 (-93.22%)
Mutual labels:  concurrency

Build Status Go Report Card GoDoc

golang-set

The missing set collection for the Go language. Until Go has sets built-in...use this.

Coming from Python one of the things I miss is the superbly wonderful set collection. This is my attempt to mimic the primary features of the set from Python. You can of course argue that there is no need for a set in Go, otherwise the creators would have added one to the standard library. To those I say simply ignore this repository and carry-on and to the rest that find this useful please contribute in helping me make it better by:

  • Helping to make more idiomatic improvements to the code.
  • Helping to increase the performance of it. (So far, no attempt has been made, but since it uses a map internally, I expect it to be mostly performant.)
  • Helping to make the unit-tests more robust and kick-ass.
  • Helping to fill in the documentation.
  • Simply offering feedback and suggestions. (Positive, constructive feedback is appreciated.)

I have to give some credit for helping seed the idea with this post on stackoverflow.

Update - as of 3/9/2014, you can use a compile-time generic version of this package in the gen framework. This framework allows you to use the golang-set in a completely generic and type-safe way by allowing you to generate a supporting .go file based on your custom types.

Features (as of 9/22/2014)

Features (as of 9/15/2014)

Features (as of 4/22/2014)

  • One common interface to both implementations
  • Two set implementations to choose from
    • a thread-safe implementation designed for concurrent use
    • a non-thread-safe implementation designed for performance
  • 75 benchmarks for both implementations
  • 35 unit tests for both implementations
  • 14 concurrent tests for the thread-safe implementation

Please see the unit test file for additional usage examples. The Python set documentation will also do a better job than I can of explaining how a set typically works. Please keep in mind however that the Python set is a built-in type and supports additional features and syntax that make it awesome.

Examples but not exhaustive:

requiredClasses := mapset.NewSet()
requiredClasses.Add("Cooking")
requiredClasses.Add("English")
requiredClasses.Add("Math")
requiredClasses.Add("Biology")

scienceSlice := []interface{}{"Biology", "Chemistry"}
scienceClasses := mapset.NewSetFromSlice(scienceSlice)

electiveClasses := mapset.NewSet()
electiveClasses.Add("Welding")
electiveClasses.Add("Music")
electiveClasses.Add("Automotive")

bonusClasses := mapset.NewSet()
bonusClasses.Add("Go Programming")
bonusClasses.Add("Python Programming")

//Show me all the available classes I can take
allClasses := requiredClasses.Union(scienceClasses).Union(electiveClasses).Union(bonusClasses)
fmt.Println(allClasses) //Set{Cooking, English, Math, Chemistry, Welding, Biology, Music, Automotive, Go Programming, Python Programming}


//Is cooking considered a science class?
fmt.Println(scienceClasses.Contains("Cooking")) //false

//Show me all classes that are not science classes, since I hate science.
fmt.Println(allClasses.Difference(scienceClasses)) //Set{Music, Automotive, Go Programming, Python Programming, Cooking, English, Math, Welding}

//Which science classes are also required classes?
fmt.Println(scienceClasses.Intersect(requiredClasses)) //Set{Biology}

//How many bonus classes do you offer?
fmt.Println(bonusClasses.Cardinality()) //2

//Do you have the following classes? Welding, Automotive and English?
fmt.Println(allClasses.IsSuperset(mapset.NewSetFromSlice([]interface{}{"Welding", "Automotive", "English"}))) //true

Thanks!

-Ralph

Bitdeli Badge

Analytics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].