redu

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Longest

func Longest[T any](set []T) int

Longest will convert everything to.String and return the length of the longest string in the set.

Example
package main

import (
	"fmt"

	"github.com/rwxrob/bonzai/fn/redu"
)

func main() {

	set := []string{
		"some thing",
		"i'm the longest",
		"here",
	}
	fmt.Println(redu.Longest(set))

}
Output:

15

func Unique

func Unique[T comparable](set []T) []T

Unique removed duplicates.

Example
package main

import (
	"github.com/rwxrob/bonzai/fn/each"
	"github.com/rwxrob/bonzai/fn/redu"
)

func main() {

	set := []string{
		"some thing",
		"some thing",
		"i'm the longest",
		"here",
		"here",
		"here",
	}
	each.Println(redu.Unique(set))

}
Output:

some thing
i'm the longest
here

Types

type Anys added in v0.8.0

type Anys fn.Reducer[any]

type Ints added in v0.8.0

type Ints fn.Reducer[int]

type Strings added in v0.8.0

type Strings fn.Reducer[string]

Jump to

Keyboard shortcuts

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