>>> You return false if type has no equality -- this has good chance >>> being wrong. >> I don't think so. If Any is declared to be of type SetCategory, then = >> should never give an error. > > I do not think so -- in general operations are partial functions. > Field exports / with signature '(%, %) -> %'. Do you expect > no error when computing 1/0?
I could live with a catchable exception. And of course that must be properly documented. But there should be no error. In fact, the signature (%,%)->% is wrong. It's only a compromise to /: (%, NonZero(%))->% I would reserve -> for declaring total function. Maybe there could be another arrow for partial functions. Of course, I would want the compiler to produce efficient code. But actually, the problem that in x/y the y is zero could be discovered by 1 x: % := ... 2 y: % := ... 3 z: NonZero(%) := y::NonZero(%) 4 result: % := x / z Of course, that looks ugly, but it is stating that / is a total function on appropriate input domains. In fact, NonZero(X) is like a subdomain of X with no (or just a few coercion functions) exported function. So in implementing (x: %) / (y: NonZero(%)): % == ... there might be some y::%. Since that is the identity function, the compiler need not generate any function call for it. It's only that the knowledge "NonZero" is transported by this strategy. Yes, yes... I would be even more happy if I could replace "NonZero" by a logical formula. Ralf --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
