Skip to content

A small collection of useful generic Golang collections

License

Notifications You must be signed in to change notification settings

olabiniV2/gogcoll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang Generic Collections - gogcoll

Build Status Coverage Status Go Reference Go Report Card

A small collection of useful generic Golang collections. There are two helpful collection interfaces. Iterator[T] is an eager iteration primitive, while Seq[T] is lazy. The full Seq[T] comes with some helpful methods, which implies a lot of extra burden to implement. The smallest possible sequence is defined by BasicSeq[T] which is quite easy to implement. You can use FullSeqFrom() to turn any BasicSeq[T] into a Seq[T].

The package implements a completely new data type, a Set[T]. This is derived from the built in dictionaries in Golang. On top of that, many helper types have been added to simplify working with different data types. For maps, the most important are Keys[K, V] and Values[K, V]. For slices, Slice[T] exists.

Finally, the package also supplies various function signatures to clarify what types are used in various places. These are divided up in three categories - procedures, functions and predicates. A procedure is a function that doesn't return a value. A function returns a value and a predicate is a function that returns a boolean. These types are Proc1, Proc2, and Proc3, FixedFunction, Func1, Func2, Func3 and FuncN, and Predicate, Predicate2 and Predicate3.

About

A small collection of useful generic Golang collections

Resources

License

Stars

Watchers

Forks

Packages

No packages published