code-reviews

Avichal 2018-07-28T09:30:02.000023Z

@seancorfield Thanks for the answer. I have a beginner question. I use the filter first pattern all the time. Sometimes I think if there a function in clojure that does something like “filter-and-return-first-element” ? Is it good idea to make utility function that does something like that and use it or should I always write (first (filter ...) every time?

seancorfield 2018-07-28T16:24:00.000095Z

@avichalp I would just use (first (filter ...)). The only times it might matter are: if you filtering predicate is extremely expensive to run or either the predicate or the sequence being realized have side effects. In those situations you might want more control of the sequence and the filtering operation (and you'd certainly be out of "beginner" territory at that point).

Avichal 2018-07-28T20:19:28.000066Z

Make sense. Thanks for answering.