Example, I eval this in the scratch buffer (with lexical-binding set true):
(read (let ((str "TEST")
(pos 0)
(prev nil))
(lambda (ch)
(cond
(ch (push ch prev))
(prev (pop prev))
((< pos (length str))
(prog1 (aref str pos)
(setq pos (1+ pos))))))))
According to the docs [1] an input stream can be a function. I would expect the above to return the symbol TEST, but instead I get an error ("end of file during parsing").
[1] http://www.gnu.org/software/emacs/manual/html_node/elisp/Input-Streams.html#Input-Streams