|
From: <pj...@in...> - 2010-10-15 20:24:52
|
don...@is... (Don Cohen) writes: > > You realize that the reference to b in the progn is dead code. So it's > > eliminated, So b is not referenced anymore. > Yes, but it used to at least be a useful way to avoid the warnings. > > > Unfortunately, in loop, there's no place for declarations about loop's > > variables. The loop macro itself could have an ignorable declaration > > for them but I don't remember if that would be conformant, and it would > > be questionnable anyways: the warning is good: did you really not make a > > typo? > In all of the cases involved there was no typo. > I ended up rewriting things like > (loop for x in a collect 'input) > to > (loop for x below (length a) collect 'input) > I still have code like > (loop for (x y z) in a collect y) > I really don't like to use nil there but I could. > > > > I was even getting "not read" warnings from my loop extension in > > > cases like this > > > (loop for (a b) s.t. (r a b) collect a) > > Too bad you don't say what s.t. is... > such that > in general > (loop for [variable list] s.t. [well formed formula] ...) > see ap5.com for more detail Ok. Well, without looking at the source of the implementation of s.t. it should be noted that in general loops may provide the variables as a new binding in each loop iteration, in which case even if you use it in the wff, the one you get in the body will be a new binding, and this is probably that one that is not used. In this case indeed, you cannot use nil, so you must use the variable. Perhaps like this: (loop for (a b) s.t. (r a b) collect (let ((b b)) (declare (ignore b)) a)) -- __Pascal Bourguignon__ http://www.informatimago.com/ |