Gaby, I wanted to you send a "thank you!" for the implementation of 'rep' and 'per' in OpenAxiom. I frequently found the liberal and irregular use of 'pretend' in other Axiom dialects to be confusing - so much so that sometimes I had to resort to first writing code in Aldor to benefit from the improved error messages and consistent use of 'rep' and 'per' in order to get something to compile. Once it was working in Aldor then I could manually translate it back to SPAD and be reasonably confident that it would compile in SPAD also.
The page: http://axiom-wiki.newsynthesis.org/SandBoxSum is the first time I have been able to do this directly in SPAD using OpenAxiom. Consistent use of 'rep' and 'per' is a pleasure. And there seem to have been other less obvious improvements to the compiler. Thank you very much for this! --------- Then I'll ask just one question about Union: (1) -> )sh Union(a:Integer,b:Float) Union(a: Integer,b: Float) is a domain constructor. ------------------------------- Operations -------------------------------- ?=? : (%,%) -> Boolean ?case? : (%,a) -> Boolean ?case? : (%,b) -> Boolean coerce : % -> OutputForm construct : Float -> % construct : Integer -> % ?.? : (%,b) -> Float ?.? : (%,a) -> Integer ?~=? : (%,%) -> Boolean shows only 'construct' as an overloaded method for creating members of the Union. (1) -> x:Union(a:Integer,b:Float):=2 (1) 2 Type: Union(a: Integer,...) (2) -> y:Union(a:Integer,b:Float):=3.14 (2) 3.14 Type: Union(b: Float,...) But suppose I wanted to create a Union with two copies of 'Integer'? This is a tagged union so this should be possible, right? But what about the exports? (3) -> )sh Union(a:Integer,b:Integer) Union(a: Integer,b: Integer) is a domain constructor. ------------------------------- Operations -------------------------------- ?=? : (%,%) -> Boolean ?case? : (%,a) -> Boolean ?case? : (%,b) -> Boolean coerce : % -> OutputForm construct : Integer -> % construct : Integer -> % ?.? : (%,a) -> Integer ?.? : (%,b) -> Integer ?~=? : (%,%) -> Boolean There seem to be two operations named 'construct' with the *same* signature! Surely one of these was intended to create an member of the Union tagged 'a' and the other a member tagged 'b'. But how can I call the correct one? (3) -> z:Union(a:Integer,b:Integer):=2 (3) 2 Type: Union(a: Integer,b: Integer,...) (4) -> z.a (4) 2 Type: PositiveInteger (5) -> z.b >> Error detected within library code: (0 . 2) cannot be coerced to mode (Integer) (5) -> z.b := 2 The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation. (5) -> z:Union(a:Integer,b:Integer) := [b==3] There are no library operations named OPTARG Use HyperDoc Browse or issue )what op OPTARG to learn if there is any operation containing " OPTARG " in its name. Cannot find a definition or applicable library operation named OPTARG with argument type(s) Variable b PositiveInteger Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. ------- How can I create a member tagged with 'b'? In panAxiom I can write: x:Product(Integer,Integer) := [1,2] With the dual construction of 'Sum' shown at the link above, I would also like to be able to write: x:Sum(a:Integer,b:Integer) := ? and have it populate the correct copy of Integer. In Aldor I can use the "keyword arguments" like: x:Sum(a:Integer,b:Integer) := [b==3] or equivalently 'union(b==3)' http://www.aldor.org/docs/HTML/chap13.html#8 but so far I have not found anything equivalent in any flavor of Axiom. Maybe 'setelt' should be exported by Union? I wonder if the reference to "OPTARG" in the error message shown above indicates that there is some incomplete support for this somewhere in the Interpreter? Any ideas about this? Regards, Bill Page. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel