Gabriel Dos Reis <[email protected]> writes:
| The algebra is full of examples where things work by a sheer amount of
| luck. Consider the function rightPower in functor MonadWithUnit:
|
| rightPower(a: %,n: NonNegativeInteger) ==
| zero? n => 1
| res := 1
| for i in 1..n repeat res := res * a
| res
|
| What should be the type of constant 1 selected at the assignment
|
| res := 1
|
| and why?
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
There are four candidates in scope:
0: P
0: F
0: NonNegativeInteger
0: Integer
(the right answer is 0@P).
-- 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel