jashkenas--coffeescript/documentation/js/range_comprehensions.js

19 lines
476 B
JavaScript
Raw Normal View History

2010-09-22 03:58:05 +00:00
var _result, countdown, deliverEggs, num;
2010-07-29 04:51:35 +00:00
countdown = (function() {
2010-09-22 03:58:05 +00:00
_result = [];
2010-07-29 04:51:35 +00:00
for (num = 10; num >= 1; num--) {
2010-09-22 03:58:05 +00:00
_result.push(num);
2010-07-29 04:51:35 +00:00
}
2010-09-22 03:58:05 +00:00
return _result;
2010-02-24 23:27:10 +00:00
})();
2010-07-29 04:51:35 +00:00
deliverEggs = function() {
2010-09-22 03:58:05 +00:00
var _ref, _result2, dozen, i;
_result2 = []; _ref = eggs.length;
for (i = 0; (0 <= _ref ? i < _ref : i > _ref); i += 12) {
_result2.push((function() {
2010-07-29 04:51:35 +00:00
dozen = eggs.slice(i, i + 12);
return deliver(new eggCarton(dozen));
})());
}
2010-09-22 03:58:05 +00:00
return _result2;
2010-07-29 04:51:35 +00:00
};