rangeit

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rangeit allows to iterate over a range of numbers.

Iterator functions:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count added in v0.7.0

func Count[T constraints.Integer]() itkit.Iterator[T]

Count returns an Iterator yielding numbers starting at 0 and increasing by 1.

func CountFrom added in v0.7.0

func CountFrom[T constraints.Integer](start T) itkit.Iterator[T]

CountFrom returns an Iterator yielding numbers starting at the given value in start and increasing by 1.

func CountStep added in v0.7.0

func CountStep[T constraints.Integer](start, step T) itkit.Iterator[T]

CountStep returns an Iterator yielding numbers starting at the given value in start and increasing by the given value in step.

func Range added in v0.7.0

func Range[T constraints.Signed](stop T) itkit.Iterator[T]

Range returns an iterator yielding [0 .. stop)

func RangeFrom added in v0.7.0

func RangeFrom[T constraints.Signed](start, stop T) itkit.Iterator[T]

RangeFrom returns an iterator yielding [start .. stop)

func RangeStep added in v0.7.0

func RangeStep[T constraints.Signed](start, stop, step T) itkit.Iterator[T]

RangeStep returns an iterator yielding [start .. start+step*n .. stop)

Types

type CountIterator added in v0.7.0

type CountIterator[T constraints.Integer] struct {
	// contains filtered or unexported fields
}

CountIterator represents an iterator which yields numbers starting at a given value and increases by a given value every time Next is called.

func (*CountIterator[T]) Next added in v0.7.0

func (c *CountIterator[T]) Next() bool

func (*CountIterator[T]) Value added in v0.7.0

func (c *CountIterator[T]) Value() T

type RangeIterator added in v0.7.0

type RangeIterator[T constraints.Signed] struct {
	// contains filtered or unexported fields
}

RangeIterator provides an [Iterator] over an immutable sequence of numbers.

func (*RangeIterator[T]) Next added in v0.7.0

func (r *RangeIterator[T]) Next() bool

Next advances the iterator to the first/next item, returning true if successful meaning there is an item available to be fetched with Value and false otherwise.

See [Iterator] for more details.

func (*RangeIterator[T]) Value added in v0.7.0

func (r *RangeIterator[T]) Value() T

Jump to

Keyboard shortcuts

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