ensure-reduced returns its argument as a Reduced object, wrapping an ordinary value but preserving a value that is already reduced. This makes reduced signaling composable when reducers or transducers may receive either form. section 7.3
Use it alongside the related Reduced controls:
- reduced always wraps its argument; ensure-reduced avoids a second wrapper. section 7.3
- reduced? tests whether a value is reduced, while unreduced or deref retrieves its contained value. section 7.3
- A Reduced value signals reduce to stop processing remaining input, enabling premature termination. section 7.3
Preserving an existing signal
Given an already reduced value r, (ensure-reduced r) keeps r reduced rather than wrapping it again. Given an ordinary value such as "done", (ensure-reduced "done") produces a Reduced value whose contents can be inspected with @. section 7.3
