Documentation
¶
Overview ¶
package functional contains some simple helper routines to help avoid explicit loops, and provide concise conditionals. This package is experimental. Not in the sense that it's unstable ... just in the sense that I'm not sure how useful it will be. (I found some of these functions useful once ... experience will tell if a pattern emerges there ...)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func If ¶
If accepts a boolean argument and one or two function arguments. If the bool argument is true, then it evaluates the first function, if the bool argument is false AND two function arguments were supplied, then it calls the second function argument.
func Repeat ¶
func Repeat(fct Repeatable, iterations uint) error
Repeat accepts a function argument, and a uint argument. It calls the function argument the number of times indicated by the uint argument, or until the function argument returns a non-nil error, whichever comes first.
func RepeatWhile ¶
func RepeatWhile(fct RepeatableWhile) error
RepeatWhile accepts a function argument, which it calls until the function either returns false, or a non-nil error
Types ¶
type Repeatable ¶
type Repeatable func() error