> On 25 Nov 2021, at 19:19, Maxime Devos <[email protected]> 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 (two-dimensional)"
> #t
> (array-mutable? (array-copy #1())))
>
> (pass-if-equal "empty (two-dimensional)"
> #t
> (array-mutable? (array-copy #2(() ()))))
>
> (pass-if-equal "immutable copy"
> #f
> (array-mutable? (immutable-array-copy #2((h) (h)))))
>
> This requires a currently non-existent procedure ‘make-immutable-
> array’, copying an array into a new immutable array.
>
> Greetings,
> Maxime
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. If one has a mutable array, is there any reason why one would want
to make an immutable copy?
regards
Daniel