Skip to main content

Function - Core helpers

This page lists all operations on functions, available in the core package of lo.

Help improve this documentation

This documentation is still new and evolving. If you spot any mistakes, unclear explanations, or missing details, please open an issue.

Your feedback helps us improve!

  • Pre-binds the first argument of a function. Variants support functions taking from 2 up to 6 input parameters.

    add := func(x, y int) int {
    return x + y
    }
    add10 := lo.Partial(add, 10)
    sum := add10(5)
    // 15
    Variant:
    Prototypes:
    func Partial[T1, T2, R any](f func(a T1, b T2) R, arg1 T1) func(T2) R
    func Partial1[T1, T2, R any](f func(T1, T2) R, arg1 T1) func(T2) R
    func Partial2[T1, T2, T3, R any](f func(T1, T2, T3) R, arg1 T1) func(T2, T3) R
    func Partial3[T1, T2, T3, T4, R any](f func(T1, T2, T3, T4) R, arg1 T1) func(T2, T3, T4) R
    func Partial4[T1, T2, T3, T4, T5, R any](f func(T1, T2, T3, T4, T5) R, arg1 T1) func(T2, T3, T4, T5) R
    func Partial5[T1, T2, T3, T4, T5, T6, R any](f func(T1, T2, T3, T4, T5, T6) R, arg1 T1) func(T2, T3, T4, T5, T6) R