Claude Quitte wrote in his e-mail message of 1995/11/30
I have a warning using the construction x -> f(x, i) where i is the
parameter of a loop. It seems that G.A.P. builds a function with two
parameters x, i and says "i undefined global variable" (it's only a
warning).A := [12, 56, 45, 2, 76, 11, 7] ; for i in [0..2] do Print(" elemts = ", i, " mod 3 : ", Filtered(A, x -> RemInt(x, 3) = i), "\n") ; od ;
GAP emits a warning if the body of a function (in this example the body
is 'RemInt(x,3) = i') contains reference to a global variable (in this
example 'i'), which at the time the function is *read* does not have an
assigned value. And since the entire loop is read before iterating
starts, you get the warning. To suppress the warning, simply assign a
value to 'i'.
A := [12, 56, 45, 2, 76, 11, 7] ; i := "shut up"; for i in [0..2] do Print(" elemts = ", i, " mod 3 : ", Filtered(A, x -> RemInt(x, 3) = i), "\n") ; od ;
Kindly,
Martin.
-- .- .-. - .. -. .-.. --- ...- . ... .- -. -. .. -.- .- Martin Sch"onert, Martin.Schoenert@Math.RWTH-Aachen.DE, +49 241 804551 Lehrstuhl D f"ur Mathematik, Templergraben 64, RWTH, 52056 Aachen, Germany