Hi,
lloda schreef op do 25-11-2021 om 20:08 [+0100]:
I think literal arrays are always immutable, and one could base the
test on that.
>
Is such a function useful in some other context? If one has an array which is
already immutable, it can be referenced freely and copying it seems
unnecessary.
> On 25 Nov 2021, at 19:56, lloda wrote:
>
>
>
>> On 25 Nov 2021, at 19:22, Maxime Devos wrote:
>>
>> lloda schreef op do 25-11-2021 om 17:40 [+0100]:
>>> +Arrays with empty roots are not considered immutable because
>>> +@code{array-set!} operations with valid indices won't fail (since
> On 25 Nov 2021, at 19:19, Maxime Devos wrote:
>
> lloda schreef op do 25-11-2021 om 17:40 [+0100]:
>> [...]
>
> Suggestion: add a few tests to test-suite/tests/arrays.test:
>
> (pass-if-equal "new"
> #t
> (array-mutable? (make-array #f '(1 2) '(3 4
>
> (pass-if-equal "empty
> On 25 Nov 2021, at 19:22, Maxime Devos wrote:
>
> lloda schreef op do 25-11-2021 om 17:40 [+0100]:
>> +Arrays with empty roots are not considered immutable because
>> +@code{array-set!} operations with valid indices won't fail (since
>> there
>> +are no valid indices).
>> +
>> +@example
>>
lloda schreef op do 25-11-2021 om 17:40 [+0100]:
> +Arrays with empty roots are not considered immutable because
> +@code{array-set!} operations with valid indices won't fail (since
> there
> +are no valid indices).
> +
> +@example
> +(array-mutable? #()) @result{} #t
> +@end example
> +@end deffn
lloda schreef op do 25-11-2021 om 17:40 [+0100]:
> [...]
Suggestion: add a few tests to test-suite/tests/arrays.test:
(pass-if-equal "new"
#t
(array-mutable? (make-array #f '(1 2) '(3 4
(pass-if-equal "empty (two-dimensional)"
#t
(array-mutable? (array-copy #1(
(pass-if-equal
Doesn't seem there was any simple way to check this from either Scheme or C.
0001-New-function-array-mutable.patch
Description: Binary data