Not bad ;)
Now we can compare types:
)abbrev package CMPTYPE CompareTypes
CompareTypes(T:Type,S:Type):Exports == Impl where
SEX ==> SExpression
Exports == with
sameType? : (T, S) -> Boolean
Impl == add
import TypePackage(T)
import TypePackage(S)
sameType?(x:T,y:S):Boolean ==
test ( typeof(x)::SEX = typeof(y):: SEX )
sameType?([1,2,3],[4,5]) -> true
sameType?([1,2,%pi],[6,7]) -> false
...
On 15 August 2016 at 05:46, oldk1331 <[email protected]> wrote:
> When Spad compiler is rewritten in Spad, typoOf will be a
> ordinary Spad function...
>
> For now, you can build something similar:
>
> )abbrev package TYPEPKG TypePackage
>
> TypePackage (T : Type) : Exports == Impl where
> Exports == with
> typeof : T -> Type
> Impl == add
> typeof (x : T) == T
>
>
> ====
>
> And some tests:
>
> typeof 1
> typeof Integer
> typeof (_+$Integer)
> typeof Ring -- Failed, typeOf can
> typeof Type -- Failed, typeOf can
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.