numiter

package
v0.0.0-...-7e023e1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ErrBadGrid = lerr.Str("args must be multiple of 3")

Variables

This section is empty.

Functions

func Grid

func Grid[T Number](args ...T) list.Wrapper[[]T]

func IntGrid

func IntGrid[T Number](args ...T) list.Wrapper[[]T]

Types

type Number

type Number interface {
	constraints.Float | constraints.Integer
}

Number is any float or integer (signed or unsigned).

type Range

type Range[T Number] struct {
	Start, End, Step T
}

Range with a Start, End and Step. End is exclusive.

func Include

func Include[T Number](start, end, step T) *Range[T]

Include creates a new range making sure that end is included but that it is the last value in the range.

func IntRange

func IntRange[T Number](end T) *Range[T]

IntRange creates a range from 0 to end with a step of 1.

func NewRange

func NewRange[T Number](start, end, step T) *Range[T]

NewRange creates a range from start, end and step.

func (*Range[T]) AtIdx

func (r *Range[T]) AtIdx(idx int) T

AtIdx returns the value at the given step index. This fulfills a portion of the list.List interface.

func (*Range[T]) Len

func (r *Range[T]) Len() int

Len returns the number of steps from start to end. This fulfills a portion of the list.List interface.

func (*Range[T]) Wrap

func (r *Range[T]) Wrap() list.Wrapper[T]

Jump to

Keyboard shortcuts

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