weavejester / medley

A lightweight library of useful Clojure functions
Eclipse Public License 1.0
865 stars 66 forks source link

Does find-first belong? #5

Closed ToBeReplaced closed 10 years ago

ToBeReplaced commented 10 years ago

I'm wondering if find-first belongs in this library.

I would argue against its inclusion because it is simple enough for anyone to write and is not any more clear than explicitly typing (first (filter pred coll)). Moreover, the simpler, composable method allows for find-last or remove-first and the like.

Contrast this with the difficulty of writing a performant version of map-keys.

weavejester commented 10 years ago

I'm a touch undecided on find-first as well. However, it's been included in flatland's useful library and the original clojure-contrib library back before Clojure 1.3.0. Not all functions need to be as involved as map-keys to be useful, and I find myself using it often enough that the shortcut is handy.