github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/slice/conv/api.go (about)

     1  // Package conv provides slice converation helpers
     2  package conv
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/slice"
     6  )
     7  
     8  // AndReduce - conv.AndReduce converts elements and merge them into one
     9  func AndReduce[FS ~[]From, From, To any](elements FS, converter func(From) (To, error), merge func(To, To) To) (To, error) {
    10  	return slice.ConvAndReduce(elements, converter, merge)
    11  }