seq

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 3 Imported by: 0

README

Seq

Go Reference Go Report Card Coverage Status

Purpose

Library that provides to create a sequence of something

Usage

Example:

package main

import (
    "fmt"

    "github.com/akramarenkov/seq"
)

func main() {
    fmt.Println(seq.Linear(1, 8, 3))
    // Output:
    // [1 4 7 8]
}

Documentation

Overview

Library that provides to create a sequence of something.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Linear added in v0.3.0

func Linear[Type constraints.Integer](begin, end Type, steps ...Type) []Type

Creates a slice of a linear sequence of integers from begin to end inclusive with the specified step.

If begin is greater than end, the returned sequence will be decreasing, otherwise it will be increasing.

If the step is not specified, a step of one will be used. If multiple steps are specified, the first one will be used.

If a zero or negative step is specified, the function will panic.

Example
package main

import (
	"fmt"

	"github.com/akramarenkov/seq"
)

func main() {
	fmt.Println(seq.Linear(1, 8, 3))
}
Output:

[1 4 7 8]

Types

This section is empty.

Jump to

Keyboard shortcuts

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