|
|
last edited 9 years ago by test1 |
1 2 3 4 5 6 7 8 9 10 11 | ||
Editor: Bill Page
Time: 2008/02/25 07:18:02 GMT-8 |
||
Note: example |
added:
\begin{axiom}
tt:INT->Domain
tt(x)== (x=0 => Integer; Float)
tt(1)
\end{axiom}
This function should return a type that depends on a parameter:
axiomtt:INT->Type
axiomtt(x)== (x=0 => Integer; Float)
axiomtt(1) Internal Error Interpreter code generation failed for expression (IF (= |#1| 0) |Integer| |Float|)
Here is the same function in SPAD:
spad)abbrev package TT testtype testtype(): exports == implementation where exports == with tt1: (Integer) -> Type implementation == add tt1(x) == x=0 => Integer Float
Compiling OpenAxiom source code from file /var/zope2/var/LatexWiki/8965653050310018446-25px002.spad using old system compiler. TT abbreviates package testtype ------------------------------------------------------------------------ initializing NRLIB TT for testtype compiling into NRLIB TT compiling exported tt1 : Integer -> Type Time: 0.05 SEC. (time taken in buildFunctor: 0) ;;; *** |testtype| REDEFINED ;;; *** |testtype| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor testtype Time: 0.05 seconds finalizing NRLIB TT Processing testtype for Browser database: --->-->testtype((tt1 ((Type) (Integer)))): Not documented!!!! --->-->testtype(constructor): Not documented!!!! --->-->testtype(): Missing Description ------------------------------------------------------------------------ testtype is now explicitly exposed in frame initial testtype will be automatically loaded when needed from /var/zope2/var/LatexWiki/TT.NRLIB/code
Calling this function like this:
\begin{axiom} tt1(1) \end{axiom}
causes Axiom to crash:
(1) -> tt1(1) >> System error: Caught fatal error [memory may be damaged]
But this works using Aldor! :-)
aldor#include "axiom.as"; testtype2(): with { tt2: (Integer) -> Type; } == add { tt2(x:Integer):Type == { x=0 => Integer; Float; } }
Compiling OpenAxiom source code from file /var/zope2/var/LatexWiki/7383689924623811223-25px003.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra Use the system command )set compiler args to change these options. >> System error: GETENV is invalid as a function.
axiomtt2(1) There are no library operations named tt2 Use HyperDoc Browse or issue )what op tt2 to learn if there is any operation containing " tt2 " in its name. Cannot find a definition or applicable library operation named tt2 with argument type(s) PositiveInteger Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. tt2(0) There are no library operations named tt2 Use HyperDoc Browse or issue )what op tt2 to learn if there is any operation containing " tt2 " in its name. Cannot find a definition or applicable library operation named tt2 with argument type(s) NonNegativeInteger Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiomtt:INT->Domain Compiled code for tt has been cleared.
axiomtt(x)== (x=0 => Integer; Float) 1 old definition(s) deleted for function or rule tt
axiomtt(1)
Compiling function tt with type Integer -> Domain
(1) |