applejag / typ Goto Github PK
View Code? Open in Web Editor NEWGeneric types and functions that are missing from Go, including sets, linked lists, trees, etc.
Home Page: https://pkg.go.dev/gopkg.in/typ.v4
License: MIT License
Generic types and functions that are missing from Go, including sets, linked lists, trees, etc.
Home Page: https://pkg.go.dev/gopkg.in/typ.v4
License: MIT License
Let user specify their own equals operation
Tuple of [T]
and error
Sort slice
Reverse slice
Clear all values in a map. The following is translated by the Go compiler (since v1.11) into an efficient call for clearing the map's internal state (https://go.dev/doc/go1.11#performance-compiler):
for k := range m {
delete(m, k)
}
Number of characters (including sign) that would be printed if the integer was printed.
Take inspiration from container/list
: https://pkg.go.dev/container/list
Take inspiration from sync
: https://pkg.go.dev/sync#Map
It would be handy to have a way to get the # of elements in a map.
Thank you!
Take inspiration from container/ring
: https://pkg.go.dev/container/[email protected]
1 publisher
Many (or no) subscribers
Can probably just copy my code from https://github.com/dinkur/dinkur/blob/259e48139bfc82ed542b61afaf299e893b2add3f/internal/obs/obs.go, that code is sufficient.
Since Go v1.11's compiler optimizations, the following is sufficient (https://go.dev/doc/go1.11#performance-compiler):
return append(slice, make([]T, n)...)
Supply default values if value is zero
Exactly like SQL COALESCE command
Returns a pointer to the value. Useful when working with literals.
Ex:
typ.Ptr(13) // &int{13}
typ.Ptr("hello") // &string{"hello"}
Take inspiration from sync
: https://pkg.go.dev/sync#Pool
The pool package is so tightly nit with the Go GC that it's probably best to just add a wrapper
Possibly use a B-Tree as underlying data structure? Alternatively just use the AVL BST type Can't use tree as I need indexing support
result := typ.Distinct([]byte("aabcdeef"))
fmt.Println(string(result)) // abcdef
Take inspiration from container/heap
: https://pkg.go.dev/container/[email protected]
Read all values from channel until there's no values left in the buffer. I.e. when the select default
statement triggers.
Should have buffer alternative for custom buffer slices.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.