24
Nov
In the previous post about transducers, I did not discuss early termination of reducing functions and transducers. For the examples given in that post, early termination was irrelevant. It is, however, an important and tricky aspect of reducing functions and transducers. Early termination of reducing functions The following reducing function is a variant on the function first and the transducer (take 1), created specially for people with nostalgia for the 80s. (defn highlander-rf "There can be only one" [_ input] (reduced input)) Enter fullscreen mode Exit fullscreen mode Although this function is largely useless in practice, it provides the most…