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