Re: Proposed solution to the "predetermined states" problem
Wolfgang Corcoran-Mathe 23 May 2026 16:28 UTC
On 2026-05-22 20:47 -0400, John Cowan wrote:
> Make-constant-port is trivial in R6RS:
>
> (define (make-constant-port n)
> (make-custom-binary-input-port
> (lambda (bvec start count)
> #| loop to fill part of bvec |#) #f #f #f)))
Thanks. I had, in fact, completely forgotten about R6RS custom
ports until now. I'll try to contribute a portable R6RS sample
implementation with the next draft.
You're right that the solution I proposed would give you only 255
predetermined states, one for each non-zero constant binary port.
In practice, I doubt anyone will need that many states. (Remember,
this is *only* relevant if you can't / won't save port states to
disk. In the absence of that restriction, you can have as many saved
states as your storage will allow.) Still, it's an ugly fact that
makes the constant-port approach look a bit hacky.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>