axiom-developer
[Top][All Lists]

## Re: [Axiom-developer] non extending category

 From: Ralf Hemmecke Subject: Re: [Axiom-developer] non extending category Date: Sun, 12 Feb 2006 01:25:10 +0100 User-agent: Thunderbird 1.5 (X11/20051201)

How can I set an Aldor compiler switch when compiling Aldor code
in Axiom?



)set compiler args "-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y \$AXIOM/algebra -mno-mactext"

(all on one line, of course)


With the original JetBundle.as (why are you removing the empty
lines???)



I am not removing any lines.



Sorry, Bill. I didn't want to offend. I didn't press the EDIT button and just cut'n'pasted from the green area. So that's my fault. Please, forgive me.


I guess you are running Aldor stand alone?



Right. I did not see a reason to start Axiom just to check whether the Aldor compile step works.

> How then do you integrate the compiler output with Axiom?


That was not my main concern. I just tried to compile the code. But for including the results with Axiom... I think Martin Rubey knows and it should be written on the AxiomWiki -- maybe AldorForAxiom or so.


I haven't found a definition for the "SubDomain" constructor that



Like SubsetCategory, SubDomain is apparently a compiler primative.



Hmm, that cannot be true. If I compile just with the Aldor compiler, then the SPAD compiler is not involved. So if the Aldor compiler does not complain, it must find "SubDomain" in libaxiom.al. I am pretty sure that the Aldor compiler does NOT know of "SubDomain" by itself.


In the case of both SubsetCategory and SubDomain, the usage is very
restricted in the Algebra library - they appear almost to be invented
for this one purpose alone.



Yes, and that might be a reason why you will not find "SubDomain" in the libalgebra.al and libaldor.al that is distributed with Aldor.

woodpecker:~/scratch/FRAC>aldor -gloop
%1 >> #include "algebra"
Comp: 1760 msec, Interp: 10 msec
%2 >> SubDomain
^
[L2 C1] #1 (Error) No meaning for identifier SubDomain'.


But I presume that this sort of design has more or less carried over
to Aldor, no? How does one define a sub-domain in Aldor?



There is neither something like PI nor NNI in the Aldor libraries. And till now I did not have any need for them.

But I think you could simply say

Rep == Integer;
...
-- implement the signatures from SomeCategoryForNNI
...
}

NonNegativeInteger: ...
== SubDomain(Integer, #1 >= 0) add ...


So, if I remember correctly, "#1 >=0" is an old way of declaring an anonymous function (without giving the types!!!)

(x: Integer): Boolean +-> x >=0


But what does SubDomain return? And a much more interesting question: how does this work?


If I see Integer, than that is a blackbox for me. I only know the interface, ie, its type or its category.


Now what should SubDomain do? It takes, for example, the implementation of a function *: (%, %) -> % from Integer and returns another implementation that checks whether the input arguments are non-negative and the result is non-negative. If that were not a compiler primitive, I had no idea how that should work on a library level. I think, I would be unable to write the constructor "SubDomain" in a proper .as file. I cannot even guess what its input/output types would be.

I don't like "SubDomain".


Oh, something interesting... After the definition of NNI in integer.spad it reads

{\bf NNI} depends on itself.


That is not at all obvious for my eyes. If Integer would be implemented without referring to NNI (and that can be done), then NNI could be implemented on top of Integer. So why is there a need for a cycle here?


It would be even better to relate the code to the paper but that
is probably too much for the beginning.



Yes, I think this would be a great idea. If/when we get this code
to compile, I think it would make a very good example of a literate
program as a paper. I wonder if we can get the original LaTeX code
for the paper from the author?



I guess it would be hard to convince Werner Seiler to help with writing this literate program? If someone other than him does it then probably still he will get all the fame. I fear that this thought also applies to other pieces of code in Axiom.

Ralf

`