Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManyMerger ¶
type ManyMerger func(as, bs []interface{}) ([]interface{}, error)
ManyMerger is like merge but for values from two slices which need to be merged.
func Cons ¶
func Cons() ManyMerger
Cons merges by appending values togeter. For example, the merger of []string{"a", "b"} and []string{"c", "d"} is the slice []string{"a", "b", "c", "d"}
func Fold ¶
func Fold(f Merger) ManyMerger
Fold merges by using function f to merge values down to a single value. The retruned slice will either be nil or have a length of one. First value pairs from as are folded into a single value, call it a. Then value pairs from bs are folded into a single value, call it b. Then a and b are merged into a single result.
Example:
as = [ 1 2 3 ] bs = [ 7 8 9 ] f = + a = f(f(1, 2), 3) = f(3, 3) = 6 b = f(f(7, 8), 9) = f(15, 9) = 24 result = f(a, b) = 30
Click to show internal directories.
Click to hide internal directories.