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 1 of 2

1 2
Editor: kratt6
Time: 2008/01/07 06:11:30 GMT-8
Note:

changed:
-
The expected result is false, but:
\begin{axiom}
R ==> Record(key: Symbol, entry: String)
T ==> AssociationList(Symbol, String)
t1 := construct([[x, "ix"]$R])$T
t2 := construct([[y, "iy"]$R])$T
(t1=t2)::Boolean
\end{axiom}

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

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
LatexWiki Image(1)
Type: AssociationList?(Symbol,String)
axiom
t2 := construct([[y, "iy"]$R])$T
LatexWiki Image(2)
Type: AssociationList?(Symbol,String)
axiom
(t1=t2)::Boolean
LatexWiki Image(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