[plt-scheme] copy-port and custom-port
At Wed, 23 Jul 2008 12:01:20 -0700, YC wrote:
> On Wed, Jul 23, 2008 at 11:32 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
> > At Wed, 23 Jul 2008 11:20:36 -0700, YC wrote:
> > > ...
> > > len)))))
> >
> > You should return `(bytes-length bytes-in)' here, not `len'.
> >
> >
> That solves it! Thanks!!
>
> I thought I allocated `bytes-in` & `peeked` based on the `len`, so `len` can
> be returned - apparently that's not the case? What did I miss?
You computed `len' based on the given byte string, but that byte
string's length might be larger than the number of bytes available in
the port. The result should be the number of bytes actually read or
peeked.
Matthew