Discussion:
Bug in Iter.chain
Imri Goldberg
2010-04-01 14:17:16 UTC
Permalink
Here is a firebug log to show the bug, present in mochikit 1.4.2, and
list([1])
[1]
list(chain([1],[2]))
[1, 2]
list(chain([1],[2],[3]))
[1, 2, 3]
*>>> list(chain([],[],[3]))
[]*
list(chain([1],[2],[3]))
[1, 2, 3]
list(chain([],[2],[3]))
[2, 3]
*>>> list(chain([],[],[3]))
[]*
*>>> list(chain([],[],[1]))
[]
list(chain([1],[],[1]))
[1]
list(chain([1,2],[],[1]))
[1, 2]*


To fix the bug, I suggest changing lines 298-300 (in 1.4.2) of next (defined
in chain()) from:
argiter.shift();
var result = argiter[0].next();
return result;
to:
argiter.shift();
continue;

Cheers,
Imri
--
Imri Goldberg
--------------------------------------
http://plnnr.com/ - automatic trip planning
http://www.algorithm.co.il/blogs/
--------------------------------------
-- insert signature here ----
--
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to mochikit+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.
Continue reading on narkive:
Loading...