ClojureDocs

导航

命名空间

halt-when

clojure.core

从 1.9 起可用 ()
  • (halt-when pred)
  • (halt-when pred retf)
Returns a transducer that ends transduction when pred returns true
for an input. When retf is supplied it must be a fn of 2 arguments -
it will be passed the (completed) result so far and the input that
triggered the predicate, and its return value (if it does not throw
an exception) will be the return value of the transducer. If retf
is not supplied, the input that triggered the predicate will be
returned. If the predicate never returns true the transduction is
unaffected.