From: Patrick May on
I have an issue where two lists, one loaded from a database and one
received from a web client, render identically with format but don't
compare equal with either equal or tree-equal. What could cause this?

Thanks,

Patrick

------------------------------------------------------------------------
http://www.softwarematters.org
Large scale, mission-critical, distributed OO systems design and
implementation. (C++, Java, Common Lisp, Jini, middleware, SOA)
From: Pillsy on
On Jan 25, 11:16 am, Patrick May <patr...(a)softwarematters.org> wrote:

>      I have an issue where two lists, one loaded from a database and one
> received from a web client, render identically with format but don't
> compare equal with either equal or tree-equal.  What could cause this?

Since you're comparing two lists, all the elements in those lists must
be EQUAL for the two lists to be EQUAL.

However, for most types (including arrays that aren't strings,
structure classes and standard classes), two objects aren't EQUAL
unless they're EQ. This makes it particularly easy for two arrays or
structure instances to have the same print representation but come
back as different according to EQUAL.

HTH,
Pillsy
From: Patrick May on
Pillsy <pillsbury(a)gmail.com> writes:
> On Jan 25, 11:16 am, Patrick May <patr...(a)softwarematters.org> wrote:
>
>> I have an issue where two lists, one loaded from a database and one
>> received from a web client, render identically with format but don't
>> compare equal with either equal or tree-equal. What could cause this?
>
> Since you're comparing two lists, all the elements in those lists must
> be EQUAL for the two lists to be EQUAL.
>
> However, for most types (including arrays that aren't strings,
> structure classes and standard classes), two objects aren't EQUAL
> unless they're EQ. This makes it particularly easy for two arrays or
> structure instances to have the same print representation but come
> back as different according to EQUAL.

That pointed me in the right direction, thanks.

pjm

------------------------------------------------------------------------
http://www.softwarematters.org
Large scale, mission-critical, distributed OO systems design and
implementation. (C++, Java, Common Lisp, Jini, middleware, SOA)
From: joswig on
On 25 Jan., 18:50, Patrick May <patr...(a)softwarematters.org> wrote:
> Pillsy <pillsb...(a)gmail.com> writes:
> > On Jan 25, 11:16 am, Patrick May <patr...(a)softwarematters.org> wrote:
>
> >>      I have an issue where two lists, one loaded from a database and one
> >> received from a web client, render identically with format but don't
> >> compare equal with either equal or tree-equal.  What could cause this?
>
> > Since you're comparing two lists, all the elements in those lists must
> > be EQUAL for the two lists to be EQUAL.
>
> > However, for most types (including arrays that aren't strings,
> > structure classes and standard classes), two objects aren't EQUAL
> > unless they're EQ. This makes it particularly easy for two arrays or
> > structure instances to have the same print representation but come
> > back as different according to EQUAL.
>
>      That pointed me in the right direction, thanks.

Usually I would just MAP the two lists and compare the items with
EQUAL.

(map nil (lambda (a b) (unless (equal a b) (describe a) (describe b)))
l1 l2)

With a DESCRIBE I would look at the offending items.
For a list of lists, similar, walking down the lists...


From: Thomas A. Russ on
Patrick May <patrick(a)softwarematters.org> writes:

> I have an issue where two lists, one loaded from a database and one
> received from a web client, render identically with format but don't
> compare equal with either equal or tree-equal. What could cause this?

In addition to what Pillsy said, you may be able to find the differences
by using the MISMATCH function to see where the two lists diverge. That
can give you a clue.

Another option would be to try something like

(let ((*print-circle* t))
(print (list list1 list2)))

and let the circular structure printer show you which elements are the
same and which are different.

--
Thomas A. Russ, USC/Information Sciences Institute