> But using / in Spad this would become a little awkward. Eg.
> 
>   y:NonZero(Integer):=retractIfCan(z)
>   y case "failed" => error ...
>   x/y

Well... we should have exceptions anyway...
And since NonZero(X) would be a subdomain of X, there is actually no 
need to do any conversion at all I rather think of "telling the compiler 
about extra properties of an element".

So maybe it would look better if in the end we could say something like

x: % := ...
y: % := ...
...
augment(y, NonZero %){
   z := x/y
}

and the "augment" might throw a runtime exception if y=0.

This is similar to

if D has SomeCat then {
    -- do something with the knowledge that D exports SomeCat
}

only that it is working on (element, Domain) instead of

   has: (Domain, Category) -> Boolean

One might argue that the "augment" above is the same as

   if not zero? y then z := x/y

Yes, nearly. The difference is that in the "augment" would transport the 
NonZero knowledge to / while in the "if" construction / would not see 
that y has already been checked for being non-zero.

Of course the "if" construction looks more natural. So I'd rather like a 
way to transport such information to argument properties of /. These are 
questions that should be tackled in the future. I don't see some 
immediate remedy for that right now. Looks like a need to invent a more 
powerful language. ;-)

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to