guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nonblocking get-bytevector-n bug?


From: Marko Rauhamaa
Subject: Re: Nonblocking get-bytevector-n bug?
Date: Mon, 07 Dec 2015 14:52:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Amirouche Boubekki <address@hidden>:

> I can't make work `get-bytevector-some` with my code. It only returns
> a single cell bv.

Run my test code as follows:

   cat | guile test.scm

That way, you get the natural pipe semantics for stdin.

> Instead I use `char-ready?`. Here is the definition of `recv-some`:
>
> ```
> (define (recv-some port)
>   (let next ((out '()))
>     (if (char-ready? port)
>       (let ((byte (get-u8 port)))
>         (if (eof-object? byte)
>             (u8-list->bytevector (reverse out))
>             (next (cons byte out))))
>       (u8-list->bytevector (reverse out)))))
> ```

Your code is ok but very micromanagerial. I really would like the
bytevector variants to do I/O in bulk.


Marko



reply via email to

[Prev in Thread] Current Thread [Next in Thread]