rem: groupby: function(iterable, /* optional */ keyfunc) { /***  Like Python's itertools.groupby  ***/ var m = MochiKit.Base; var self = MochiKit.Iter; if (arguments.length < 2) { keyfunc = m.operator.identity; } iterable = self.iter(iterable);   var pk = undefined; var k = undefined; var v;  function fetch() { v = iterable.next(); k = keyfunc(v); };  function eat() { var ret = v; v = undefined; return ret; };  var first = true; return { repr: function () { return "groupby(...)"; }, next: function() {    while (k == pk) { fetch(); if (first) { first = false; break; } } pk = k; return [k, { next: function() {  if (v == undefined) { fetch(); } if (k != pk) { throw self.StopIteration; } return eat(); } }]; } }; }, 
add: },groupby:function(_171,_172){ var m=MochiKit.Base; var self=MochiKit.Iter; if(arguments.length<2){ _172=m.operator.identity; } _171=self.iter(_171); var pk=undefined; var k=undefined; var v; function fetch(){ v=_171.next(); k=_172(v); } function eat(){ var ret=v; v=undefined; return ret; } var _175=true; return {repr:function(){ return "groupby(...)"; },next:function(){ while(k==pk){ fetch(); if(_175){ _175=false; break; } } pk=k; return [k,{next:function(){ if(v==undefined){ fetch(); } if(k!=pk){ throw self.StopIteration; } return eat(); }}]; }}; },groupby_as_array:function(_176,_177){ 
context:     groupby: function(iterable, /* optional */ keyfunc) {        /***            Like Python's itertools.groupby        ***/        var m = MochiKit.Base;        var self = MochiKit.Iter;        if (arguments.length < 2) {            keyfunc = m.operator.identity;        }        iterable = self.iter(iterable);        // shared        var pk = undefined;        var k = undefined;        var v;        function fetch() {            v = iterable.next();            k = keyfunc(v);        };        function eat() {            var ret = v;            v = undefined;            return ret;        };        var first = true;        return {            repr: function () { return "groupby(...)"; },            next: function() {                // iterator-next                // iterate until meet next group                while (k == pk) {                    fetch();                    if (first) {                        first = false;                        break;                    }                }                pk = k;                return [k, {                    next: function() {                        // subiterator-next                        if (v == undefined) { // Is there something to eat?                            fetch();                        }                        if (k != pk) {                            throw self.StopIteration;                        }                        return eat();                    }                }];            }        };    },
meta: 8607	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8607/ad067b3f5d648d6df90ec6fb2b79f0027612a307/MochiKit.js/buggy/trunk/lib/MochiKit.js