diff --git a/function/bind.go b/function/bind.go index c192584..ff84390 100644 --- a/function/bind.go +++ b/function/bind.go @@ -26,6 +26,7 @@ func Bind2nd[T1, T2, R any](f func(T1, T2) R, t2 T2) func(T1) R { } } +// SK function (SKI combinator calculus). func SK[T1, T2 any](_ T1, t2 T2) T2 { return t2 } diff --git a/function/function.go b/function/function.go index fc99fd2..e041ac7 100644 --- a/function/function.go +++ b/function/function.go @@ -62,6 +62,7 @@ func First[T1, T2 any](t1 T1, _ T2) T1 { } // Second returns the second out of two input values +// Identical to [SK] func Second[T1, T2 any](_ T1, t2 T2) T2 { return t2 } diff --git a/tuple/tuple.go b/tuple/tuple.go index d43cf88..ec48cf5 100644 --- a/tuple/tuple.go +++ b/tuple/tuple.go @@ -21,10 +21,12 @@ func Of[T1 any](t T1) Tuple1[T1] { return MakeTuple1(t) } +// First returns the first element of a [Tuple2] func First[T1, T2 any](t Tuple2[T1, T2]) T1 { return t.F1 } +// Second returns the second element of a [Tuple2] func Second[T1, T2 any](t Tuple2[T1, T2]) T2 { return t.F2 }