Gaby, Thank you for this work. The error message reminds me of a wish: I would really like it if the compiler could pretty print the code that it displays. Reading the lisp notation is still awkward for me years later and I know that it puts off some potential new users. Even if de-compiling
> (IF (= |a| 0) > |b| > (IF (= |b| 0) > |a| > (SEQ (|:=| |b0| |b|) (|:=| |u| ((|elt| P |monomial|) 1 0)) (|:=| |v| 0) > (REPEAT (WHILE (~= (|leadingCoefficient| |b|) 0)) > ... results is something a little different than the original source, I think it is very desirable that it at least be readable SPAD code. I would be glad to try to help solve some problem cases in the algebra. If it would be useful just let me know. Regards, Bill Page. On Mon, Oct 24, 2011 at 8:09 PM, Gabriel Dos Reis <g...@cs.tamu.edu> wrote: > Bill Page <bill.p...@newsynthesis.org> writes: > > | On Mon, Oct 24, 2011 at 7:36 PM, Gabriel Dos Reis wrote: > | > ... > | > Bill Page writes: > | > | So it is a coincidence that the compiler happens to choose 0@P or that > | > | the representation of all of these candidates is the same so that it > | > | does not matter? > | > > | > It is mostly concidence. The explanation is that the type of leftLcm is > | > > | > > | > (P,P) -> P > | > > | > and before starting the compilation of a function body, the compiler > | > automatically imports the return type and domain of each parameter. > | > So the modemap of 0@P happens to be first on the list, and since the > | > compilers the first that makes tentative compilation OK, it picks it and > | > moves on. > | > > | > | So here it seems very clear that one should have written: > | > | v:P := 0 > | > | and the use of > | > | v := 0 > | > | should produce an error message. I retrospect I think I have probably > | been bitten by this bug a few times in the past. One just seems to get > | used to working around such limitations. But this seems like an > | improvement to me even if it does affect a lot of existing code that > | happens to work right now. A sensible error message would be welcome. > | Would this be hard to do? > > 1. The error message I have is: > > > compiling exported leftLcm : (P,P) -> P > ****** comp fails at level 5 with expression: ****** > error in function leftLcm > > (IF (= |a| 0) > |b| > (IF (= |b| 0) > |a| > (SEQ (|:=| |b0| |b|) (|:=| |u| ((|elt| P |monomial|) 1 0)) (|:=| |v| 0) > (REPEAT (WHILE (~= (|leadingCoefficient| |b|) 0)) > (SEQ (|:=| |qr| (|leftDivide| |a| |b|)) > (|:=| (|%Comma| |a| |b|) > (|%Comma| |b| (|qr| |remainder|))) > (|exit| 1 > (|:=| (|%Comma| |u| |v|) > (|%Comma| (+ (* |u| (|qr| |quotient|)) |v|) > |u|))))) > (|exit| 1 (* |b0| |u|))))) > ****** level 5 ****** > $x:= (Zero) > $m:= $EmptyMode > $f:= > ((((|u| #) (|b0| #) (|b| # #) (|a| # #) ...))) > > >> Apparent user error: > Ambiguous constant 0 in ? constext. Candidates are > 0: P > 0: F > 0: NonNegativeInteger > 0: Integer > > > > 2. In fact, I don't have to change that many existing codes. However, > for a few cases, it takes a while to figure out what the right answer > should be. Which convinces me that the tightening is the right thing to do. > So far, I've posted mostly the easier ones. > ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel