Dear Johannes,

you have certainly looked at the implementation of = in Any. It says:

      x = y      == (x.dm = y.dm) and EQ(x.ob, y.ob)$Lisp

which I think is actually not what one wants. One wants the equality 
semantics of the corresponding domain not EQ from Lisp.

The representation is

      Rep := Record(dm: SExpression, ob: None)

So the actual domain that ob lives in is not really there.

Much better would be if Any looked somehow like Object (see chapter
21.10 of the pdf version of the Aldor User Guide).

In general equality is rare. So maybe it should be something like

x = y ==
     not (x.dm = y.dm) => false
     D := DOMAIN(x.dm)
     if D has with (=: (%, %) -> Boolean)
         then (x.ob pretend D) = (y.ob pretend D)
         else false

I have, however, no idea what the DOMAIN function actually is in fricas.

It should transform the s-expression into a true fricas domain. Or maybe 
one should rather immediately put the original domain in the 
representation record, so "DOMAIN" would not be needed.

My real suggestion is: try to avoid "Any". Can't you do without it?
Maybe you copy Object from the Aldor User Guide.

Ralf

On 06/09/2009 10:05 AM, Johannes Grabmeier wrote:
> I need Any for convenient use of different variable domains in a 
> database prototype. This, however, causes problems, as equality 
> semantics not transparent for me: Can anybody explain or/and give a way 
> around. E.g. counting all occurencies "A" (of type String realized as 
> Any) in a Table(Integer, Any) does not work, as the system considers 
> each occurency "A" as a new object.
> 
> Here some illustrations:
> 
> (1) -> )r anyEqual
> 
> ai : IndexedString(10) := char "A"
> 
> (1) "A"
> 
> Type: IndexedString(10)
> 
> bi : IndexedString(10) := char "A"
> 
> (2) "A"
> 
> Type: IndexedString(10)
> 
> (ai = bi)@Boolean
> 
> (3) true
> 
> Type: Boolean
> 
> a : String := "A"
> 
> (4) "A"
> 
> Type: String
> 
> b : String := "A"
> 
> (5) "A"
> 
> Type: String
> 
> (a = b)@Boolean
> 
> (6) true
> 
> Type: Boolean
> 
> aa : Any := "A" :: String
> 
> (7) "A"
> 
> Type: String
> 
> domainOf aa
> 
> (8) String()
> 
> Type: OutputForm
> 
> ba : Any := "A" :: String
> 
> (9) "A"
> 
> Type: String
> 
> domainOf ba
> 
> (10) String()
> 
> Type: OutputForm
> 
> (aa = ba)@Boolean
> 
> (11) false
> 
> Type: Boolean
> 
> aA : Any := a
> 
> (12) "A"
> 
> Type: String
> 
> domainOf aa
> 
> (13) String()
> 
> Type: OutputForm
> 
> bA : Any := b
> 
> (14) "A"
> 
> Type: String
> 
> (aA = bA)@Boolean
> 
> (15) false
> 
> Type: Boolean
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to