These error messages indicate some serious problems with the Axiom Tuple domain: System error: The function |Domain| is undefined. The constructor Tuple takes 1 argument and you have given 2 Axiom allows functions to have a tuple as input but it fails if a function generates two or more outputs. For example: fricas (1) -> f:(INT, Type: Void
fricas g:INT->(INT, fricas (INT, Type: Tuple(Type)
fricas List Any
Type: Type
fricas DirectProduct(2,
Type: Type
fricas Tuple Any Type: Tuple(Type)
Axiom's non-homogeneous Record and Union domains are functionally superior to the tuple construct but it makes functional notation awkward. See SandBox Direct Product Try this (which gets around the error messages and bug): fricas a:Tuple INT Type: Void
fricas a:=(1,
Type: Tuple(Integer)
fricas dom:=Tuple Any
Type: Type
fricas b:dom:=(1::INT,
Type: Tuple(Any)
fricas h:INT->Tuple INT Type: Void
fricas h(x)==(x, Type: Void
fricas h(5) fricas Compiling function h with type Integer -> Tuple(Integer)
Type: Tuple(Integer)
Any suggestions --billpage, Wed, 29 Jun 2005 01:43:26 -0500 reply How to do composition of functions with two arguments and two outputs?
fricas f1:INT->Tuple INT Type: Void
fricas f1(x)==(x, Type: Void
fricas f2:(INT, Type: Void
fricas f2(x, Type: Void
fricas f2(f1(4)) fricas Compiling function f1 with type Integer -> Tuple(Integer) There are no library operations named f2 Use HyperDoc Browse or issue )what op f2 to learn if there is any operation containing " f2 " in its name. From: William Sit, July 1, 2005 06:26:00 -5:00 The following works (not as neat as it should be, of course) fricas f1:INT->Tuple INT Type: Void
fricas f1(x)==(x, Type: Void
fricas f2:(INT, Type: Void
fricas f2(x, Type: Void
fricas a:=f1(4) fricas Compiling function f1 with type Integer -> Tuple(Integer)
Type: Tuple(Integer)
fricas f2(select(a, fricas Compiling function f2 with type (Integer,
Type: PositiveInteger?
fricas f3:Tuple INT -> INT Type: Void
fricas f3(x) == reduce(*, Type: Void
fricas f3(a) fricas Compiling function f3 with type Tuple(Integer) -> Integer There are 2 exposed and 5 unexposed library operations named length having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, Note that neither I do not know why in the design of One final puzzle: In axiom output messages for (9) above, what is the fricas )clear all Type: Void
fricas f3 x == reduce(*, Type: Void
fricas a:Tuple INT:=(2,
Type: Tuple(Integer)
fricas f3 a fricas Compiling function f3 with type Tuple(Integer) -> Integer There are 2 exposed and 5 unexposed library operations named length having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, and there is no such function. Also, William Why tuples are displayed as list ?I prefer to read (2,3) or 2,3 for tuple, and [2,3] only for lists. Students and I make errors when the display is the same, even if there is a type information. From William Sit, Fri Jul 1 08:50:00 -0500 2005 There seems to be some bug in the display, because the code in Tuple (array1.spad) uses parenthesis, not brackets. fricas coerce(a)$Tuple INT
Type: OutputForm?
fricas coerce(a)@PRIMARR INT
Type: PrimitiveArray?(Integer)
This "bug" may be due to the Interpreter coercing William See related discussion: Tuples Products And Records A named tuple cannot be assigned to a tuple of identifiers. The last (commented out) line '[1 for (a,b) in g]? seems to cause a freeze in Axiom; no output, not even if )set mess bot on. If you try it by uncommenting the line, you have to use cancel. (It should have reported syntax error similar to (a,b):=f' (although there shouldn't be an error because f is of type Tuple (Positive) Integer . However, even (a,b):=(f::Tuple Integer) does not work.) This may be related to the convention that select rather than apply is used to get components in a tuple.
fricas )clear all
Type: List(Tuple(PositiveInteger?))
fricas [(a:=e;(a,
Type: List(Tuple(Tuple(PositiveInteger?)))
fricas [((a,
Type: List(Tuple(Polynomial(Integer)))
fricas f:=g.1
Type: Tuple(PositiveInteger?)
fricas (a, On my system, the following message finally: >> System error: The storage for CONS is exhausted. Currently, 85895 pages are allocated. Use ALLOCATE to expand the space. It's clearly an infinite loop. Category: Axiom Programming => Axiom Compiler Severity: serious => normal This is issue is the result of lack of abstraction rampant in both the compiler and interpreter. More precisely, there is no proper separation between the internal name used to tag internal ASTs? and name used for category/domain constructor. Tuple is both the name of a constructor and the tag given to an AST that represents tuples. As a consequence the semantics analyzer cannot disguish between when Tupel is effectively used a domain constructor, as opposed to just the name of a tag. Display problem fixed in OpenAxiom-1.1.1 and later. Looking at the original report, the notation (INT,INT) does not necessarily designate a type. It does so only in a very specific cases. However, in general, it designates an object that is not of domain type, just like [INT,INT]? is not a domain. Status: open => rejected |