This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chain | |
import ( | |
"fmt" | |
"reflect" | |
) | |
// Chain takes an array of functions, and calls them all, passing the result of the previous call to the next. Any funcs whose last return value is an error have the errors checked and not passed to the next. If an error occurs at any point chain returns with an empty list and the error that happened. | |
// here it is expressed vaguely maths-y which might be clearer. | |
// given a function f[n] which returns a set of values vs: |