chickadee » transducers » once

once transducers collector itemprocedure

A procedure that performs a transduction over exactly one item. While this may at first seem odd compared to just performing a set of procedures over a single item, it is useful for testing or composing reusable transducer forms onto a single item rather than over a collection of items.

(import transducers)

(once (compose
        (map add1)
        (map number->string))
      (collect-first)
      1)
;=> "2"