package
0.5.1
Repository: https://github.com/awalterschulze/goderive.git
Documentation: pkg.go.dev

# README

The deriveApply function only applies the single argument and return a function which requires filling in the other arguments.

This is an alternative to over using curry and flip.

Given the following input:

package apply

import (
	"strings"
)

func splitThreeBySeps(s string) ([]string, []string) {
	splitThree := deriveApply(strings.SplitN, 3)

	commaSplit := splitThree(s, ",")
	colonSplit := splitThree(s, ":")

	return commaSplit, colonSplit
}

goderive will generate the following code:

// Code generated by goderive DO NOT EDIT.

package apply

// deriveApply applies the second argument to a given function's last argument and returns a function which which takes the rest of the parameters as input and finally returns the original input function's results.
func deriveApply(f func(s string, sep string, n int) []string, n int) func(s string, sep string) []string {
	return func(s string, sep string) []string {
		return f(s, sep, n)
	}
}