Bill Page <bill.p...@newsynthesis.org> writes: | On Mon, Oct 24, 2011 at 6:49 PM, Gabriel Dos Reis wrote: | > ... | > Another example: Consider the function leftLcm from | > NonCommutativeOperatorDivision(P,F) where | > P: MonogenicLinearOperator(F) | > F: Field | > | > the function definition is: | > | > leftLcm(a,b) == | > a = 0 =>b | > b = 0 =>a | > b0 := b | > u := monomial(1,0)$P | > v := 0 | > while leadingCoefficient b ~= 0 repeat | > qr := leftDivide(a,b) | > (a, b) := (b, qr.remainder) | > (u, v) := (u*qr.quotient+v, u) | > b0*u | > | > | > The problem is the definition of the local variable v: | > | > v := 0 | > | | I like this example, although now I believe also your first example. | | > There are four candidates in scope: | > | > 0: P | > 0: F | > 0: NonNegativeInteger | > 0: Integer | > | > (the right answer is 0@P). | > | | 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. -- Gaby ------------------------------------------------------------------------------ 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