Here is a little job that demonstrates recursion with containers. I used a heavily modified version of this to analyize the way usage data worked.
static void containerRecursion(Args _args)
{
container look = ['ABC', ['1', '2', ['99', '88']], 'ZXY'];
container recurse (container _c)
{
int i;
int len = conLen(_c);
container retVal;
;
while (i < len)
{
i++;
if (typeof(conPeek(_c, i)) != Types::Container)
{
retVal += conPeek(_c, i);
}
else
{
retVal += recurse(conPeek(_c, i));
}
}
return retVal;
}
;
info("Missing values: " + con2str(look));
info("Not missing values: " + con2str(recurse(look)));
}
No comments:
Post a Comment