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

2023-01-14 Thread Ludovic Courtès
Hello! I pushed the patch as commit e441c34f1666921f6b15597c1aa3a50596a129d7 with the following changes taking into account your comments: • adjusted copyright years; • removed comment about ‘SCM_F_BYTEVECTOR_CONTIGUOUS’ since it’s quite clear from the discussion in this thread that

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

2023-01-14 Thread Maxime Devos
On 14-01-2023 00:48, Ludovic Courtès wrote: Ah yes, that’s right, I misunderstood the comment. In the example above, where we’re only dealing with slices, we could “skip” the parent (i.e., have each slice’s parent point to the “root” of the hierarchy), but I don’t think we can assume this to

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

2023-01-13 Thread Ludovic Courtès
Maxime Devos skribis: > On 13-01-2023 12:32, Ludovic Courtès wrote: >>> IIUC, if you use bytevector-slice iteratively, say: >>> >>> (let loop ((bv some-initial-value) >>> (n large-number)) >>>(if (> n 0) >>>(loop (bytevector-slice bv 0 (bytevector-length bv)) >>>

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

2023-01-13 Thread Maxime Devos
On 13-01-2023 12:32, Ludovic Courtès wrote: IIUC, if you use bytevector-slice iteratively, say: (let loop ((bv some-initial-value) (n large-number)) (if (> n 0) (loop (bytevector-slice bv 0 (bytevector-length bv)) (- n 1)) bv)) you will end up with a

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

2023-01-13 Thread Ludovic Courtès
Hi, Maxime Devos skribis: > The only thing missing for me, is a procedure > 'bytevector-slice/read-only' and 'bytevector-slice/write-only', then I > could throw the module implementing the wrapping in Scheme-GNUnet and > the overhead incurred by wrapping away. I did consider the read-only

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

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'

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

2023-01-11 Thread Maxime Devos
This looks useful to me, especially once the optimiser recognises 'bytevector-slice'. (In Scheme-GNUnet, I defined a wrapper around bytevectors called 'bytevectors slices' to implement such a thing.) The only thing missing for me, is a procedure 'bytevector-slice/read-only' and

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

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

2023-01-11 Thread Thompson, David
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

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

2023-01-11 Thread Ludovic Courtès
Hi, Jean Abou Samra skribis: > What do you think about making it more similar to substrings? > There the 'substring' procedure makes a copy-on-write substring, > and you have substring/shared if you really want shared mutation. > Would something like this be meaningful / feasible / useful > for

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

2023-01-11 Thread Jean Abou Samra
Hi Ludovic, Le 11/01/2023 à 16:00, Ludovic Courtès a écrit : +@node Bytevector Slices +@subsubsection Bytevector Slices + +@cindex subset, of a bytevector +@cindex slice, of a bytevector +@cindex slice, of a uniform vector +As an extension to the R6RS specification, the @code{(rnrs bytevectors

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

2023-01-11 Thread Thompson, David
Hi Ludovic, On Wed, Jan 11, 2023 at 10:00 AM Ludovic Courtès wrote: > > +@node Bytevector Slices > +@subsubsection Bytevector Slices > + > +@cindex subset, of a bytevector > +@cindex slice, of a bytevector > +@cindex slice, of a uniform vector > +As an extension to the R6RS specification, the

[PATCH] Add 'bytevector-slice'.

2023-01-11 Thread Ludovic Courtès
* module/rnrs/bytevectors/gnu.scm: New file. * am/bootstrap.am (SOURCES): Add it. * libguile/bytevectors.c (scm_bytevector_slice): New function. * libguile/bytevectors.h (scm_bytevector_slice): New declaration. * test-suite/tests/bytevectors.test ("bytevector-slice"): New tests. *