Skip to content

icwells/simpleset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GoDoc

simpleset

Simple python-style set for string, int, and float64 types.

Copyright 2019 by Shawn Rupp

  1. Description
  2. Installation
  3. Usage

Description

simpleset provides a straightforward set similar to a python set. It supports string, integer, and float64 based sets. It does not support mixed-type sets, so, for example, you cannot add an integer to a string set.

Installation

go get github.com/icwells/simpleset   

Usage

To make a new empty set, either call the appropriate constructor for the type you want the set to hold. To convert a slice of strings, integers, or float64s, pass the slice to ToSet which will return a set of the appropriate type.

letters := []string{"a", "b", "c", "d", "e"}
set := simpleset.NewStringSet()
for _, i := range letters {
	// Can also pass the whole slice to Extend
	set.Add(i)
}

For documentation on additional methods, follow the GoDocs link above.

About

Golang script for python-like sets using primitive data types.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages