lib/treehugger/traverse.js
function traverseTopDown(fn) {
    var result, i;
    result = fn.call(this);
    if(result)
        return result;
    if (this instanceof tree.ConsNode || this instanceof tree.ListNode) {
        for (i = 0; i < this.length; i++) {
            traverseTopDown.call(this[i], fn);
        }
    }
    return this;
}
function traverseTopDown(fn) {
    var result, i;
    result = fn.call(this);
    if(result)
        return result;
    if (this instanceof tree.ConsNode || this instanceof tree.ListNode) {
        for (i = 0; i < this.length; i++) {
            traverseTopDown.call(this[i], fn);
        }
    }
    return this;
}
function traverseTopDown ( fn ) { var result , i ; result = fn . call ( this ) ; if ( result ) return result ; if ( this instanceof tree . ConsNode || this instanceof tree . ListNode ) { for ( i = 0 ; i < this . length ; i ++ ) { traverseTopDown . call ( this [ i ] , fn ) ; } } return this ; }
A somewhat optimized version of the "clean" topdown traversal
A somewhat optimized version of the clean topdown traversal