Waldek,

Thanks for the clarification. By "does not work" I meant that it could
not be called directly from the interpreter. For example as

  char(Integer)$CharPac

I can understand that the underlying cause of the problem might be the
same. I was surprised however that it also didn't work in OpenAxiom
considering that the interpreted version does.

Regards
Bill Page.

On Sun, Aug 23, 2009 at 8:09 PM, Waldek Hebisch wrote:
>
>> Bill Page wrote:
>> On the other hand it is kind of disappointing that the following Spad
>> code compiles without errors in both FriCAS and OpenAxiom:
>>
>> -- char.spad --
>> )abbrev package CHARP CharPac
>> CharPac: with
>>     char: Field -> NonNegativeInteger
>>   == add
>>     char(field:Field):NonNegativeInteger == characteristic()$field
>> -- --
>>
>> but it does not work in either.

> Why do you say it does not work?  Currently in FriCAS interpreter it is
> not possible to pass types as arguments to functions, but is Spad
> code such arguments should work OK.  Extending your example:
>
> )abbrev package CHARPU UseCharPac
> UseCharPac: with
>    useChar: Integer -> NonNegativeInteger
>  == add
>    import CharPac
>    useChar(i : Integer):NonNegativeInteger ==
>        i = 0 => char(AlgebraicNumber)
>        i = 1 => char(PrimeField(7))
>        error "i must be 0 or 1"
>
> -----
>
> I get the expected result:
>
> (1) -> useChar(0)
>
>   (1)  0
>                                                     Type:
> NonNegativeInteger
> (2) -> useChar(1)
>
>   (2)  7
>                                                        Type:
> PositiveInteger
>
> --

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to