Filter a slice into a new backing array
Foundation · fluency · 15 min · runtime go
Brief
Implement Filter[T any](in []T, keep func(T) bool) []T that returns a new slice, and explain why reusing the input backing array can surprise callers.
3 progressive hints are available in the editor.
Public checks
- filters values — expected:
matching values