Re:Go 1.23 Released
by sakjur on Tuesday August 13, 2024 @05:34PM
(#41240100)
They’re useful because they let you pass a slice or map to something built to handle the new func(func (…) bool) style iterators.
If I create a IterateOver(fn func(func (K, V any) bool)) function, you cannot pass a slice since that doesn’t match fn’s type, but if you wrap it with slices.All it’ll work.
If I create a IterateOver(fn func(func (K, V any) bool)) function, you cannot pass a slice since that doesn’t match fn’s type, but if you wrap it with slices.All it’ll work.