1 // Generated by LiveScript 1.6.0
2 var each, map, compact, filter, reject, remove, partition, find, head, first, tail, last, initial, empty, reverse, unique, uniqueBy, fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, concat, concatMap, flatten, difference, intersection, union, countBy, groupBy, andList, orList, any, all, sort, sortWith, sortBy, sum, product, mean, average, maximum, minimum, maximumBy, minimumBy, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, at, elemIndex, elemIndices, findIndex, findIndices, toString$ = {}.toString;
3 each = curry$(function(f, xs){
5 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
11 map = curry$(function(f, xs){
12 var i$, len$, x, results$ = [];
13 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
19 compact = function(xs){
20 var i$, len$, x, results$ = [];
21 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
29 filter = curry$(function(f, xs){
30 var i$, len$, x, results$ = [];
31 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
39 reject = curry$(function(f, xs){
40 var i$, len$, x, results$ = [];
41 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
49 remove = curry$(function(el, xs){
51 i = elemIndex(el, xs);
58 partition = curry$(function(f, xs){
59 var passed, failed, i$, len$, x;
62 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
64 (f(x) ? passed : failed).push(x);
66 return [passed, failed];
68 find = curry$(function(f, xs){
70 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
77 head = first = function(xs){
87 return xs[xs.length - 1];
89 initial = function(xs){
93 return xs.slice(0, -1);
98 reverse = function(xs){
99 return xs.concat().reverse();
101 unique = function(xs){
102 var result, i$, len$, x;
104 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
106 if (!in$(x, result)) {
112 uniqueBy = curry$(function(f, xs){
113 var seen, i$, len$, x, val, results$ = [];
115 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
118 if (in$(val, seen)) {
126 fold = foldl = curry$(function(f, memo, xs){
128 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
134 fold1 = foldl1 = curry$(function(f, xs){
135 return fold(f, xs[0], xs.slice(1));
137 foldr = curry$(function(f, memo, xs){
139 for (i$ = xs.length - 1; i$ >= 0; --i$) {
145 foldr1 = curry$(function(f, xs){
146 return foldr(f, xs[xs.length - 1], xs.slice(0, -1));
148 unfoldr = curry$(function(f, b){
152 while ((that = f(x)) != null) {
153 result.push(that[0]);
158 concat = function(xss){
159 return [].concat.apply([], xss);
161 concatMap = curry$(function(f, xs){
163 return [].concat.apply([], (function(){
164 var i$, ref$, len$, results$ = [];
165 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
172 flatten = function(xs){
174 return [].concat.apply([], (function(){
175 var i$, ref$, len$, results$ = [];
176 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
178 if (toString$.call(x).slice(8, -1) === 'Array') {
179 results$.push(flatten(x));
187 difference = function(xs){
188 var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
190 for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
191 res$.push(arguments[i$]);
195 outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
197 for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
207 intersection = function(xs){
208 var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
210 for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
211 res$.push(arguments[i$]);
215 outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
217 for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
228 var xss, res$, i$, to$, results, len$, xs, j$, len1$, x;
230 for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
231 res$.push(arguments[i$]);
235 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
237 for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
239 if (!in$(x, results)) {
246 countBy = curry$(function(f, xs){
247 var results, i$, len$, x, key;
249 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
252 if (key in results) {
260 groupBy = curry$(function(f, xs){
261 var results, i$, len$, x, key;
263 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
266 if (key in results) {
267 results[key].push(x);
274 andList = function(xs){
276 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
284 orList = function(xs){
286 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
294 any = curry$(function(f, xs){
296 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
304 all = curry$(function(f, xs){
306 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
315 return xs.concat().sort(function(x, y){
325 sortWith = curry$(function(f, xs){
326 return xs.concat().sort(f);
328 sortBy = curry$(function(f, xs){
329 return xs.concat().sort(function(x, y){
332 } else if (f(x) < f(y)) {
340 var result, i$, len$, x;
342 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
348 product = function(xs){
349 var result, i$, len$, x;
351 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
357 mean = average = function(xs){
358 var sum, i$, len$, x;
360 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
364 return sum / xs.length;
366 maximum = function(xs){
367 var max, i$, ref$, len$, x;
369 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
377 minimum = function(xs){
378 var min, i$, ref$, len$, x;
380 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
388 maximumBy = curry$(function(f, xs){
389 var max, i$, ref$, len$, x;
391 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
399 minimumBy = curry$(function(f, xs){
400 var min, i$, ref$, len$, x;
402 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
410 scan = scanl = curry$(function(f, memo, xs){
413 return [memo].concat((function(){
414 var i$, ref$, len$, results$ = [];
415 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
417 results$.push(last = f(last, x));
422 scan1 = scanl1 = curry$(function(f, xs){
426 return scan(f, xs[0], xs.slice(1));
428 scanr = curry$(function(f, memo, xs){
429 xs = xs.concat().reverse();
430 return scan(f, memo, xs).reverse();
432 scanr1 = curry$(function(f, xs){
436 xs = xs.concat().reverse();
437 return scan(f, xs[0], xs.slice(1)).reverse();
439 slice = curry$(function(x, y, xs){
440 return xs.slice(x, y);
442 take = curry$(function(n, xs){
444 return xs.slice(0, 0);
446 return xs.slice(0, n);
449 drop = curry$(function(n, xs){
456 splitAt = curry$(function(n, xs){
457 return [take(n, xs), drop(n, xs)];
459 takeWhile = curry$(function(p, xs){
466 while (i < len && p(xs[i])) {
469 return xs.slice(0, i);
471 dropWhile = curry$(function(p, xs){
478 while (i < len && p(xs[i])) {
483 span = curry$(function(p, xs){
484 return [takeWhile(p, xs), dropWhile(p, xs)];
486 breakList = curry$(function(p, xs){
487 return span(compose$(p, not$), xs);
489 zip = curry$(function(xs, ys){
490 var result, len, i$, len$, i, x;
493 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
499 result.push([x, ys[i]]);
503 zipWith = curry$(function(f, xs, ys){
504 var result, len, i$, len$, i, x;
507 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
513 result.push(f(x, ys[i]));
518 var xss, res$, i$, to$, minLength, len$, xs, ref$, i, lresult$, j$, results$ = [];
520 for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
521 res$.push(arguments[i$]);
524 minLength = undefined;
525 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
527 minLength <= (ref$ = xs.length) || (minLength = ref$);
529 for (i$ = 0; i$ < minLength; ++i$) {
532 for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
534 lresult$.push(xs[i]);
536 results$.push(lresult$);
540 zipAllWith = function(f){
541 var xss, res$, i$, to$, minLength, len$, xs, ref$, i, results$ = [];
543 for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
544 res$.push(arguments[i$]);
547 minLength = undefined;
548 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
550 minLength <= (ref$ = xs.length) || (minLength = ref$);
552 for (i$ = 0; i$ < minLength; ++i$) {
554 results$.push(f.apply(null, (fn$())));
558 var i$, ref$, len$, results$ = [];
559 for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) {
561 results$.push(xs[i]);
566 at = curry$(function(n, xs){
568 return xs[xs.length + n];
573 elemIndex = curry$(function(el, xs){
575 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
583 elemIndices = curry$(function(el, xs){
584 var i$, len$, i, x, results$ = [];
585 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
594 findIndex = curry$(function(f, xs){
596 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
604 findIndices = curry$(function(f, xs){
605 var i$, len$, i, x, results$ = [];
606 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
622 partition: partition,
631 difference: difference,
632 intersection: intersection,
657 concatMap: concatMap,
661 maximumBy: maximumBy,
662 minimumBy: minimumBy,
673 takeWhile: takeWhile,
674 dropWhile: dropWhile,
676 breakList: breakList,
680 zipAllWith: zipAllWith,
682 elemIndex: elemIndex,
683 elemIndices: elemIndices,
684 findIndex: findIndex,
685 findIndices: findIndices
687 function curry$(f, bound){
689 _curry = function(args) {
690 return f.length > 1 ? function(){
691 var params = args ? args.concat() : [];
692 context = bound ? context || this : this;
693 return params.push.apply(params, arguments) <
694 f.length && arguments.length ?
695 _curry.call(context, params) : f.apply(context, params);
701 var i = -1, l = xs.length >>> 0;
702 while (++i < l) if (x === xs[i]) return true;
705 function compose$() {
706 var functions = arguments;
709 result = functions[0].apply(this, arguments);
710 for (i = 1; i < functions.length; ++i) {
711 result = functions[i](result);
716 function not$(x){ return !x; }