Skip to content

Method chain functionality

Latest
Compare
Choose a tag to compare
@logic-building logic-building released this 24 Mar 22:39
· 11 commits to master since this release
ddc2c53

Method chain functionality for Basic type as well as struct -
Map, Filter, Sort, Distinct, Reverse, DropWhile, TakeWhile, Remove

Example:

// Use MakeIntSlicePtr for pointer version
r := fp.MakeIntSlice([]int{3, 2, 1}...).
        Filter(odd).
        Map(square).
        Sort()
fmt.Println(r) // [1 9]

func odd (num int) bool {
        return num % 2 != 0
}
func square(num int) int {
        return num * num
}