Problem: when using a type A(p:Polynomial Integer) in another type B, then
Fricas complains if p is a number (Expression makes no difference). Is
there any method to tell the compiler that the number (if) is a "Polynomial
Integer"? I tried out as much as crossed my mind. Any clues highly
appreciated?
Below is a minimal code sample:
[1] b:=b::B
(1) b
Type:
B
[2] f b
>> System error:
The value
0
is not of type
CONS
[3] g b
(3) OK
Type: A(r)
[4] h b
>> System error:
The value
|pretend|
is not of type
FIXNUM
----
)abbrev domain ADOM A
A(p:Polynomial Integer) : Exports == Implementation where
--p : Polynomial Integer
BOP ==> BasicOperator
Exports == SetCategory with
coerce : Symbol -> %
Implementation == BOP add
Rep := BOP
coerce(s:Symbol):% == operator s
)abbrev domain BDOM B
B : Exports == Implementation where
BOP ==> BasicOperator
PINT ==> Polynomial Integer
Exports == SetCategory with
coerce : Symbol -> %
f : % -> A(0)
g : % -> A(r)
h : % -> A(2 pretend PINT)
Implementation == BOP add
Rep := BOP
coerce(s:Symbol):% == operator s
NULL:A(0):="NULL"::Symbol::A(0)
TWO:A(2 pretend PINT):="TWO"::Symbol::A(2 pretend PINT)
r:Polynomial Integer
OK:A(r):="OK"::Symbol::A(r)
f x == NULL
g x == OK
h x == TWO
---
Background:
http://fricas-wiki.math.uni.wroc.pl/DependentTypeTest1
--
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 on the web visit
https://groups.google.com/d/msgid/fricas-devel/dee3ae65-8ca5-457a-af05-406d8253a872n%40googlegroups.com.