ggx

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: 0BSD Imports: 3 Imported by: 2

README

ggx

GlazedGnu's experiments is a compilation of minimalistic general purpose functions which serve as an extension to the Go standard library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func First

func First[T any](v T, _ ...any) T

First returns the first argument.

func OrFn

func OrFn[T comparable](fn ...func() T) (out T, ok bool)

OrFn returns the first non-zero value from listed factory arguments.

func OrFnSeq added in v0.2.0

func OrFnSeq[T comparable](seq iter.Seq[func() T]) (out T, ok bool)

OrFnSeq returns the first non-zero value from listed factory arguments.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to the given value.

func SliceHeadOrFn added in v0.2.0

func SliceHeadOrFn[T comparable](s []T, fn func() T) (out T)

SliceHeadOrFn returns the head of the given slice if available and calls fn otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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