gfn
is a Golang library that leverages generics to provide various methods, including common functional programming techniques such as Map
, Reduce
, and Filter
, along with other utilities like Contains
, Keys
, etc. The idea of this library is very simple, it aims to port as many small utilities from other languages to Go
as possible. The implementation is highly influenced byPython
, Ruby
, JavaScript
and Lodash
.
- No
reflect
. - No third-party packages.
- Time complexity of
O(n)
.
- Installation
- Usage
- Type {{ TOC }}
go get github.com/suchen-sci/gfn
import "github.com/suchen-sci/gfn"
/*
byte: alias for uint8
rune: alias for int32
time.Duration: alias for int64
...
*/
type Int interface {
~int | ~int8 | ~int16 | ~int32 | ~int64
}
type Uint interface {
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
type Float interface {
~float32 | ~float64
}
type Complex interface {
~complex64 | ~complex128
}
type Pair[T, U any] struct {
First T
Second U
}
{{ CONTENT }}
Format:
/* @example MyFunc
// your examples here
MyFunc(...)
// output: ...
*/
// MyFunc is ...
func MyFunc(args ...) (return values...) {
// your code here.
}
then run following command to update README.md
(generated from README.tmpl.md
).
make doc
gfn
is under the MIT license. See the LICENSE file for details.