Hacker News new | ask | show | jobs
by jackjeff 3107 days ago
Wouldn’t a filter() achieve the same result?
1 comments

No, filter() still visits everything in the list, it just takes a predicate to decide if that item is added to a new list. some() or every() can be used for early termination though.