1 // Generated by LiveScript 1.4.0
2 var each, map, compact, filter, reject, 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, slice$ = [].slice;
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 partition = curry$(function(f, xs){
50 var passed, failed, i$, len$, x;
53 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
55 (f(x) ? passed : failed).push(x);
57 return [passed, failed];
59 find = curry$(function(f, xs){
61 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
68 head = first = function(xs){
78 return xs[xs.length - 1];
80 initial = function(xs){
84 return xs.slice(0, -1);
89 reverse = function(xs){
90 return xs.concat().reverse();
92 unique = function(xs){
93 var result, i$, len$, x;
95 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
97 if (!in$(x, result)) {
103 uniqueBy = curry$(function(f, xs){
104 var seen, i$, len$, x, val, results$ = [];
106 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
109 if (in$(val, seen)) {
117 fold = foldl = curry$(function(f, memo, xs){
119 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
125 fold1 = foldl1 = curry$(function(f, xs){
126 return fold(f, xs[0], xs.slice(1));
128 foldr = curry$(function(f, memo, xs){
130 for (i$ = xs.length - 1; i$ >= 0; --i$) {
136 foldr1 = curry$(function(f, xs){
137 return foldr(f, xs[xs.length - 1], xs.slice(0, -1));
139 unfoldr = curry$(function(f, b){
143 while ((that = f(x)) != null) {
144 result.push(that[0]);
149 concat = function(xss){
150 return [].concat.apply([], xss);
152 concatMap = curry$(function(f, xs){
154 return [].concat.apply([], (function(){
155 var i$, ref$, len$, results$ = [];
156 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
163 flatten = function(xs){
165 return [].concat.apply([], (function(){
166 var i$, ref$, len$, results$ = [];
167 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
169 if (toString$.call(x).slice(8, -1) === 'Array') {
170 results$.push(flatten(x));
178 difference = function(xs){
179 var yss, results, i$, len$, x, j$, len1$, ys;
180 yss = slice$.call(arguments, 1);
182 outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
184 for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
194 intersection = function(xs){
195 var yss, results, i$, len$, x, j$, len1$, ys;
196 yss = slice$.call(arguments, 1);
198 outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
200 for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
211 var xss, results, i$, len$, xs, j$, len1$, x;
212 xss = slice$.call(arguments);
214 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
216 for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
218 if (!in$(x, results)) {
225 countBy = curry$(function(f, xs){
226 var results, i$, len$, x, key;
228 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
231 if (key in results) {
239 groupBy = curry$(function(f, xs){
240 var results, i$, len$, x, key;
242 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
245 if (key in results) {
246 results[key].push(x);
253 andList = function(xs){
255 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
263 orList = function(xs){
265 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
273 any = curry$(function(f, xs){
275 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
283 all = curry$(function(f, xs){
285 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
294 return xs.concat().sort(function(x, y){
304 sortWith = curry$(function(f, xs){
305 return xs.concat().sort(f);
307 sortBy = curry$(function(f, xs){
308 return xs.concat().sort(function(x, y){
311 } else if (f(x) < f(y)) {
319 var result, i$, len$, x;
321 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
327 product = function(xs){
328 var result, i$, len$, x;
330 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
336 mean = average = function(xs){
337 var sum, i$, len$, x;
339 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
343 return sum / xs.length;
345 maximum = function(xs){
346 var max, i$, ref$, len$, x;
348 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
356 minimum = function(xs){
357 var min, i$, ref$, len$, x;
359 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
367 maximumBy = curry$(function(f, xs){
368 var max, i$, ref$, len$, x;
370 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
378 minimumBy = curry$(function(f, xs){
379 var min, i$, ref$, len$, x;
381 for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
389 scan = scanl = curry$(function(f, memo, xs){
392 return [memo].concat((function(){
393 var i$, ref$, len$, results$ = [];
394 for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
396 results$.push(last = f(last, x));
401 scan1 = scanl1 = curry$(function(f, xs){
405 return scan(f, xs[0], xs.slice(1));
407 scanr = curry$(function(f, memo, xs){
408 xs = xs.concat().reverse();
409 return scan(f, memo, xs).reverse();
411 scanr1 = curry$(function(f, xs){
415 xs = xs.concat().reverse();
416 return scan(f, xs[0], xs.slice(1)).reverse();
418 slice = curry$(function(x, y, xs){
419 return xs.slice(x, y);
421 take = curry$(function(n, xs){
423 return xs.slice(0, 0);
425 return xs.slice(0, n);
428 drop = curry$(function(n, xs){
435 splitAt = curry$(function(n, xs){
436 return [take(n, xs), drop(n, xs)];
438 takeWhile = curry$(function(p, xs){
445 while (i < len && p(xs[i])) {
448 return xs.slice(0, i);
450 dropWhile = curry$(function(p, xs){
457 while (i < len && p(xs[i])) {
462 span = curry$(function(p, xs){
463 return [takeWhile(p, xs), dropWhile(p, xs)];
465 breakList = curry$(function(p, xs){
466 return span(compose$(p, not$), xs);
468 zip = curry$(function(xs, ys){
469 var result, len, i$, len$, i, x;
472 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
478 result.push([x, ys[i]]);
482 zipWith = curry$(function(f, xs, ys){
483 var result, len, i$, len$, i, x;
486 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
492 result.push(f(x, ys[i]));
497 var xss, minLength, i$, len$, xs, ref$, i, lresult$, j$, results$ = [];
498 xss = slice$.call(arguments);
499 minLength = undefined;
500 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
502 minLength <= (ref$ = xs.length) || (minLength = ref$);
504 for (i$ = 0; i$ < minLength; ++i$) {
507 for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
509 lresult$.push(xs[i]);
511 results$.push(lresult$);
515 zipAllWith = function(f){
516 var xss, minLength, i$, len$, xs, ref$, i, results$ = [];
517 xss = slice$.call(arguments, 1);
518 minLength = undefined;
519 for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
521 minLength <= (ref$ = xs.length) || (minLength = ref$);
523 for (i$ = 0; i$ < minLength; ++i$) {
525 results$.push(f.apply(null, (fn$())));
529 var i$, ref$, len$, results$ = [];
530 for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) {
532 results$.push(xs[i]);
537 at = curry$(function(n, xs){
539 return xs[xs.length + n];
544 elemIndex = curry$(function(el, xs){
546 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
554 elemIndices = curry$(function(el, xs){
555 var i$, len$, i, x, results$ = [];
556 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
565 findIndex = curry$(function(f, xs){
567 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
575 findIndices = curry$(function(f, xs){
576 var i$, len$, i, x, results$ = [];
577 for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
592 partition: partition,
601 difference: difference,
602 intersection: intersection,
627 concatMap: concatMap,
631 maximumBy: maximumBy,
632 minimumBy: minimumBy,
643 takeWhile: takeWhile,
644 dropWhile: dropWhile,
646 breakList: breakList,
650 zipAllWith: zipAllWith,
652 elemIndex: elemIndex,
653 elemIndices: elemIndices,
654 findIndex: findIndex,
655 findIndices: findIndices
657 function curry$(f, bound){
659 _curry = function(args) {
660 return f.length > 1 ? function(){
661 var params = args ? args.concat() : [];
662 context = bound ? context || this : this;
663 return params.push.apply(params, arguments) <
664 f.length && arguments.length ?
665 _curry.call(context, params) : f.apply(context, params);
671 var i = -1, l = xs.length >>> 0;
672 while (++i < l) if (x === xs[i]) return true;
675 function compose$() {
676 var functions = arguments;
679 result = functions[0].apply(this, arguments);
680 for (i = 1; i < functions.length; ++i) {
681 result = functions[i](result);
686 function not$(x){ return !x; }