From: Patrick May on 25 Jan 2010 11:16 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 25 Jan 2010 11:57 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 25 Jan 2010 12:50 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 25 Jan 2010 13:21 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 25 Jan 2010 13:32 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
|
Next
|
Last
Pages: 1 2 Prev: Hi :D FRIENZ :D FOR ALL YOU FASHION LOVRZ OUT HERE :D Next: Firefox hyperspec search addon |