mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
881 B
881 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product / ProductBy | product | it/math.go#L70 | it | math |
|
https://go.dev/play/p/AOMCD1Yl5Bc |
|
|
20 |
Multiplies values from a sequence. ProductBy applies a transform then multiplies. Returns 1 for empty sequences.
Examples:
seq := it.RangeFrom(1, 4) // 1,2,3,4
p := it.Product(seq)
// p == 24
nums := it.RangeFrom(2, 3) // 2,3,4
p := it.ProductBy(nums, func(n int) int { return n - 1 })
// (1*2*3) == 6