itertools

package
v0.0.0-...-0cf3de4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2016 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForPerm

func ForPerm(n int, callback func(i int) (more bool)) bool

func IterableAsSlice

func IterableAsSlice(it Iterable) (ret []interface{})

func IteratorAsSlice

func IteratorAsSlice(it Iterator) (ret []interface{})

func NewIterator

func NewIterator(it Iterable) (ret *iterator)

Types

type Group

type Group interface {
	Iterator
	Key() interface{}
}

type Iterable

type Iterable interface {
	Iter(func(value interface{}) (more bool))
}

type Iterator

type Iterator interface {
	// Advances to the next value. Returns false if there are no more values.
	// Must be called before the first value.
	Next() bool
	// Returns the current value. Should panic when the iterator is in an
	// invalid state.
	Value() interface{}
	// Ceases iteration prematurely. This should occur implicitly if Next
	// returns false.
	Stop()
}

func GroupBy

func GroupBy(input Iterator, keyFunc func(interface{}) interface{}) Iterator

Group by returns an iterator of iterators over the values of the input iterator that consecutively return the same value when input to the key function. Note that repeated calls to each value of the GroupBy Iterator does not return a new iterator over the values for that key.

func SliceIterator

func SliceIterator(a []interface{}) Iterator

func StringIterator

func StringIterator(a string) Iterator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL