我将Python生成器转换为Google Closure迭代器时遇到的问题很少。
for n,nbrs in nodes_nbrs:
for nbr,data in nbrs.items():
yield (n, nbr, data)
我跟随并坚持下去
var nodeNbrs = map(this.adj.getKeyIterator(), function(n) {
return [n, this.adj.get(n)]
});
var iter = new Iterator;
iter.next = function() {
// what do I do?
};
答案 0 :(得分:0)
在彼此内部使用两个goog.structs.foreach
http://closure-library.googlecode.com/svn/docs/closure_goog_structs_structs.js.html