1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-07 22:22:29 +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

@@ -10,7 +10,7 @@ import "github.com/duke-git/lancet/v2/lancetconstraints"
// LinearSearch return the index of target in slice base on equal function.
// If not found return -1
// Play: Todo
// Play: https://go.dev/play/p/IsS7rgn5s3x
func LinearSearch[T any](slice []T, target T, equal func(a, b T) bool) int {
for i, v := range slice {
if equal(v, target) {