Message from JavaScript talks

May 2017

— I see

— 

Its like this:
curNode = stack.pop():
// iterating "i"
if (isContainer(curNode[i])) {
stack.push(curNode[i]);
}
// loop repeats

— Well, not quite

— Theres multiple loops so its hard to write psuedocode for

— That seems like df

— I see

— There is a main while loop which contains that stack pop which sets the current node, then a for in loop inside it which iterates

Message permanent page

— The main while loop constitutes traversal while the inner for in loop is the iteration. All the properties are iterated before traversing the next nodes

Message permanent page

— So if a node has multiple child nodes like 3, they all get added to the stack in one go, then traversed in opposite order, ie discovered as 123 and traversed as 321

Message permanent page

— I see, the algorithm part of wikipedia article is very clear

— The wikipedia one is not stack safe and its not what I coded, but its close. I used metacomposition instead of recursion

Message permanent page

— Same behavior