I think "cheating" is the wrong word. Understanding why and how this
works in FriCAS is a very useful exercise. Of course, as you have
explained it is moot in a pure statically typed environment like
native Aldor (or SPAD if such existed).

On Thu, Jul 28, 2011 at 4:10 PM, Ralf Hemmecke <[email protected]> wrote:
>
>
> On 07/28/2011 09:55 PM, Bill Page wrote:
>> Your code:
>>
>> )abbrev package TF TypeFinder
>> TypeFinder(S: Type): with
>>      GetType: S ->  Type
>>    == add
>>      GetType(x: S): Type == S
>>
>> ---
>>
>> Note: Proper indentation
>>
>> seems to work fine as a spad package in FriCAS. What problem do you
>> see in Aldor?  Are you using Aldor standalone or as the library
>> compiler for FriCAS?
>
> Bill, you should know that the session below is cheating. The
> interpreter provides the type information for GetType and thus import
> TypeFinder with an appropriate S. I am pretty sure that I am right.
>
> I don't try now, but I am pretty sure that you cannot achieve the things
> below directly in SPAD. Of course without importing explicitly from
> TypeFinder(Integer) and TypeFinder(Polynomial(Integer)), otherwise it
> would be no surprise and, of course, working.
>
> Ralf
>
> (1) -> i:Integer := 5
>
>    (1)  5
>                           Type: Integer
> (2) -> GetType i
>
>    (2)  Integer
>                           Type: Type
> (3) -> p:Polynomial(Integer) := 7
>
>    (3)  7
>                           Type: Polynomial(Integer)
> (4) -> GetType p
>
>    (4)  Polynomial(Integer)
>                           Type: Type
> (5) -> z := 5*x+3
>
>    (5)  5x + 3
>                           Type: Polynomial(Integer)
> (6) -> GetType z
>
>    (6)  Polynomial(Integer)
>                           Type: Type
>
> --
> 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.
>
>

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