1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

add playground demo

This commit is contained in:
dudaodong
2023-01-09 11:02:41 +08:00
parent 4b9b1d32c5
commit c85d910044
8 changed files with 48 additions and 15 deletions

View File

@@ -47,7 +47,7 @@ func Before(n int, fn any) func(args ...any) []reflect.Value {
type CurryFn[T any] func(...T) T
// New make a curry function for specific value.
// Play: Todo
// Play: https://go.dev/play/p/5HopfDwANKX
func (cf CurryFn[T]) New(val T) func(...T) T {
return func(vals ...T) T {
args := append([]T{val}, vals...)
@@ -56,7 +56,7 @@ func (cf CurryFn[T]) New(val T) func(...T) T {
}
// Compose compose the functions from right to left.
// Play: Todo
// Play: https://go.dev/play/p/KKfugD4PKYF
func Compose[T any](fnList ...func(...T) T) func(...T) T {
return func(args ...T) T {
firstFn := fnList[0]

View File

@@ -3,7 +3,7 @@ package function
import "time"
// Watcher is used for record code excution time
// Play: Todo
// Play: https://go.dev/play/p/l2yrOpCLd1I
type Watcher struct {
startTime int64
stopTime int64