Lazy iterator-to-cursor adapter (source code)

= Lazy iterator-to-cursor adapter

Represent a cursor by an underlying consuming <iterator> plus an optional cached head. Without a cache, its abstract sequence is the iterator's sequence; with cached $v$, it is $[v]$ concatenated with the remaining iterator sequence. `current` fetches and caches exactly one value when needed, repeated reads reuse it, and advance discards it. Availability testing need not fetch a value, and construction need not query the input. This avoids forcing a future stream element that the client may never request.