On Sat, Nov 12, 2011 at 10:06:23PM +0100, Ralf Hemmecke wrote:
> Instead of answering your questions in detail, how do you want to access  
> the axiom library?
>
> Suppose set something up where the axiom lib is compiled to haskell  
> virtual machine code (i.e. runs on HM if I understood you correctly).
> With some effort that should be possible, but it would still be unclear  
> how to actually call functions from the library.

Convert the needed domain description to the Lisp data which expresses 
this domain in Axiom. To write this interface, one needs to know, for 
example, how a prime field  k  is represented as a Lisp data in Axiom,
how it is represented a polynomial over this  k,  and so on.
It looks difficult, I do not know ...


> But suppose even that has been done somehow. Then there is the problem  
> of "destructive functions", i.e. functions like
>
>   setelt!(a, 5, 1)
>
> which set the 5th element of (an array) a to 1. The axiom library is  
> non-functional in quite some places. If you connect it to Haskell, you  
> surely want to put a wrapper around it so that it will look functional.

I am sorry for being so light-headed.
I thought the Axiom library is compiled to Common Lisp. And I have 
heard, Common Lisp is functional. But now, I see a contradiction:
I know that Spad is not functional. For example, in what Lisp code  
setelt!(a, 5, 1)  is compiled?


> What was also mentioned by Waldek was that some types are not  
> representable in Haskell (just think of dependent types). How should the  
> connection be done in this case?

DoCon is written in Haskell, its data (matrices, polynomials etc.) need
to convert to their Lisp representation in Axiom, which may belong to
dependent types. I suspect, this can be done in both directions. 
Because DoCon somehow mimics dependent types by using so-called 
sample elements. May be, I'll write later about this.


> Furthermore, if you don't translate code from SPAD to Haskell, but  
> rather have only running them on the same virtual machine, you still  
> have the problem that bugfixes and improvements have to be written in 
> SPAD.

I somehow need to suppose that the Axiom library has not bugs (?).
Suppose, for simplicity, that we use the  AxiLisp interpreter 
written in Haskell -- the function  interpAxi.
A Haskell program can be traced to each point where it applies 
interpAxi.


> Personally, I tend to believe that quite a lot of mathematical code  
> should be written in a functional setup. One wouldn't have to think  
> about side effects and such. But I somehow don't believe that functional  
> code shoule be the only way. In fact, there must have been a reason why  
> Haskell abstracted every side effecting code into Monads.

>From AxiLibLisp we need only the functions which do not use input/output
(for example, polynomial factorization, solving a system ...).

> So in some sense I'd like SPAD to be similar to Haskell, i.e. there  
> should be some nice way of asserting that a certain function has no side  
> effect. Maybe one could do this by restricting on a functional  
> sublanguage of SPAD so that "asserting" would just mean just "using only  
> constructs from that sublanguage", and thus the compiler could figure  
> out whether the function has side effects or not.
>
> OK... I already started dreaming... ;-)


Please, rewrite Axiom in a functional subset!  :-)

Well, I was light-minded, the thing is more problematic, than it first 
looked to me.
Thanks for your notes,

------
Sergei


-- 
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.

Reply via email to