|
|
last edited 10 years ago by test1 |
1 2 3 4 5 6 7 8 9 10 11 | ||
Editor: test1
Time: 2014/05/13 17:15:20 GMT+0 |
||
Note: |
added:
From test1 Tue May 13 17:15:20 +0000 2014
From: test1
Date: Tue, 13 May 2014 17:15:20 +0000
Subject:
Message-ID: <20140513171520+0000@axiom-wiki.newsynthesis.org>
Status: fixed somewhere => closed
This function should return a type that depends on a parameter:
(1) -> tt:INT->Type
tt(x)== (x=0 => Integer; Float)
tt(1)
Compiling function tt with type Integer -> Type
(1) |
Here is the same function in 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/lib/zope2.10/instance/axiom-wiki/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 SEC.
(time taken in buildFunctor: 0)
;;; *** |testtype| REDEFINED
;;; *** |testtype| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor testtype Time: 0 seconds
finalizing NRLIB TT Processing testtype for Browser database: --->-->testtype(constructor): Not documented!!!! --->-->testtype((tt1 ((Type) (Integer)))): Not documented!!!! --->-->testtype(): Missing Description ; compiling file "/var/aw/var/LatexWiki/TT.NRLIB/TT.lsp" (written 04 DEC 2024 09:50:32 PM):
; wrote /var/aw/var/LatexWiki/TT.NRLIB/TT.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ testtype is now explicitly exposed in frame initial testtype will be automatically loaded when needed from /var/aw/var/LatexWiki/TT.NRLIB/TT
Calling this function like this::
tt1(1)
(2) |
caused Axiom to crash:
(1) -> tt1(1) >> System error: Caught fatal error [memory may be damaged]
But this works using 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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7383689924623811223-25px004.as using Aldor compiler and options -O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra Use the system command )set compiler args to change these options. "/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7383689924623811223-25px004.as",line 1: #include "axiom.as"; ^ [L1 C1] #1 (Error) Could not open file `axiom.as'.
The )library system command was not called after compilation.
tt2(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.
tt:INT->DomainStatus: open => fixed somewhere If I define a function that returns a domain (such as above):
Domain is not a valid type.
tt:INT->Type
Compiled code for tt has been cleared.
tt(x)== (x=0 => Integer; Float)
1 old definition(s) deleted for function or rule tt
tt(0)
Compiling function tt with type Integer -> Type
(3) |
then can I use it to define new objects? Like this:
f:tt(1):=3.2
(4) |
g:tt(0):=3
(5) |
or this:
F:=tt(1)
(6) |
f:F:=3.2
(7) |
G:=tt(0)
(8) |
g:G:=3
(9) |
)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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px010.spad using old system compiler. TT abbreviates package testtype ------------------------------------------------------------------------ initializing NRLIB TT for testtype compiling into NRLIB TT compiling exported tt1 : Integer -> Type
;;; *** |TT;tt1;IT;1| REDEFINED Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |testtype| REDEFINED
;;; *** |testtype| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor testtype Time: 0 seconds
finalizing NRLIB TT Processing testtype for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px002.spad-->testtype(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px002.spad-->testtype((tt1 ((Type) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px002.spad-->testtype(): Missing Description ; compiling file "/var/aw/var/LatexWiki/TT.NRLIB/TT.lsp" (written 04 DEC 2024 09:50:32 PM):
; wrote /var/aw/var/LatexWiki/TT.NRLIB/TT.fasl ; compilation finished in 0:00:00.004 ------------------------------------------------------------------------ testtype is already explicitly exposed in frame initial testtype will be automatically loaded when needed from /var/aw/var/LatexWiki/TT.NRLIB/TT
Calling the function like this now works::
FF:=tt1(1)
You have used the abbreviation FF of the constructor FiniteField on the left-hand side of an assignment expression. This is not allowed.
But can we use it?
f:FF:=1.2Same function in SPAD:
Although FiniteField is the name of a constructor,a full type must be specified in the context you have used it. Issue )show FiniteField for more information.
)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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px013.spad using old system compiler. TT abbreviates package testtype ------------------------------------------------------------------------ initializing NRLIB TT for testtype compiling into NRLIB TT compiling exported tt1 : Integer -> Type
;;; *** |TT;tt1;IT;1| REDEFINED Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |testtype| REDEFINED
;;; *** |testtype| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor testtype Time: 0 seconds
finalizing NRLIB TT Processing testtype for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px010.spad-->testtype(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px010.spad-->testtype((tt1 ((Type) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8965653050310018446-25px010.spad-->testtype(): Missing Description ; compiling file "/var/aw/var/LatexWiki/TT.NRLIB/TT.lsp" (written 04 DEC 2024 09:50:32 PM):
; wrote /var/aw/var/LatexWiki/TT.NRLIB/TT.fasl ; compilation finished in 0:00:00.004 ------------------------------------------------------------------------ testtype is already explicitly exposed in frame initial testtype will be automatically loaded when needed from /var/aw/var/LatexWiki/TT.NRLIB/TT
Calling the function like this now works::
TofF:=tt1(1)
(10) |
But can we use it?
f:TofF:=1.2
(11) |