For the transducer version, I don’t think you need to keep track of the previous value (fval). The decision to start a new partition group depends only on the current item. Here’s my version. (Warning: virtually untested.) I assume that the first item goes into the first partition no matter what so you don’t even need to call f. Maybe you should for side-effects?
(defn partition-when
"Applies f to each value in coll, starting a new partition each time f returns a
true value. Returns a lazy seq of partitions. Returns a stateful
transducer when no collection is provided."
{:added "1.X"
:static true}
([f]
(fn [rf]
(let [a (java.util.ArrayList.)]