|
|
last edited 9 years ago by test1 |
1 2 3 4 5 6 7 8 9 10 11 | ||
Editor: gdr
Time: 2008/01/25 13:27:44 GMT-8 |
||
Note: |
added:
From gdr Fri Jan 25 13:27:44 -0800 2008
From: gdr
Date: Fri, 25 Jan 2008 13:27:44 -0800
Subject:
Message-ID: <20080125132744-0800@axiom-wiki.newsynthesis.org>
The problem here, I believe, is that Type is a category almost isolated.
The interpreter thinks of Integer and Float as of type Domain, not Type.
If you change the return type from `Type' to `Domain'. It would not
work in OpenAxiom. Both `Type' and `Object' seems to be isolated in
the type hierarchy.
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 FriCAS 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.06 SEC. (time taken in buildFunctor: 0) ;;; *** |testtype| REDEFINED ;;; *** |testtype| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor testtype Time: 0.06 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 FriCAS 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. #1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL' "/var/zope2/var/LatexWiki/7383689924623811223-25px003.as", line 5: tt2(x:Integer):Type == { ........^ [L5 C9] #2 (Warning) Function returns a domain that might not be constant (which may cause problems if it is used in a dependent type). Compiling Lisp source code from file ./7383689924623811223-25px003.lsp Issuing )library command for 7383689924623811223-25px003 Reading /var/zope2/var/LatexWiki/7383689924623811223-25px003.asy testtype2 is now explicitly exposed in frame initial testtype2 will be automatically loaded when needed from /var/zope2/var/LatexWiki/7383689924623811223-25px003
axiomtt2(1)
(1) |
axiomtt2(0)
(2) |