You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi @mourner — i think there may be some utility in having a function similar to search but is more efficient for the use case of when we want to simply check if at least 1 result exists such that the first value found in the search that passes the filter function makes it return true. this might only really be useful if the filterFn we're sending does somewhat heavy computation, and i guess it might just make more sense to accept the results and filter outside the hash. i don't know how the search works internally, but if there's any optimizations for an exists function, that'd be awesome!
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion! Perhaps the easiest approach would be to add an optional maxResults parameters to search (similar to how it works in neighbors), and return early when reaching the specified number after this line:
@mourner here's a use-case: test if a polygon is simple--only need one intersection meeting certain criteria to prove otherwise!
Even better than a "maxResults" though might be a generator method... that way caller can determine when to early-exit without having to calculate how many results are needed in advance (which would be especially useful if the output is being piped through another generator method, for example.)
hi @mourner — i think there may be some utility in having a function similar to
search
but is more efficient for the use case of when we want to simply check if at least 1 result exists such that the first value found in the search that passes the filter function makes it return true. this might only really be useful if thefilterFn
we're sending does somewhat heavy computation, and i guess it might just make more sense to accept the results and filter outside the hash. i don't know how the search works internally, but if there's any optimizations for anexists
function, that'd be awesome!The text was updated successfully, but these errors were encountered: