I have a local macro called peer_list
that contains 280 distinct elements, all of which are strings. I also have another local macro called used_list
that contains a subset of the elements contained in the local peer_list
.
For each element in peer_list
I would like to test whether that element is in the local used_list
. If the element exists in used_list
I would like to discard it, otherwise I would like to execute another set of conditions.
I have tried to use the following code but it hasn't worked:
foreach peer in local peer_list {
if `:list peer in local used_list' {
* commands I wish to execute
}
else {
* commands I wish to execute
}
}
I would appreciate any advice on alternative ways of accomplishing this.
You don't say in what sense your code "hasn't worked" and you don't provide a reproducible example. Nevertheless you appear to be working along the right lines.
A common bug with similar code is to define and use local macros in different locales so that they cannot see each other.
A more obvious bug is that you need the keyword
of
notin
. What you have is legal, but not what you want. Compare