Re: [EXT] [PATCH] Add 'bytevector-slice'.

2023-01-13 Thread lloda



> On 12 Jan 2023, at 23:27, Ludovic Courtès  wrote:
> 
> lloda  skribis:
> 
>>> On 11 Jan 2023, at 18:37, Thompson, David  wrote:
>>> 
>>> On Wed, Jan 11, 2023 at 12:34 PM Ludovic Courtès  wrote:
 
 What could be convenient though is ‘bytevector-copy’ (no bang), which
 would combine ‘make-bytevector’ + ‘bytevector-copy!’.
>>> 
>>> 'bytevector-copy' already exists, or do you mean some different
>>> implementation of it?
>>> 
>>> - Dave
>> 
>> The current bytevector-copy takes a single argument.
> 
> Right, what I had in mind is one that would take an offset and size; I
> hadn’t realized the name was already taken.
> 
> Thanks,
> Ludo’.

Actually (scheme base) from r7rs already defines (bytevector-copy bytevector 
start end), this is of course r7rs's convention. This is hidden in Guile's 
manual, which only lists the 1-argument version from r6rs.





Re: [EXT] [PATCH] Add 'bytevector-slice'.

2023-01-12 Thread Ludovic Courtès
lloda  skribis:

>> On 11 Jan 2023, at 18:37, Thompson, David  wrote:
>> 
>> On Wed, Jan 11, 2023 at 12:34 PM Ludovic Courtès  wrote:
>>> 
>>> What could be convenient though is ‘bytevector-copy’ (no bang), which
>>> would combine ‘make-bytevector’ + ‘bytevector-copy!’.
>> 
>> 'bytevector-copy' already exists, or do you mean some different
>> implementation of it?
>> 
>> - Dave
>
> The current bytevector-copy takes a single argument.

Right, what I had in mind is one that would take an offset and size; I
hadn’t realized the name was already taken.

Thanks,
Ludo’.



Re: [EXT] [PATCH] Add 'bytevector-slice'.

2023-01-11 Thread lloda


> On 11 Jan 2023, at 18:37, Thompson, David  wrote:
> 
> On Wed, Jan 11, 2023 at 12:34 PM Ludovic Courtès  wrote:
>> 
>> What could be convenient though is ‘bytevector-copy’ (no bang), which
>> would combine ‘make-bytevector’ + ‘bytevector-copy!’.
> 
> 'bytevector-copy' already exists, or do you mean some different
> implementation of it?
> 
> - Dave

The current bytevector-copy takes a single argument. I would extend it in the 
same way the srfi4 copy functions were extended recently in the following commit

http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=6be51f9bbf47692ee5747b2cac6b372df65de970
 


Regards

  Daniel