Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 2.37 KB

README.tmpl.md

File metadata and controls

99 lines (73 loc) · 2.37 KB

gfn

Go Report Card Coverage Tests Releases License: MIT

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.

  1. No reflect.
  2. No third-party packages.
  3. Time complexity of O(n).

Documentation

Installation

go get github.com/suchen-sci/gfn

Usage

import "github.com/suchen-sci/gfn"

Type

/*
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 }}

Contributing

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

back to top

License

gfn is under the MIT license. See the LICENSE file for details.

back to top