Am 25.10.2011 um 02:24 schrieb Bill Page: > 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
My thanks to Gaby as well, that was very enlightening. Although Gaby suspected that I was the originator of the "voodoo", which is not the case. But I got always similar feelings when struggling with the compiler. In the last years I consequently used stong typing "a: A := value" everywhere. So I also would be willing to reorganize the algebra a long this spirit. preferable supported by a compiler with non-Lisp error messages. > 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 <[email protected]> wrote: >> Bill Page <[email protected]> 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. >> > > -- > 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. > Mit freundlichen Grüßen Johannes Grabmeier Prof. Dr. Johannes Grabmeier Köckstraße 1, D-94469 Deggendorf Tel. +49-(0)-991-2979584, Tel. +49-(0)-171-5503789 Tel. +49-(0)-991-3615-100 (d), Fax: +49-(0)-1803-5518-17745 -- 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.
