As of revision 573, the interpreter now accepts calling a constructor with a homogeneous variable length argument list, when the constructor is defined to take a tuple. This new capability makes it possible to define domains like Enumeration as ordinary OpenAxiom domains. For example, given
)abbrev domain MYENUM MyEnum MyEnum(enums: Tuple Symbol): Public == Private where Public ==> SetCategory with coerce: Symbol -> % Private ==> add Rep == NonNegativeInteger coerce(s: Symbol): % == for i in 0..(length enums - 1) repeat s = select(enums,i) => return per i userError [s, "is not a valid enumerator"] e1 = e2 == rep e1 = rep e2 coerce(e: %): OutputForm == select(enums, rep e)::OutputForm I have (1) -> WeekDay := MyEnum(Mon,Tue,Wed,Thu,Fri) (1) MyEnum(Mon,Tue,Wed,Thu,Fri) Type: Domain (2) -> Mon :: WeekDay (2) Mon Type: MyEnum(Mon,Tue,Wed,Thu,Fri) (3) -> Sat::WeekDay >> Apparent user error: Sat is not a valid enumerator Now, I don't see much reason not to define the builtin type Enumeration as an ordinary domain. [1] -- Gaby [1] In fact I know of a reason: Equality of domains is not well defined, for constructor instantiations involving vectors and the like. ------------------------------------------------------------------------- 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