function definition and usage rationalized

This commit is contained in:
2024-05-24 06:28:48 +02:00
parent d545a35acf
commit e5f63c3d9d
16 changed files with 342 additions and 251 deletions
+8
View File
@@ -209,3 +209,11 @@ func toInt(value any, description string) (i int, err error) {
}
return
}
func ForAll[T, V any](ts []T, fn func(T) V) []V {
result := make([]V, len(ts))
for i, t := range ts {
result[i] = fn(t)
}
return result
}