util

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compose

func Compose[T any](f, g func(s T) T) func(s T) T

f after g

func ComposeAll

func ComposeAll[T any](fs []func(s T) T) func(s T) T

g after f in order of fs

func Partial1

func Partial1[T1, T2, T3 any](f func(T1, T2) T3, s1 T1) func(T2) T3

Takes a function of two arguments and turns it into a function with one argument with the first argument bound. This is useful replacement for a Class with instance variables in OOP.

func Partial2

func Partial2[T1, T2, T3, T4 any](f func(T1, T2, T3) T4, s1 T1) func(T2, T3) T4

Takes a function of three arguments and turns it into a function with two arguments with the first argument bound. This is useful replacement for a Class with instance variables in OOP. TODO I wonder if there is a way to make the function variadic and still preserve generic type safety? I don't think so because type parameters cannot be variadic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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