[Top][All Lists]

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

Re: [Gcl-devel] Feedback on ANSI bugfixes

From: Paul F. Dietz
Subject: Re: [Gcl-devel] Feedback on ANSI bugfixes
Date: Fri, 23 Aug 2002 06:28:30 -0500

Camm Maguire wrote:

> > (TAILP 10203040506070 (LIST* 'CL-TEST::A 'CL-TEST::B
> >                                   (1- 10203040506071)))
> >   ==> NIL
> > when it should be true (the arithmetic in this test prevents
> > an aggressive [reader] from making the two numbers EQ.)
> >
> I don't quite get this 'aggressive reader' bit.  Clearly the two items
> aren't eq?  If not, what makes them so, and where does one draw the
> line?  I.e. one could nest arbitrarily deeply, no?

Sorry, I should have said an aggressive compiler, not an aggressive reader.
The compiler is allowed to coalesce the shared structure of literal
constants; the CMU CL compiler does this, for instance.  I want to be
able to compile these tests (at various optimization settings) before
running them, to detect compiler bugs.

The test still has a problem, since a conforming lisp implementation
can also dynamically make EQL bignums be EQ.  So the test should have
included a check that the two numbers were not EQ.

> > This is the test case for the set-exclusive-or problem.
> > I've had arguments with other Lisp implementors as to
> > whether the standard really calls for this behavior.
> > IIRC, CMUCL does not enforce this ordering constraint.
> >
> > (let ((list1 '(a b c d))
> >         (list2 '(e f g h)))
> >       (block fail
> >             (set-exclusive-or
> >              list1 list2
> >              :test #'(lambda (s1 s2)
> >                        (when (or (member s1 list2)
> >                                  (member s2 list1))
> >                          (return-from fail 'failed))))))
> >    ==> failed
> > when it should return some permutation of (a b c d e f g h).
> >
> OK, I'll try to investigate this.  Is this part of the standard tests?
> If not, why do you need this?

It comes from this paragraph in the SET-EXCLUSIVE-OR entry of the CLHS,
in particular the second sentence:

 If :key is supplied, it is used to extract the part to be tested
 from the list-1 or list-2 element. The first argument to the :test
 or :test-not function is the part of an element of list-1 extracted
 by the :key function (if supplied); the second argument is the part
 of an element of list-2 extracted by the :key function (if supplied).
 If :key is not supplied or nil, the list-1 or list-2 element is used.

You *might* interpret this to mean that if :key is not supplied then
the order can be changed, but I consider that to be misreading an


reply via email to

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