Ports vs generators Lassi Kortela (07 Oct 2019 15:05 UTC)
Re: Ports vs generators John Cowan (07 Oct 2019 15:09 UTC)
Re: Ports vs generators Lassi Kortela (07 Oct 2019 15:57 UTC)
Re: Ports vs generators Linus Björnstam (08 Oct 2019 20:07 UTC)

Ports vs generators Lassi Kortela 07 Oct 2019 15:05 UTC

The port-transduce procedure doesn't seem to have anything port-specific
in the interface or implementation, though it is clearly useful with
ports. The reader can be any closure that yields some objects and then
#!eof.

The reader abstraction is almost identical to the generator abstraction
in SRFI 158 (Generators and Accumulators). The only difference is that
the reader takes a port argument whereas a generator takes no arguments.

Since current-input-port can be locally bound with 'parameterize' to
change which port one is reading from, would it make sense to turn this
into a more generic generator procedure? The R7RS standard read,
read-char, read-line and read-u8 procedures are already usable as
generators.