ensuringArgumentIsVarOrStream

Ensures the argument at index is either unbound (returning null) or a $stream(...) term identifying an already-open channel (returning it), as required by the single argument of current_input/1/current_output/1.

Throws

(stream) if it is a well-formed stream term for which no channel is currently open.

(stream_or_alias) if it is bound to something other than a $stream(...) term.