I thought the following would be possible in SPAD.
-----------------------------
)abbrev package FOO Foo
Foo(n: Integer): Exports == Implementation where
Exports ==> Ring
Implementation ==>
n > 2 => Fraction Integer
Integer
-----------------------------
However, it gives
%%% (148) -> )co ../foo
Compiling FriCAS source code from file
/home/hemmecke/backup/git/qeta/tmp/../foo.spad using system
compiler.
FOO abbreviates package Foo
****** comp fails at level 1 with expression: ******
((DEF (|Foo| |n|) ((|Ring|) (|Integer|))
(IF (> |n| 2)
(|Fraction| (|Integer|))
(|Integer|))))
****** level 1 ******
x:= (DEF (Foo n) ((Ring) (Integer)) (IF (> n 2) (Fraction (Integer))
(Integer)))
m:= $EmptyMode
f:=
((((|$DomainsInScope| # #))))
>> Apparent user error:
bad == form
(DEF (Foo n) ((Ring) ) (IF (> n 2) (Fraction (Integer)) (Integer)))
Cannot I implement a domain that uses a certain representation depending
on an argument.
Actually, Expression is doing that, but it does it with only one "add"
keyword.
Of course, in the above example, I actually want
Implementation ==>
n > 2 => Fraction Integer add ...
Integer add ...
i.e. with a few more function. But since it does not work even without
the "add" ...
Is this a weakness of the SPAD-compiler?
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/a76eab47-4315-493a-99b2-0d88b5061397%40hemmecke.org.