Hello,
I seem to be unlucky today... Does somebody have an idea why the
following does not work?
As a hint... if I remove "(T: BasicType)" from that program, it
seemingly works.
-- without domain parameter T
(1) -> )co domconst.as
Compiling FriCAS source code from file
/home/hemmecke/GIT/fricas/src/algebra/parint/domconst.as using
AXIOM-XL compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y
$AXIOM/algebra -I $AXIOM/algebra
Use the system command )set compiler args to change these
options.
Compiling Lisp source code from file ./domconst.lsp
Issuing )library command for domconst
Reading /home/hemmecke/GIT/fricas/src/algebra/parint/domconst.asy
(1) -> domainConstant()
(1) - 1
Type: DomainConstant
-- with domain parameter T
(1) -> )co domconst.as
Compiling FriCAS source code from file
/home/hemmecke/GIT/fricas/src/algebra/parint/domconst.as using
AXIOM-XL compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y
$AXIOM/algebra -I $AXIOM/algebra
Use the system command )set compiler args to change these
options.
Compiling Lisp source code from file ./domconst.lsp
Issuing )library command for domconst
Reading /home/hemmecke/GIT/fricas/src/algebra/parint/domconst.asy
...
DomainConstant is now explicitly exposed in frame frame1
DomainConstant will be automatically loaded when needed from
/home/hemmecke/GIT/fricas/src/algebra/parint/domconst
(1) -> Integer has BasicType
(1) true
Type: Boolean
(2) -> D := DomainConstant(Integer)
(2) DomainConstant(Integer)
Type: Domain
(3) -> domainConstant()$D
Internal Error
Unexpected error or improper call to system function matchMmCond :
unknown form of condition
(3) -> )sh D
DomainConstant(Integer) is a domain constructor.
Abbreviation for DomainConstant is DOMAINC
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
coerce : % -> OutputForm domainConstant : () -> %
(3) -> )disp op domainConstant
There is one exposed function called domainConstant :
[1] -> DomainConstant(D1) from DomainConstant(D1) if D1 has BASTYPE
=========================================================
And here the program...
---rhxBEGIN domconst.as
#include "axiom"
DomainConstant(T: BasicType): CoercibleTo(OutputForm) with {
domainConstant: %;
} == add {
Rep == Integer; import from Rep;
domainConstant: % == per (-1);
coerce(x: %): OutputForm == (rep x)::OutputForm;
}
---rhxEND domconst.as
There seems to be some magic that translates
domainConstant: %
into
domainConstant: () -> %
when that Aldor program is run inside FriCAS. Is that really necessary?
A nullary function is mathematically the same as a constant, but in
computer science a function might have side effects (wanted (for example
logging how often the function is called) or unwanted).
Until somebody convinces me otherwise or until SPAD becomes a functional
language, I like the distinction between constants and nullary
functions. Any chance to have true constants in FriCAS with a modest
amount of work?
Ralf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---