guile-user
[Top][All Lists]
Advanced

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

Re: Python slices in Scheme


From: lloda
Subject: Re: Python slices in Scheme
Date: Mon, 19 Jun 2023 18:36:09 +0200

My library guile-newra (1) has quite general multidimensional array slicing. 
The indices can be linear ranges or arbitrary integer arrays and they can have 
any rank. You can also use the indexed array as write target. If all the 
indices are linear ranges then the operation is done without copies. It also 
has placeholders, so you can skip axes, like :  and ... in numpy. guile-newra's 
arrays are applicative, so you can do (thearray firstindex secondindex ...), 
without special brackets.

You need wrappers to use it with Guile's native array types, so it may not be 
as convenient. Or maybe you don't need to handle arbitrary rank, then it might 
not be the best option. It's also far from finished, although the stuff I 
mentioned above does work.

I didn't adopt Pythons -1 = end convention because in Guile arrays can have any 
base index, not necessarily 0 (whether that's a good idea or not).

(1) https://lloda.github.io/guile-newra/#Slicing 
<https://lloda.github.io/guile-newra/#Slicing>
https://github.com/lloda/guile-newra/ <https://github.com/lloda/guile-newra/>
https://notabug.org/lloda/guile-newra <https://notabug.org/lloda/guile-newra>



reply via email to

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