From: Paul F. Dietz
Subject: Contradiction in ANSI CL spec: MAKE-ARRAY and ARRAY-DISPLACEMENT
Date:
Message-ID: <e-KcnZIiRs_tdbCjXTWcpw@dls.net>
I've come across a vexing contradiction in the CL Hyperspec.
On the MAKE-ARRAY page, it states:
If displaced-to is nil, the array is not a displaced array.
And on the ARRAY-DISPLACEMENT page it states:
If the array is a displaced array, returns the values of
the :displaced-to and :displaced-index-offset options for
the array (see the functions make-array and adjust-array).
If the array is not a displaced array, nil and 0 are returned.
So, clearly, (ARRAY-DISPLACEMENT (MAKE-ARRAY <dims> :DISPLACED-TO NIL))
must return NIL, 0.
However, the ARRAY-DISPLACEMENT page also says:
If array-displacement is called on an array for which a
non-nil object was provided as the :displaced-to argument
to make-array or adjust-array, it must return that object
as its first value. It is implementation-dependent whether
array-displacement returns a non-nil primary value for any
other array.
This appears to directly contradict the previous two passages.
What's the scoop here?
Paul
From: Kent M Pitman
Subject: Re: Contradiction in ANSI CL spec: MAKE-ARRAY and ARRAY-DISPLACEMENT
Date:
Message-ID: <sfwhec2t1ja.fsf@shell01.TheWorld.com>
"Paul F. Dietz" <·····@dls.net> writes:
> I've come across a vexing contradiction in the CL Hyperspec.
>
> On the MAKE-ARRAY page, it states:
>
> If displaced-to is nil, the array is not a displaced array.
>
> And on the ARRAY-DISPLACEMENT page it states:
>
> If the array is a displaced array, returns the values of
> the :displaced-to and :displaced-index-offset options for
> the array (see the functions make-array and adjust-array).
> If the array is not a displaced array, nil and 0 are returned.
>
> So, clearly, (ARRAY-DISPLACEMENT (MAKE-ARRAY <dims> :DISPLACED-TO NIL))
> must return NIL, 0.
>
> However, the ARRAY-DISPLACEMENT page also says:
>
> If array-displacement is called on an array for which a
> non-nil object was provided as the :displaced-to argument
> to make-array or adjust-array, it must return that object
> as its first value. It is implementation-dependent whether
> array-displacement returns a non-nil primary value for any
> other array.
>
> This appears to directly contradict the previous two passages.
>
> What's the scoop here?
I believe it's like this:
Implementations are permitted to implement all arrays as displaced arrays.
I probably should have created terms "expressly displaced" and "actually
displaced" and said that if MAKE-ARRAY is given a :DISPLACED-TO, then the
array is expressly displaced and therefore actually displaced, while if it's
given NIL or none, then the array might or might not be actually displaced.
ARRAY-DISPLACEMENT will detect the implementation-dependent quality which
is actual displacement.
Does that make it seem more consistent? I don't think the passages are
in conflict nor in error.
From: Paul F. Dietz
Subject: Re: Contradiction in ANSI CL spec: MAKE-ARRAY and ARRAY-DISPLACEMENT
Date:
Message-ID: <9BKdnSUuNKjFarCjXTWcqQ@dls.net>
Kent M Pitman wrote:
> Does that make it seem more consistent? I don't think the passages are
> in conflict nor in error.
Yes, thanks. I assume the wiggle room is due to how Lisp Machines
implemented arrays?
Paul