login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #412 Wrong definition of equality in TBAGG revision 2 of 2

1 2
Editor: gdr
Time: 2008/05/18 13:33:32 GMT-7
Note:

added:

From gdr Sun May 18 13:33:32 -0700 2008
From: gdr
Date: Sun, 18 May 2008 13:33:32 -0700
Subject: 
Message-ID: <20080518133332-0700@axiom-wiki.newsynthesis.org>


Fixed in OpenAxiom

Submitted by : kratt6 at: 2008-01-07T06:11:30-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

The expected result is false, but:

axiom
R ==> Record(key: Symbol, entry: String)
Type: Void
axiom
T ==> AssociationList(Symbol, String)
Type: Void
axiom
t1 := construct([[x, "ix"]$R])$T

\label{eq1} \mbox{\rm table} \left({x = \mbox{\tt "ix"}}\right)(1)
Type: AssociationList?(Symbol,String)
axiom
t2 := construct([[y, "iy"]$R])$T

\label{eq2} \mbox{\rm table} \left({y = \mbox{\tt "iy"}}\right)(2)
Type: AssociationList?(Symbol,String)
axiom
(t1=t2)::Boolean

\label{eq3} \mbox{\rm false} (3)
Type: Boolean

The reason is in the definition of equality in 'TBAGG':

       s:% = t:% ==
       eq?(s,t) => true
       #s ^= #t => false
       for k in keys s repeat
         (e := search(k, t)) case "failed" or (e::Entry) ^= s.k => false
       true

which will always return true. One should insert a "return" between => and false.

Martin

Fixed in OpenAxiom