prelude-ls
Advanced tools
| // prelude.ls 0.6.0 | ||
| // Copyright (c) 2012 George Zahariev | ||
| // Released under the MIT License | ||
| // raw.github.com/gkz/prelude-ls/master/LICNSE | ||
| this.prelude=function(){function Gt(e,t){return e.length>1?function(){var n=t?t.concat():[];return n.push.apply(n,arguments)<e.length&&arguments.length?Gt.call(this,e,n):e.apply(this,n)}:e}function Yt(e,t){var n=0,r=t.length>>>0;while(n<r)if(e===t[n++])return!0;return!1}function Zt(e){return function(){var t,n=arguments;for(t=e.length;t>0;--t)n=[e[t-1].apply(this,n)];return n[0]}}function en(e){return!e}function tn(e,t){var n={}.hasOwnProperty;for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}exports={};var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt,ct,ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,St,xt,Tt,Nt,Ct,kt,Lt,At,Ot,Mt,_t,Dt,Pt,Ht,Bt,jt,Ft,It,qt,Rt,Ut,zt,Wt,Xt,Vt,$t,Jt,Kt={}.toString,Qt=[].slice;return exports.objToFunc=e=function(e){return function(t){return e[t]}},exports.each=t=Gt(function(e,t){var n,r,i;if(Kt.call(t).slice(8,-1)==="Object")for(n in t)r=t[n],e(r);else for(n=0,i=t.length;n<i;++n)r=t[n],e(r);return t}),exports.map=n=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],l[i]=t(s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],o.push(t(s));return f=o,r==="String"?f.join(""):f}),exports.filter=r=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],t(s)&&(l[i]=s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],t(s)&&o.push(s);return f=o,r==="String"?f.join(""):f}),exports.reject=i=Gt(function(t,n){var r,i,s,o,u,a,f,l={};Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){for(i in n)s=n[i],t(s)||(l[i]=s);return l}o=[];for(u=0,a=n.length;u<a;++u)s=n[u],t(s)||o.push(s);return f=o,r==="String"?f.join(""):f}),exports.partition=s=Gt(function(t,n){var r,i,s,o,u,a,f;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=Kt.call(n).slice(8,-1);if(r==="Object"){i={},s={};for(o in n)u=n[o],(t(u)?i:s)[o]=u}else{i=[],s=[];for(a=0,f=n.length;a<f;++a)u=n[a],(t(u)?i:s).push(u);r==="String"&&(i=i.join(""),s=s.join(""))}return[i,s]}),exports.find=o=Gt(function(t,n){var r,i,s;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(Kt.call(n).slice(8,-1)==="Object")for(r in n){i=n[r];if(t(i))return i}else for(r=0,s=n.length;r<s;++r){i=n[r];if(t(i))return i}}),exports.head=a=exports.first=u=function(e){if(!e.length)return;return e[0]},exports.tail=f=function(e){if(!e.length)return;return e.slice(1)},exports.last=l=function(e){if(!e.length)return;return e[e.length-1]},exports.initial=c=function(e){if(!e.length)return;return e.slice(0,e.length-1)},exports.empty=h=function(e){var t;if(Kt.call(e).slice(8,-1)==="Object"){for(t in e)return!1;return!0}return!e.length},exports.values=p=function(e){var t,n,r=[];for(t in e)n=e[t],r.push(n);return r},exports.keys=d=function(e){var t,n=[];for(t in e)n.push(t);return n},exports.length=v=function(e){return Kt.call(e).slice(8,-1)==="Object"&&(e=p(e)),e.length},exports.cons=m=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="String"?e+t:[e].concat(t)}),exports.append=g=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="String"?e+t:e.concat(t)}),exports.join=y=Gt(function(e,t){return Kt.call(t).slice(8,-1)==="Object"&&(t=p(t)),t.join(e)}),exports.reverse=b=function(e){return Kt.call(e).slice(8,-1)==="String"?e.split("").reverse().join(""):e.slice().reverse()},exports.fold=E=exports.foldl=w=Gt(function(e,t,n){var r,i,s;if(Kt.call(n).slice(8,-1)==="Object")for(r in n)i=n[r],t=e(t,i);else for(r=0,s=n.length;r<s;++r)i=n[r],t=e(t,i);return t}),exports.fold1=x=exports.foldl1=S=Gt(function(e,t){return E(e,t[0],t.slice(1))}),exports.foldr=T=Gt(function(e,t,n){return E(e,t,n.reverse())}),exports.foldr1=N=Gt(function(e,t){return t.reverse(),E(e,t[0],t.slice(1))}),exports.unfoldr=exports.unfold=C=Gt(function(e,t){var n;return(n=e(t))!=null?[n[0]].concat(C(e,n[1])):[]}),exports.andList=k=function(e){return E(function(e,t){return e&&t},!0,e)},exports.orList=L=function(e){return E(function(e,t){return e||t},!1,e)},exports.any=A=Gt(function(t,n){return Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),E(function(e,n){return e||t(n)},!1,n)}),exports.all=O=Gt(function(t,n){return Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),E(function(e,n){return e&&t(n)},!0,n)}),exports.unique=M=function(e){var t,n,r,i;t=[];if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],Yt(r,t)||t.push(r);else for(n=0,i=e.length;n<i;++n)r=e[n],Yt(r,t)||t.push(r);return Kt.call(e).slice(8,-1)==="String"?t.join(""):t},exports.sort=_=function(e){return e.concat().sort(function(e,t){switch(!1){case!(e>t):return 1;case!(e<t):return-1;default:return 0}})},exports.sortBy=D=Gt(function(e,t){return t.length?t.concat().sort(e):[]}),exports.compare=P=Gt(function(e,t,n){switch(!1){case!(e(t)>e(n)):return 1;case!(e(t)<e(n)):return-1;default:return 0}}),exports.sum=H=function(e){var t,n,r,i;t=0;if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],t+=r;else for(n=0,i=e.length;n<i;++n)r=e[n],t+=r;return t},exports.product=B=function(e){var t,n,r,i;t=1;if(Kt.call(e).slice(8,-1)==="Object")for(n in e)r=e[n],t*=r;else for(n=0,i=e.length;n<i;++n)r=e[n],t*=r;return t},exports.mean=F=exports.average=j=function(e){return H(e)/v(e)},exports.concat=I=function(e){return E(g,[],e)},exports.concatMap=q=Gt(function(e,t){return I(n(e,t))}),exports.listToObj=R=function(e){var t,n,r,i;t={};for(n=0,r=e.length;n<r;++n)i=e[n],t[i[0]]=i[1];return t},exports.maximum=U=function(e){return x(gt,e)},exports.minimum=z=function(e){return x(yt,e)},exports.scan=X=exports.scanl=W=Gt(function(e,t,n){var r,i;return r=t,Kt.call(n).slice(8,-1)==="Object"?[t].concat(function(){var t,s,o=[];for(t in s=n)i=s[t],o.push(r=e(r,i));return o}()):[t].concat(function(){var t,s,o,u=[];for(t=0,o=(s=n).length;t<o;++t)i=s[t],u.push(r=e(r,i));return u}())}),exports.scan1=$=exports.scanl1=V=Gt(function(e,t){return X(e,t[0],t.slice(1))}),exports.scanr=J=Gt(function(e,t,n){return n.reverse(),X(e,t,n).reverse()}),exports.scanr1=K=Gt(function(e,t){return t.reverse(),X(e,t[0],t.slice(1)).reverse()}),exports.replicate=Q=Gt(function(e,t){var n,r;n=[],r=0;for(;r<e;++r)n.push(t);return n}),exports.take=G=Gt(function(e,t){switch(!1){case!(e<=0):return Kt.call(t).slice(8,-1)==="String"?"":[];case!!t.length:return t;default:return t.slice(0,e)}}),exports.drop=Y=Gt(function(e,t){switch(!1){case!(e<=0):return t;case!!t.length:return t;default:return t.slice(e)}}),exports.splitAt=Z=Gt(function(e,t){return[G(e,t),Y(e,t)]}),exports.takeWhile=et=Gt(function(t,n){var r,i,s,o;if(!n.length)return n;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=[];for(i=0,s=n.length;i<s;++i){o=n[i];if(!t(o))break;r.push(o)}return Kt.call(n).slice(8,-1)==="String"?r.join(""):r}),exports.dropWhile=tt=Gt(function(t,n){var r,i,s,o;if(!n.length)return n;Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t)),r=0;for(i=0,s=n.length;i<s;++i){o=n[i];if(!t(o))break;++r}return Y(r,n)}),exports.span=nt=Gt(function(e,t){return[et(e,t),tt(e,t)]}),exports.breakIt=rt=Gt(function(e,t){return nt(Zt([en,e]),t)}),exports.zip=it=Gt(function(e,t){var n,r,i,s,o,u,a,f,l;n=[];for(r=0,s=(i=[e,t]).length;r<s;++r){o=i[r];for(u=0,a=o.length;u<a;++u)f=o[u],r===0&&n.push([]),(l=n[u])!=null&&l.push(f)}return n}),exports.zipWith=st=Gt(function(t,n,r){var i,s,o,u,a=[];Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(!n.length||!r.length)return[];for(i=0,o=(s=it.call(this,n,r)).length;i<o;++i)u=s[i],a.push(t.apply(this,u));return a}),exports.zipAll=ot=function(){var e,t,n,r,i,s,o,u,a;e=Qt.call(arguments),t=[];for(n=0,r=e.length;n<r;++n){i=e[n];for(s=0,o=i.length;s<o;++s)u=i[s],n===0&&t.push([]),(a=t[s])!=null&&a.push(u)}return t},exports.zipAllWith=ut=function(t){var n,r,i,s,o,u=[];n=Qt.call(arguments,1),Kt.call(t).slice(8,-1)!=="Function"&&(t=e(t));if(!n[0].length||!n[1].length)return[];for(r=0,s=(i=ot.apply(this,n)).length;r<s;++r)o=i[r],u.push(t.apply(this,o));return u},exports.compose=at=function(){var e;return e=Qt.call(arguments),function(){var t,n,r,i,s;t=arguments;for(n=0,i=(r=e).length;n<i;++n)s=r[n],t=[s.apply(this,t)];return t[0]}},exports.curry=ft=function(e){return Gt(e)},exports.id=lt=function(e){return e},exports.flip=ct=Gt(function(e,t,n){return e(n,t)}),exports.fix=ht=function(e){return function(t,n){return function(){return e(t(t)).apply(null,arguments)}}(function(t,n){return function(){return e(t(t)).apply(null,arguments)}})},exports.lines=pt=function(e){return e.length?e.split("\n"):[]},exports.unlines=dt=function(e){return e.join("\n")},exports.words=vt=function(e){return e.length?e.split(/[ ]+/):[]},exports.unwords=mt=function(e){return e.join(" ")},exports.max=gt=Gt(function(e,t){return e>t?e:t}),exports.min=yt=Gt(function(e,t){return e>t?t:e}),exports.negate=bt=function(e){return-e},exports.abs=wt=Math.abs,exports.signum=Et=function(e){switch(!1){case!(e<0):return-1;case!(e>0):return 1;default:return 0}},exports.quot=St=Gt(function(e,t){return~~(e/t)}),exports.rem=xt=Gt(function(e,t){return e%t}),exports.div=Tt=Gt(function(e,t){return Math.floor(e/t)}),exports.mod=Nt=Gt(function(e,t){var n;return(e%(n=t)+n)%n}),exports.recip=Ct=function(e){return 1/e},exports.pi=kt=Math.PI,exports.tau=Lt=kt*2,exports.exp=At=Math.exp,exports.sqrt=Ot=Math.sqrt,exports.ln=Mt=Math.log,exports.pow=_t=Gt(function(e,t){return Math.pow(e,t)}),exports.sin=Dt=Math.sin,exports.tan=Pt=Math.tan,exports.cos=Ht=Math.cos,exports.asin=Bt=Math.asin,exports.acos=jt=Math.acos,exports.atan=Ft=Math.atan,exports.atan2=It=Gt(function(e,t){return Math.atan2(e,t)}),exports.truncate=qt=function(e){return~~e},exports.round=Rt=Math.round,exports.ceiling=Ut=Math.ceil,exports.floor=zt=Math.floor,exports.isItNaN=Wt=function(e){return e!==e},exports.even=Xt=function(e){return e%2===0},exports.odd=Vt=function(e){return e%2!==0},exports.gcd=$t=Gt(function(e,t){var n;e=Math.abs(e),t=Math.abs(t);while(t!==0)n=e%t,e=t,t=n;return e}),exports.lcm=Jt=Gt(function(e,t){return Math.abs(Math.floor(e/$t(e,t)*t))}),exports.installPrelude=function(e){var t;if((t=e.prelude)==null||!t.isInstalled)tn(e,exports),e.prelude.isInstalled=!0},exports.prelude=exports,exports}() |
| // prelude.ls 0.6.0 | ||
| // Copyright (c) 2012 George Zahariev | ||
| // Released under the MIT License | ||
| // raw.github.com/gkz/prelude-ls/master/LICNSE | ||
| this.prelude = function(){ | ||
| exports = {}; | ||
| var objToFunc, each, map, filter, reject, partition, find, first, head, tail, last, initial, empty, values, keys, length, cons, append, join, reverse, foldl, fold, foldl1, fold1, foldr, foldr1, unfoldr, andList, orList, any, all, unique, sort, sortBy, compare, sum, product, average, mean, concat, concatMap, listToObj, maximum, minimum, scanl, scan, scanl1, scan1, scanr, scanr1, replicate, take, drop, splitAt, takeWhile, dropWhile, span, breakIt, zip, zipWith, zipAll, zipAllWith, compose, curry, id, flip, fix, lines, unlines, words, unwords, max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm, toString$ = {}.toString, slice$ = [].slice; | ||
| exports.objToFunc = objToFunc = function(obj){ | ||
| return function(key){ | ||
| return obj[key]; | ||
| }; | ||
| }; | ||
| exports.each = each = curry$(function(f, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| f(x); | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| f(x); | ||
| } | ||
| } | ||
| return xs; | ||
| }); | ||
| exports.map = map = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
| for (key in xs) { | ||
| x = xs[key]; | ||
| results$[key] = f(x); | ||
| } | ||
| return results$; | ||
| } else { | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| res$.push(f(x)); | ||
| } | ||
| result = res$; | ||
| if (type === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| } | ||
| }); | ||
| exports.filter = filter = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
| for (key in xs) { | ||
| x = xs[key]; | ||
| if (f(x)) { | ||
| results$[key] = x; | ||
| } | ||
| } | ||
| return results$; | ||
| } else { | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
| res$.push(x); | ||
| } | ||
| } | ||
| result = res$; | ||
| if (type === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| } | ||
| }); | ||
| exports.reject = reject = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
| for (key in xs) { | ||
| x = xs[key]; | ||
| if (!f(x)) { | ||
| results$[key] = x; | ||
| } | ||
| } | ||
| return results$; | ||
| } else { | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!f(x)) { | ||
| res$.push(x); | ||
| } | ||
| } | ||
| result = res$; | ||
| if (type === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| } | ||
| }); | ||
| exports.partition = partition = curry$(function(f, xs){ | ||
| var type, passed, failed, key, x, i$, len$; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
| passed = {}; | ||
| failed = {}; | ||
| for (key in xs) { | ||
| x = xs[key]; | ||
| (f(x) ? passed : failed)[key] = x; | ||
| } | ||
| } else { | ||
| passed = []; | ||
| failed = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| (f(x) ? passed : failed).push(x); | ||
| } | ||
| if (type === 'String') { | ||
| passed = passed.join(''); | ||
| failed = failed.join(''); | ||
| } | ||
| } | ||
| return [passed, failed]; | ||
| }); | ||
| exports.find = find = curry$(function(f, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
| return x; | ||
| } | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
| return x; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| exports.head = head = exports.first = first = function(xs){ | ||
| if (!xs.length) { | ||
| return; | ||
| } | ||
| return xs[0]; | ||
| }; | ||
| exports.tail = tail = function(xs){ | ||
| if (!xs.length) { | ||
| return; | ||
| } | ||
| return xs.slice(1); | ||
| }; | ||
| exports.last = last = function(xs){ | ||
| if (!xs.length) { | ||
| return; | ||
| } | ||
| return xs[xs.length - 1]; | ||
| }; | ||
| exports.initial = initial = function(xs){ | ||
| if (!xs.length) { | ||
| return; | ||
| } | ||
| return xs.slice(0, xs.length - 1); | ||
| }; | ||
| exports.empty = empty = function(xs){ | ||
| var x; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (x in xs) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| return !xs.length; | ||
| }; | ||
| exports.values = values = function(obj){ | ||
| var i$, x, results$ = []; | ||
| for (i$ in obj) { | ||
| x = obj[i$]; | ||
| results$.push(x); | ||
| } | ||
| return results$; | ||
| }; | ||
| exports.keys = keys = function(obj){ | ||
| var x, results$ = []; | ||
| for (x in obj) { | ||
| results$.push(x); | ||
| } | ||
| return results$; | ||
| }; | ||
| exports.length = length = function(xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| xs = values(xs); | ||
| } | ||
| return xs.length; | ||
| }; | ||
| exports.cons = cons = curry$(function(x, xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return x + xs; | ||
| } else { | ||
| return [x].concat(xs); | ||
| } | ||
| }); | ||
| exports.append = append = curry$(function(xs, ys){ | ||
| if (toString$.call(ys).slice(8, -1) === 'String') { | ||
| return xs + ys; | ||
| } else { | ||
| return xs.concat(ys); | ||
| } | ||
| }); | ||
| exports.join = join = curry$(function(sep, xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| xs = values(xs); | ||
| } | ||
| return xs.join(sep); | ||
| }); | ||
| exports.reverse = reverse = function(xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return xs.split('').reverse().join(''); | ||
| } else { | ||
| return xs.slice().reverse(); | ||
| } | ||
| }; | ||
| exports.fold = fold = exports.foldl = foldl = curry$(function(f, memo, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| memo = f(memo, x); | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| memo = f(memo, x); | ||
| } | ||
| } | ||
| return memo; | ||
| }); | ||
| exports.fold1 = fold1 = exports.foldl1 = foldl1 = curry$(function(f, xs){ | ||
| return fold(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.foldr = foldr = curry$(function(f, memo, xs){ | ||
| return fold(f, memo, xs.reverse()); | ||
| }); | ||
| exports.foldr1 = foldr1 = curry$(function(f, xs){ | ||
| xs.reverse(); | ||
| return fold(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.unfoldr = exports.unfold = unfoldr = curry$(function(f, b){ | ||
| var that; | ||
| if ((that = f(b)) != null) { | ||
| return [that[0]].concat(unfoldr(f, that[1])); | ||
| } else { | ||
| return []; | ||
| } | ||
| }); | ||
| exports.andList = andList = function(xs){ | ||
| return fold(function(memo, x){ | ||
| return memo && x; | ||
| }, true, xs); | ||
| }; | ||
| exports.orList = orList = function(xs){ | ||
| return fold(function(memo, x){ | ||
| return memo || x; | ||
| }, false, xs); | ||
| }; | ||
| exports.any = any = curry$(function(f, xs){ | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| return fold(function(memo, x){ | ||
| return memo || f(x); | ||
| }, false, xs); | ||
| }); | ||
| exports.all = all = curry$(function(f, xs){ | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| return fold(function(memo, x){ | ||
| return memo && f(x); | ||
| }, true, xs); | ||
| }); | ||
| exports.unique = unique = function(xs){ | ||
| var result, i$, x, len$; | ||
| result = []; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| if (!in$(x, result)) { | ||
| result.push(x); | ||
| } | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!in$(x, result)) { | ||
| result.push(x); | ||
| } | ||
| } | ||
| } | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| }; | ||
| exports.sort = sort = function(xs){ | ||
| return xs.concat().sort(function(x, y){ | ||
| switch (false) { | ||
| case !(x > y): | ||
| return 1; | ||
| case !(x < y): | ||
| return -1; | ||
| default: | ||
| return 0; | ||
| } | ||
| }); | ||
| }; | ||
| exports.sortBy = sortBy = curry$(function(f, xs){ | ||
| if (!xs.length) { | ||
| return []; | ||
| } | ||
| return xs.concat().sort(f); | ||
| }); | ||
| exports.compare = compare = curry$(function(f, x, y){ | ||
| switch (false) { | ||
| case !(f(x) > f(y)): | ||
| return 1; | ||
| case !(f(x) < f(y)): | ||
| return -1; | ||
| default: | ||
| return 0; | ||
| } | ||
| }); | ||
| exports.sum = sum = function(xs){ | ||
| var result, i$, x, len$; | ||
| result = 0; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| result += x; | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result += x; | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
| exports.product = product = function(xs){ | ||
| var result, i$, x, len$; | ||
| result = 1; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| result *= x; | ||
| } | ||
| } else { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result *= x; | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
| exports.mean = mean = exports.average = average = function(xs){ | ||
| return sum(xs) / length(xs); | ||
| }; | ||
| exports.concat = concat = function(xss){ | ||
| return fold(append, [], xss); | ||
| }; | ||
| exports.concatMap = concatMap = curry$(function(f, xs){ | ||
| return concat(map(f, xs)); | ||
| }); | ||
| exports.listToObj = listToObj = function(xs){ | ||
| var result, i$, len$, x; | ||
| result = {}; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result[x[0]] = x[1]; | ||
| } | ||
| return result; | ||
| }; | ||
| exports.maximum = maximum = function(xs){ | ||
| return fold1(max, xs); | ||
| }; | ||
| exports.minimum = minimum = function(xs){ | ||
| return fold1(min, xs); | ||
| }; | ||
| exports.scan = scan = exports.scanl = scanl = curry$(function(f, memo, xs){ | ||
| var last, x; | ||
| last = memo; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| return [memo].concat((function(){ | ||
| var i$, ref$, results$ = []; | ||
| for (i$ in ref$ = xs) { | ||
| x = ref$[i$]; | ||
| results$.push(last = f(last, x)); | ||
| } | ||
| return results$; | ||
| }())); | ||
| } else { | ||
| return [memo].concat((function(){ | ||
| var i$, ref$, len$, results$ = []; | ||
| for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { | ||
| x = ref$[i$]; | ||
| results$.push(last = f(last, x)); | ||
| } | ||
| return results$; | ||
| }())); | ||
| } | ||
| }); | ||
| exports.scan1 = scan1 = exports.scanl1 = scanl1 = curry$(function(f, xs){ | ||
| return scan(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.scanr = scanr = curry$(function(f, memo, xs){ | ||
| xs.reverse(); | ||
| return scan(f, memo, xs).reverse(); | ||
| }); | ||
| exports.scanr1 = scanr1 = curry$(function(f, xs){ | ||
| xs.reverse(); | ||
| return scan(f, xs[0], xs.slice(1)).reverse(); | ||
| }); | ||
| exports.replicate = replicate = curry$(function(n, x){ | ||
| var result, i; | ||
| result = []; | ||
| i = 0; | ||
| for (; i < n; ++i) { | ||
| result.push(x); | ||
| } | ||
| return result; | ||
| }); | ||
| exports.take = take = curry$(function(n, xs){ | ||
| switch (false) { | ||
| case !(n <= 0): | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return ''; | ||
| } else { | ||
| return []; | ||
| } | ||
| break; | ||
| case !!xs.length: | ||
| return xs; | ||
| default: | ||
| return xs.slice(0, n); | ||
| } | ||
| }); | ||
| exports.drop = drop = curry$(function(n, xs){ | ||
| switch (false) { | ||
| case !(n <= 0): | ||
| return xs; | ||
| case !!xs.length: | ||
| return xs; | ||
| default: | ||
| return xs.slice(n); | ||
| } | ||
| }); | ||
| exports.splitAt = splitAt = curry$(function(n, xs){ | ||
| return [take(n, xs), drop(n, xs)]; | ||
| }); | ||
| exports.takeWhile = takeWhile = curry$(function(p, xs){ | ||
| var result, i$, len$, x; | ||
| if (!xs.length) { | ||
| return xs; | ||
| } | ||
| if (toString$.call(p).slice(8, -1) !== 'Function') { | ||
| p = objToFunc(p); | ||
| } | ||
| result = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!p(x)) { | ||
| break; | ||
| } | ||
| result.push(x); | ||
| } | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| }); | ||
| exports.dropWhile = dropWhile = curry$(function(p, xs){ | ||
| var i, i$, len$, x; | ||
| if (!xs.length) { | ||
| return xs; | ||
| } | ||
| if (toString$.call(p).slice(8, -1) !== 'Function') { | ||
| p = objToFunc(p); | ||
| } | ||
| i = 0; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!p(x)) { | ||
| break; | ||
| } | ||
| ++i; | ||
| } | ||
| return drop(i, xs); | ||
| }); | ||
| exports.span = span = curry$(function(p, xs){ | ||
| return [takeWhile(p, xs), dropWhile(p, xs)]; | ||
| }); | ||
| exports.breakIt = breakIt = curry$(function(p, xs){ | ||
| return span(compose$([not$, p]), xs); | ||
| }); | ||
| exports.zip = zip = curry$(function(xs, ys){ | ||
| var result, i, ref$, len$, zs, j, len1$, z, ref1$; | ||
| result = []; | ||
| for (i = 0, len$ = (ref$ = [xs, ys]).length; i < len$; ++i) { | ||
| zs = ref$[i]; | ||
| for (j = 0, len1$ = zs.length; j < len1$; ++j) { | ||
| z = zs[j]; | ||
| if (i === 0) { | ||
| result.push([]); | ||
| } | ||
| if ((ref1$ = result[j]) != null) { | ||
| ref1$.push(z); | ||
| } | ||
| } | ||
| } | ||
| return result; | ||
| }); | ||
| exports.zipWith = zipWith = curry$(function(f, xs, ys){ | ||
| var i$, ref$, len$, zs, results$ = []; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| if (!xs.length || !ys.length) { | ||
| return []; | ||
| } else { | ||
| for (i$ = 0, len$ = (ref$ = zip.call(this, xs, ys)).length; i$ < len$; ++i$) { | ||
| zs = ref$[i$]; | ||
| results$.push(f.apply(this, zs)); | ||
| } | ||
| return results$; | ||
| } | ||
| }); | ||
| exports.zipAll = zipAll = function(){ | ||
| var xss, result, i, len$, xs, j, len1$, x, ref$; | ||
| xss = slice$.call(arguments); | ||
| result = []; | ||
| for (i = 0, len$ = xss.length; i < len$; ++i) { | ||
| xs = xss[i]; | ||
| for (j = 0, len1$ = xs.length; j < len1$; ++j) { | ||
| x = xs[j]; | ||
| if (i === 0) { | ||
| result.push([]); | ||
| } | ||
| if ((ref$ = result[j]) != null) { | ||
| ref$.push(x); | ||
| } | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
| exports.zipAllWith = zipAllWith = function(f){ | ||
| var xss, i$, ref$, len$, xs, results$ = []; | ||
| xss = slice$.call(arguments, 1); | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| if (!xss[0].length || !xss[1].length) { | ||
| return []; | ||
| } else { | ||
| for (i$ = 0, len$ = (ref$ = zipAll.apply(this, xss)).length; i$ < len$; ++i$) { | ||
| xs = ref$[i$]; | ||
| results$.push(f.apply(this, xs)); | ||
| } | ||
| return results$; | ||
| } | ||
| }; | ||
| exports.compose = compose = function(){ | ||
| var funcs; | ||
| funcs = slice$.call(arguments); | ||
| return function(){ | ||
| var args, i$, ref$, len$, f; | ||
| args = arguments; | ||
| for (i$ = 0, len$ = (ref$ = funcs).length; i$ < len$; ++i$) { | ||
| f = ref$[i$]; | ||
| args = [f.apply(this, args)]; | ||
| } | ||
| return args[0]; | ||
| }; | ||
| }; | ||
| exports.curry = curry = function(f){ | ||
| return curry$(f); | ||
| }; | ||
| exports.id = id = function(x){ | ||
| return x; | ||
| }; | ||
| exports.flip = flip = curry$(function(f, x, y){ | ||
| return f(y, x); | ||
| }); | ||
| exports.fix = fix = function(f){ | ||
| return function(g, x){ | ||
| return function(){ | ||
| return f(g(g)).apply(null, arguments); | ||
| }; | ||
| }(function(g, x){ | ||
| return function(){ | ||
| return f(g(g)).apply(null, arguments); | ||
| }; | ||
| }); | ||
| }; | ||
| exports.lines = lines = function(str){ | ||
| if (!str.length) { | ||
| return []; | ||
| } | ||
| return str.split('\n'); | ||
| }; | ||
| exports.unlines = unlines = function(strs){ | ||
| return strs.join('\n'); | ||
| }; | ||
| exports.words = words = function(str){ | ||
| if (!str.length) { | ||
| return []; | ||
| } | ||
| return str.split(/[ ]+/); | ||
| }; | ||
| exports.unwords = unwords = function(strs){ | ||
| return strs.join(' '); | ||
| }; | ||
| exports.max = max = curry$(function(x, y){ | ||
| if (x > y) { | ||
| return x; | ||
| } else { | ||
| return y; | ||
| } | ||
| }); | ||
| exports.min = min = curry$(function(x, y){ | ||
| if (x > y) { | ||
| return y; | ||
| } else { | ||
| return x; | ||
| } | ||
| }); | ||
| exports.negate = negate = function(x){ | ||
| return -x; | ||
| }; | ||
| exports.abs = abs = Math.abs; | ||
| exports.signum = signum = function(x){ | ||
| switch (false) { | ||
| case !(x < 0): | ||
| return -1; | ||
| case !(x > 0): | ||
| return 1; | ||
| default: | ||
| return 0; | ||
| } | ||
| }; | ||
| exports.quot = quot = curry$(function(x, y){ | ||
| return ~~(x / y); | ||
| }); | ||
| exports.rem = rem = curry$(function(x, y){ | ||
| return x % y; | ||
| }); | ||
| exports.div = div = curry$(function(x, y){ | ||
| return Math.floor(x / y); | ||
| }); | ||
| exports.mod = mod = curry$(function(x, y){ | ||
| var ref$; | ||
| return ((x) % (ref$ = y) + ref$) % ref$; | ||
| }); | ||
| exports.recip = recip = function(x){ | ||
| return 1 / x; | ||
| }; | ||
| exports.pi = pi = Math.PI; | ||
| exports.tau = tau = pi * 2; | ||
| exports.exp = exp = Math.exp; | ||
| exports.sqrt = sqrt = Math.sqrt; | ||
| exports.ln = ln = Math.log; | ||
| exports.pow = pow = curry$(function(x, y){ | ||
| return Math.pow(x, y); | ||
| }); | ||
| exports.sin = sin = Math.sin; | ||
| exports.tan = tan = Math.tan; | ||
| exports.cos = cos = Math.cos; | ||
| exports.asin = asin = Math.asin; | ||
| exports.acos = acos = Math.acos; | ||
| exports.atan = atan = Math.atan; | ||
| exports.atan2 = atan2 = curry$(function(x, y){ | ||
| return Math.atan2(x, y); | ||
| }); | ||
| exports.truncate = truncate = function(x){ | ||
| return ~~x; | ||
| }; | ||
| exports.round = round = Math.round; | ||
| exports.ceiling = ceiling = Math.ceil; | ||
| exports.floor = floor = Math.floor; | ||
| exports.isItNaN = isItNaN = function(x){ | ||
| return x !== x; | ||
| }; | ||
| exports.even = even = function(x){ | ||
| return x % 2 === 0; | ||
| }; | ||
| exports.odd = odd = function(x){ | ||
| return x % 2 !== 0; | ||
| }; | ||
| exports.gcd = gcd = curry$(function(x, y){ | ||
| var z; | ||
| x = Math.abs(x); | ||
| y = Math.abs(y); | ||
| while (y !== 0) { | ||
| z = x % y; | ||
| x = y; | ||
| y = z; | ||
| } | ||
| return x; | ||
| }); | ||
| exports.lcm = lcm = curry$(function(x, y){ | ||
| return Math.abs(Math.floor(x / gcd(x, y) * y)); | ||
| }); | ||
| exports.installPrelude = function(target){ | ||
| var ref$; | ||
| if (!((ref$ = target.prelude) != null && ref$.isInstalled)) { | ||
| import$(target, exports); | ||
| target.prelude.isInstalled = true; | ||
| } | ||
| }; | ||
| exports.prelude = exports; | ||
| function curry$(f, args){ | ||
| return f.length > 1 ? function(){ | ||
| var params = args ? args.concat() : []; | ||
| return params.push.apply(params, arguments) < f.length && arguments.length ? | ||
| curry$.call(this, f, params) : f.apply(this, params); | ||
| } : f; | ||
| } | ||
| function in$(x, arr){ | ||
| var i = 0, l = arr.length >>> 0; | ||
| while (i < l) if (x === arr[i++]) return true; | ||
| return false; | ||
| } | ||
| function compose$(fs){ | ||
| return function(){ | ||
| var i, args = arguments; | ||
| for (i = fs.length; i > 0; --i) { args = [fs[i-1].apply(this, args)]; } | ||
| return args[0]; | ||
| }; | ||
| } | ||
| function not$(x){ return !x; } | ||
| function import$(obj, src){ | ||
| var own = {}.hasOwnProperty; | ||
| for (var key in src) if (own.call(src, key)) obj[key] = src[key]; | ||
| return obj; | ||
| } | ||
| return exports; | ||
| }(); |
+4
-2
| { | ||
| "name": "prelude-ls", | ||
| "version": "0.5.0", | ||
| "version": "0.6.0", | ||
| "description": "prelude.ls is a JavaScript functional programming library. It is the recommended base library for, and is written in, LiveScript. It is based off of Haskell's Prelude module.", | ||
@@ -23,6 +23,8 @@ "keywords": [ | ||
| "engines": { | ||
| "node": ">= 0.6.14 < 0.9.0" | ||
| "node": ">= 0.8.0" | ||
| }, | ||
| "files": [ | ||
| "prelude.js", | ||
| "prelude-browser.js", | ||
| "prelude-browser-min.js", | ||
| "README.md", | ||
@@ -29,0 +31,0 @@ "LICENSE" |
+254
-225
@@ -1,6 +0,6 @@ | ||
| // prelude.ls 0.5.0 | ||
| // prelude.ls 0.6.0 | ||
| // Copyright (c) 2012 George Zahariev | ||
| // Released under the MIT License | ||
| // raw.github.com/gkz/prelude-ls/master/LICNSE | ||
| var objToFunc, each, map, filter, reject, partition, find, first, head, tail, last, initial, empty, values, keys, length, cons, append, join, reverse, foldl, fold, foldl1, fold1, foldr, foldr1, andList, orList, any, all, unique, sum, product, average, mean, concat, concatMap, listToObj, maximum, minimum, scanl, scan, scanl1, scan1, scanr, scanr1, replicate, take, drop, splitAt, takeWhile, dropWhile, span, breakIt, zip, zipWith, zipAll, zipAllWith, compose, curry, partial, id, flip, fix, lines, unlines, words, unwords, max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm, __toString = {}.toString, __slice = [].slice; | ||
| var objToFunc, each, map, filter, reject, partition, find, first, head, tail, last, initial, empty, values, keys, length, cons, append, join, reverse, foldl, fold, foldl1, fold1, foldr, foldr1, unfoldr, andList, orList, any, all, unique, sort, sortBy, compare, sum, product, average, mean, concat, concatMap, listToObj, maximum, minimum, scanl, scan, scanl1, scan1, scanr, scanr1, replicate, take, drop, splitAt, takeWhile, dropWhile, span, breakIt, zip, zipWith, zipAll, zipAllWith, compose, curry, id, flip, fix, lines, unlines, words, unwords, max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm, toString$ = {}.toString, slice$ = [].slice; | ||
| exports.objToFunc = objToFunc = function(obj){ | ||
@@ -11,12 +11,12 @@ return function(key){ | ||
| }; | ||
| exports.each = each = __curry(function(f, xs){ | ||
| var x, __i, __len; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| exports.each = each = curry$(function(f, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| f(x); | ||
| } | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| f(x); | ||
@@ -27,21 +27,21 @@ } | ||
| }); | ||
| exports.map = map = __curry(function(f, xs){ | ||
| var type, key, x, result, __res, __i, __len, __results = {}; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.map = map = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = __toString.call(xs).slice(8, -1); | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
| for (key in xs) { | ||
| x = xs[key]; | ||
| __results[key] = f(x); | ||
| results$[key] = f(x); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| } else { | ||
| __res = []; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| __res.push(f(x)); | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| res$.push(f(x)); | ||
| } | ||
| result = __res; | ||
| result = res$; | ||
| if (type === 'String') { | ||
@@ -54,8 +54,8 @@ return result.join(''); | ||
| }); | ||
| exports.filter = filter = __curry(function(f, xs){ | ||
| var type, key, x, result, __res, __i, __len, __results = {}; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.filter = filter = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = __toString.call(xs).slice(8, -1); | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
@@ -65,15 +65,15 @@ for (key in xs) { | ||
| if (f(x)) { | ||
| __results[key] = x; | ||
| results$[key] = x; | ||
| } | ||
| } | ||
| return __results; | ||
| return results$; | ||
| } else { | ||
| __res = []; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
| __res.push(x); | ||
| res$.push(x); | ||
| } | ||
| } | ||
| result = __res; | ||
| result = res$; | ||
| if (type === 'String') { | ||
@@ -86,8 +86,8 @@ return result.join(''); | ||
| }); | ||
| exports.reject = reject = __curry(function(f, xs){ | ||
| var type, key, x, result, __res, __i, __len, __results = {}; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.reject = reject = curry$(function(f, xs){ | ||
| var type, key, x, res$, i$, len$, result, results$ = {}; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = __toString.call(xs).slice(8, -1); | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
@@ -97,15 +97,15 @@ for (key in xs) { | ||
| if (!f(x)) { | ||
| __results[key] = x; | ||
| results$[key] = x; | ||
| } | ||
| } | ||
| return __results; | ||
| return results$; | ||
| } else { | ||
| __res = []; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| res$ = []; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!f(x)) { | ||
| __res.push(x); | ||
| res$.push(x); | ||
| } | ||
| } | ||
| result = __res; | ||
| result = res$; | ||
| if (type === 'String') { | ||
@@ -118,8 +118,8 @@ return result.join(''); | ||
| }); | ||
| exports.partition = partition = __curry(function(f, xs){ | ||
| var type, passed, failed, key, x, __i, __len; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.partition = partition = curry$(function(f, xs){ | ||
| var type, passed, failed, key, x, i$, len$; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| type = __toString.call(xs).slice(8, -1); | ||
| type = toString$.call(xs).slice(8, -1); | ||
| if (type === 'Object') { | ||
@@ -135,4 +135,4 @@ passed = {}; | ||
| failed = []; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| (f(x) ? passed : failed).push(x); | ||
@@ -147,10 +147,10 @@ } | ||
| }); | ||
| exports.find = find = __curry(function(f, xs){ | ||
| var x, __i, __len; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.find = find = curry$(function(f, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
| } | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
@@ -161,4 +161,4 @@ return x; | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (f(x)) { | ||
@@ -196,3 +196,3 @@ return x; | ||
| var x; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (x in xs) { | ||
@@ -206,18 +206,18 @@ return false; | ||
| exports.values = values = function(obj){ | ||
| var x, __i, __results = []; | ||
| for (__i in obj) { | ||
| x = obj[__i]; | ||
| __results.push(x); | ||
| var i$, x, results$ = []; | ||
| for (i$ in obj) { | ||
| x = obj[i$]; | ||
| results$.push(x); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| }; | ||
| exports.keys = keys = function(obj){ | ||
| var x, __results = []; | ||
| var x, results$ = []; | ||
| for (x in obj) { | ||
| __results.push(x); | ||
| results$.push(x); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| }; | ||
| exports.length = length = function(xs){ | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| xs = values(xs); | ||
@@ -227,18 +227,18 @@ } | ||
| }; | ||
| exports.cons = cons = __curry(function(x, xs){ | ||
| if (__toString.call(xs).slice(8, -1) === 'String') { | ||
| exports.cons = cons = curry$(function(x, xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return x + xs; | ||
| } else { | ||
| return [(x)].concat(xs); | ||
| return [x].concat(xs); | ||
| } | ||
| }); | ||
| exports.append = append = __curry(function(xs, ys){ | ||
| if (__toString.call(ys).slice(8, -1) === 'String') { | ||
| exports.append = append = curry$(function(xs, ys){ | ||
| if (toString$.call(ys).slice(8, -1) === 'String') { | ||
| return xs + ys; | ||
| } else { | ||
| return (xs).concat(ys); | ||
| return xs.concat(ys); | ||
| } | ||
| }); | ||
| exports.join = join = __curry(function(sep, xs){ | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| exports.join = join = curry$(function(sep, xs){ | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| xs = values(xs); | ||
@@ -249,3 +249,3 @@ } | ||
| exports.reverse = reverse = function(xs){ | ||
| if (__toString.call(xs).slice(8, -1) === 'String') { | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return xs.split('').reverse().join(''); | ||
@@ -256,12 +256,12 @@ } else { | ||
| }; | ||
| exports.fold = fold = exports.foldl = foldl = __curry(function(f, memo, xs){ | ||
| var x, __i, __len; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| exports.fold = fold = exports.foldl = foldl = curry$(function(f, memo, xs){ | ||
| var i$, x, len$; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| memo = f(memo, x); | ||
| } | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| memo = f(memo, x); | ||
@@ -272,12 +272,20 @@ } | ||
| }); | ||
| exports.fold1 = fold1 = exports.foldl1 = foldl1 = __curry(function(f, xs){ | ||
| exports.fold1 = fold1 = exports.foldl1 = foldl1 = curry$(function(f, xs){ | ||
| return fold(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.foldr = foldr = __curry(function(f, memo, xs){ | ||
| exports.foldr = foldr = curry$(function(f, memo, xs){ | ||
| return fold(f, memo, xs.reverse()); | ||
| }); | ||
| exports.foldr1 = foldr1 = __curry(function(f, xs){ | ||
| exports.foldr1 = foldr1 = curry$(function(f, xs){ | ||
| xs.reverse(); | ||
| return fold(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.unfoldr = exports.unfold = unfoldr = curry$(function(f, b){ | ||
| var that; | ||
| if ((that = f(b)) != null) { | ||
| return [that[0]].concat(unfoldr(f, that[1])); | ||
| } else { | ||
| return []; | ||
| } | ||
| }); | ||
| exports.andList = andList = function(xs){ | ||
@@ -293,4 +301,4 @@ return fold(function(memo, x){ | ||
| }; | ||
| exports.any = any = __curry(function(f, xs){ | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.any = any = curry$(function(f, xs){ | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
@@ -302,4 +310,4 @@ } | ||
| }); | ||
| exports.all = all = __curry(function(f, xs){ | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.all = all = curry$(function(f, xs){ | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
@@ -312,8 +320,8 @@ } | ||
| exports.unique = unique = function(xs){ | ||
| var result, x, __i, __len; | ||
| var result, i$, x, len$; | ||
| result = []; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| if (!__in(x, result)) { | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| if (!in$(x, result)) { | ||
| result.push(x); | ||
@@ -323,5 +331,5 @@ } | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| if (!__in(x, result)) { | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!in$(x, result)) { | ||
| result.push(x); | ||
@@ -331,3 +339,3 @@ } | ||
| } | ||
| if (__toString.call(xs).slice(8, -1) === 'String') { | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return result.join(''); | ||
@@ -338,13 +346,41 @@ } else { | ||
| }; | ||
| exports.sort = sort = function(xs){ | ||
| return xs.concat().sort(function(x, y){ | ||
| switch (false) { | ||
| case !(x > y): | ||
| return 1; | ||
| case !(x < y): | ||
| return -1; | ||
| default: | ||
| return 0; | ||
| } | ||
| }); | ||
| }; | ||
| exports.sortBy = sortBy = curry$(function(f, xs){ | ||
| if (!xs.length) { | ||
| return []; | ||
| } | ||
| return xs.concat().sort(f); | ||
| }); | ||
| exports.compare = compare = curry$(function(f, x, y){ | ||
| switch (false) { | ||
| case !(f(x) > f(y)): | ||
| return 1; | ||
| case !(f(x) < f(y)): | ||
| return -1; | ||
| default: | ||
| return 0; | ||
| } | ||
| }); | ||
| exports.sum = sum = function(xs){ | ||
| var result, x, __i, __len; | ||
| var result, i$, x, len$; | ||
| result = 0; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| result += x; | ||
| } | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result += x; | ||
@@ -356,12 +392,12 @@ } | ||
| exports.product = product = function(xs){ | ||
| var result, x, __i, __len; | ||
| var result, i$, x, len$; | ||
| result = 1; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| for (__i in xs) { | ||
| x = xs[__i]; | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| for (i$ in xs) { | ||
| x = xs[i$]; | ||
| result *= x; | ||
| } | ||
| } else { | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result *= x; | ||
@@ -378,10 +414,10 @@ } | ||
| }; | ||
| exports.concatMap = concatMap = __curry(function(f, xs){ | ||
| exports.concatMap = concatMap = curry$(function(f, xs){ | ||
| return concat(map(f, xs)); | ||
| }); | ||
| exports.listToObj = listToObj = function(xs){ | ||
| var result, x, __i, __len; | ||
| var result, i$, len$, x; | ||
| result = {}; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| result[x[0]] = x[1]; | ||
@@ -397,37 +433,37 @@ } | ||
| }; | ||
| exports.scan = scan = exports.scanl = scanl = __curry(function(f, memo, xs){ | ||
| exports.scan = scan = exports.scanl = scanl = curry$(function(f, memo, xs){ | ||
| var last, x; | ||
| last = memo; | ||
| if (__toString.call(xs).slice(8, -1) === 'Object') { | ||
| return ([memo]).concat((function(){ | ||
| var __i, __ref, __results = []; | ||
| for (__i in __ref = xs) { | ||
| x = __ref[__i]; | ||
| __results.push(last = f(last, x)); | ||
| if (toString$.call(xs).slice(8, -1) === 'Object') { | ||
| return [memo].concat((function(){ | ||
| var i$, ref$, results$ = []; | ||
| for (i$ in ref$ = xs) { | ||
| x = ref$[i$]; | ||
| results$.push(last = f(last, x)); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| }())); | ||
| } else { | ||
| return ([memo]).concat((function(){ | ||
| var __i, __ref, __len, __results = []; | ||
| for (__i = 0, __len = (__ref = xs).length; __i < __len; ++__i) { | ||
| x = __ref[__i]; | ||
| __results.push(last = f(last, x)); | ||
| return [memo].concat((function(){ | ||
| var i$, ref$, len$, results$ = []; | ||
| for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) { | ||
| x = ref$[i$]; | ||
| results$.push(last = f(last, x)); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| }())); | ||
| } | ||
| }); | ||
| exports.scan1 = scan1 = exports.scanl1 = scanl1 = __curry(function(f, xs){ | ||
| exports.scan1 = scan1 = exports.scanl1 = scanl1 = curry$(function(f, xs){ | ||
| return scan(f, xs[0], xs.slice(1)); | ||
| }); | ||
| exports.scanr = scanr = __curry(function(f, memo, xs){ | ||
| exports.scanr = scanr = curry$(function(f, memo, xs){ | ||
| xs.reverse(); | ||
| return scan(f, memo, xs).reverse(); | ||
| }); | ||
| exports.scanr1 = scanr1 = __curry(function(f, xs){ | ||
| exports.scanr1 = scanr1 = curry$(function(f, xs){ | ||
| xs.reverse(); | ||
| return scan(f, xs[0], xs.slice(1)).reverse(); | ||
| }); | ||
| exports.replicate = replicate = __curry(function(n, x){ | ||
| exports.replicate = replicate = curry$(function(n, x){ | ||
| var result, i; | ||
@@ -439,12 +475,8 @@ result = []; | ||
| } | ||
| if (__toString.call(x).slice(8, -1) === 'String') { | ||
| return result.join(''); | ||
| } else { | ||
| return result; | ||
| } | ||
| return result; | ||
| }); | ||
| exports.take = take = __curry(function(n, xs){ | ||
| exports.take = take = curry$(function(n, xs){ | ||
| switch (false) { | ||
| case !(n <= 0): | ||
| if (__toString.call(xs).slice(8, -1) === 'String') { | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return ''; | ||
@@ -461,3 +493,3 @@ } else { | ||
| }); | ||
| exports.drop = drop = __curry(function(n, xs){ | ||
| exports.drop = drop = curry$(function(n, xs){ | ||
| switch (false) { | ||
@@ -472,16 +504,16 @@ case !(n <= 0): | ||
| }); | ||
| exports.splitAt = splitAt = __curry(function(n, xs){ | ||
| exports.splitAt = splitAt = curry$(function(n, xs){ | ||
| return [take(n, xs), drop(n, xs)]; | ||
| }); | ||
| exports.takeWhile = takeWhile = __curry(function(p, xs){ | ||
| var result, x, __i, __len; | ||
| exports.takeWhile = takeWhile = curry$(function(p, xs){ | ||
| var result, i$, len$, x; | ||
| if (!xs.length) { | ||
| return xs; | ||
| } | ||
| if (__toString.call(p).slice(8, -1) !== 'Function') { | ||
| if (toString$.call(p).slice(8, -1) !== 'Function') { | ||
| p = objToFunc(p); | ||
| } | ||
| result = []; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!p(x)) { | ||
@@ -492,3 +524,3 @@ break; | ||
| } | ||
| if (__toString.call(xs).slice(8, -1) === 'String') { | ||
| if (toString$.call(xs).slice(8, -1) === 'String') { | ||
| return result.join(''); | ||
@@ -499,13 +531,13 @@ } else { | ||
| }); | ||
| exports.dropWhile = dropWhile = __curry(function(p, xs){ | ||
| var i, x, __i, __len; | ||
| exports.dropWhile = dropWhile = curry$(function(p, xs){ | ||
| var i, i$, len$, x; | ||
| if (!xs.length) { | ||
| return xs; | ||
| } | ||
| if (__toString.call(p).slice(8, -1) !== 'Function') { | ||
| if (toString$.call(p).slice(8, -1) !== 'Function') { | ||
| p = objToFunc(p); | ||
| } | ||
| i = 0; | ||
| for (__i = 0, __len = xs.length; __i < __len; ++__i) { | ||
| x = xs[__i]; | ||
| for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) { | ||
| x = xs[i$]; | ||
| if (!p(x)) { | ||
@@ -518,14 +550,14 @@ break; | ||
| }); | ||
| exports.span = span = __curry(function(p, xs){ | ||
| exports.span = span = curry$(function(p, xs){ | ||
| return [takeWhile(p, xs), dropWhile(p, xs)]; | ||
| }); | ||
| exports.breakIt = breakIt = __curry(function(p, xs){ | ||
| return span(__compose((__not),(p)), xs); | ||
| exports.breakIt = breakIt = curry$(function(p, xs){ | ||
| return span(compose$([not$, p]), xs); | ||
| }); | ||
| exports.zip = zip = __curry(function(xs, ys){ | ||
| var result, i, zs, j, z, __ref, __len, __len1, __ref1; | ||
| exports.zip = zip = curry$(function(xs, ys){ | ||
| var result, i, ref$, len$, zs, j, len1$, z, ref1$; | ||
| result = []; | ||
| for (i = 0, __len = (__ref = [xs, ys]).length; i < __len; ++i) { | ||
| zs = __ref[i]; | ||
| for (j = 0, __len1 = zs.length; j < __len1; ++j) { | ||
| for (i = 0, len$ = (ref$ = [xs, ys]).length; i < len$; ++i) { | ||
| zs = ref$[i]; | ||
| for (j = 0, len1$ = zs.length; j < len1$; ++j) { | ||
| z = zs[j]; | ||
@@ -535,4 +567,4 @@ if (i === 0) { | ||
| } | ||
| if ((__ref1 = result[j]) != null) { | ||
| __ref1.push(z); | ||
| if ((ref1$ = result[j]) != null) { | ||
| ref1$.push(z); | ||
| } | ||
@@ -543,5 +575,5 @@ } | ||
| }); | ||
| exports.zipWith = zipWith = __curry(function(f, xs, ys){ | ||
| var zs, __i, __ref, __len, __results = []; | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| exports.zipWith = zipWith = curry$(function(f, xs, ys){ | ||
| var i$, ref$, len$, zs, results$ = []; | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
@@ -552,16 +584,16 @@ } | ||
| } else { | ||
| for (__i = 0, __len = (__ref = zip.call(this, xs, ys)).length; __i < __len; ++__i) { | ||
| zs = __ref[__i]; | ||
| __results.push(f.apply(this, zs)); | ||
| for (i$ = 0, len$ = (ref$ = zip.call(this, xs, ys)).length; i$ < len$; ++i$) { | ||
| zs = ref$[i$]; | ||
| results$.push(f.apply(this, zs)); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| } | ||
| }); | ||
| exports.zipAll = zipAll = function(){ | ||
| var xss, result, i, xs, j, x, __len, __len1, __ref; | ||
| xss = __slice.call(arguments); | ||
| var xss, result, i, len$, xs, j, len1$, x, ref$; | ||
| xss = slice$.call(arguments); | ||
| result = []; | ||
| for (i = 0, __len = xss.length; i < __len; ++i) { | ||
| for (i = 0, len$ = xss.length; i < len$; ++i) { | ||
| xs = xss[i]; | ||
| for (j = 0, __len1 = xs.length; j < __len1; ++j) { | ||
| for (j = 0, len1$ = xs.length; j < len1$; ++j) { | ||
| x = xs[j]; | ||
@@ -571,4 +603,4 @@ if (i === 0) { | ||
| } | ||
| if ((__ref = result[j]) != null) { | ||
| __ref.push(x); | ||
| if ((ref$ = result[j]) != null) { | ||
| ref$.push(x); | ||
| } | ||
@@ -580,5 +612,5 @@ } | ||
| exports.zipAllWith = zipAllWith = function(f){ | ||
| var xss, xs, __i, __ref, __len, __results = []; | ||
| xss = __slice.call(arguments, 1); | ||
| if (__toString.call(f).slice(8, -1) !== 'Function') { | ||
| var xss, i$, ref$, len$, xs, results$ = []; | ||
| xss = slice$.call(arguments, 1); | ||
| if (toString$.call(f).slice(8, -1) !== 'Function') { | ||
| f = objToFunc(f); | ||
@@ -589,7 +621,7 @@ } | ||
| } else { | ||
| for (__i = 0, __len = (__ref = zipAll.apply(this, xss)).length; __i < __len; ++__i) { | ||
| xs = __ref[__i]; | ||
| __results.push(f.apply(this, xs)); | ||
| for (i$ = 0, len$ = (ref$ = zipAll.apply(this, xss)).length; i$ < len$; ++i$) { | ||
| xs = ref$[i$]; | ||
| results$.push(f.apply(this, xs)); | ||
| } | ||
| return __results; | ||
| return results$; | ||
| } | ||
@@ -599,8 +631,8 @@ }; | ||
| var funcs; | ||
| funcs = __slice.call(arguments); | ||
| funcs = slice$.call(arguments); | ||
| return function(){ | ||
| var args, f, __i, __ref, __len; | ||
| var args, i$, ref$, len$, f; | ||
| args = arguments; | ||
| for (__i = 0, __len = (__ref = funcs).length; __i < __len; ++__i) { | ||
| f = __ref[__i]; | ||
| for (i$ = 0, len$ = (ref$ = funcs).length; i$ < len$; ++i$) { | ||
| f = ref$[i$]; | ||
| args = [f.apply(this, args)]; | ||
@@ -612,25 +644,20 @@ } | ||
| exports.curry = curry = function(f){ | ||
| return __curry(f); | ||
| return curry$(f); | ||
| }; | ||
| exports.partial = partial = function(f){ | ||
| var initArgs; | ||
| initArgs = __slice.call(arguments, 1); | ||
| return function(){ | ||
| var args; | ||
| args = __slice.call(arguments); | ||
| return f.apply(this, (initArgs).concat(args)); | ||
| }; | ||
| }; | ||
| exports.id = id = function(x){ | ||
| return x; | ||
| }; | ||
| exports.flip = flip = __curry(function(f, x, y){ | ||
| exports.flip = flip = curry$(function(f, x, y){ | ||
| return f(y, x); | ||
| }); | ||
| exports.fix = fix = function(f){ | ||
| return __curry(function(g, x){ | ||
| return f(g(g))(x); | ||
| })(__curry(function(g, x){ | ||
| return f(g(g))(x); | ||
| })); | ||
| return function(g, x){ | ||
| return function(){ | ||
| return f(g(g)).apply(null, arguments); | ||
| }; | ||
| }(function(g, x){ | ||
| return function(){ | ||
| return f(g(g)).apply(null, arguments); | ||
| }; | ||
| }); | ||
| }; | ||
@@ -655,3 +682,3 @@ exports.lines = lines = function(str){ | ||
| }; | ||
| exports.max = max = __curry(function(x, y){ | ||
| exports.max = max = curry$(function(x, y){ | ||
| if (x > y) { | ||
@@ -663,3 +690,3 @@ return x; | ||
| }); | ||
| exports.min = min = __curry(function(x, y){ | ||
| exports.min = min = curry$(function(x, y){ | ||
| if (x > y) { | ||
@@ -685,14 +712,14 @@ return y; | ||
| }; | ||
| exports.quot = quot = __curry(function(x, y){ | ||
| exports.quot = quot = curry$(function(x, y){ | ||
| return ~~(x / y); | ||
| }); | ||
| exports.rem = rem = __curry(function(x, y){ | ||
| exports.rem = rem = curry$(function(x, y){ | ||
| return x % y; | ||
| }); | ||
| exports.div = div = __curry(function(x, y){ | ||
| exports.div = div = curry$(function(x, y){ | ||
| return Math.floor(x / y); | ||
| }); | ||
| exports.mod = mod = __curry(function(x, y){ | ||
| var __ref; | ||
| return ((x) % (__ref = y) + __ref) % __ref; | ||
| exports.mod = mod = curry$(function(x, y){ | ||
| var ref$; | ||
| return ((x) % (ref$ = y) + ref$) % ref$; | ||
| }); | ||
@@ -707,3 +734,3 @@ exports.recip = recip = function(x){ | ||
| exports.ln = ln = Math.log; | ||
| exports.pow = pow = __curry(function(x, y){ | ||
| exports.pow = pow = curry$(function(x, y){ | ||
| return Math.pow(x, y); | ||
@@ -717,3 +744,3 @@ }); | ||
| exports.atan = atan = Math.atan; | ||
| exports.atan2 = atan2 = __curry(function(x, y){ | ||
| exports.atan2 = atan2 = curry$(function(x, y){ | ||
| return Math.atan2(x, y); | ||
@@ -736,3 +763,3 @@ }); | ||
| }; | ||
| exports.gcd = gcd = __curry(function(x, y){ | ||
| exports.gcd = gcd = curry$(function(x, y){ | ||
| var z; | ||
@@ -748,9 +775,9 @@ x = Math.abs(x); | ||
| }); | ||
| exports.lcm = lcm = __curry(function(x, y){ | ||
| exports.lcm = lcm = curry$(function(x, y){ | ||
| return Math.abs(Math.floor(x / gcd(x, y) * y)); | ||
| }); | ||
| exports.installPrelude = function(target){ | ||
| var __ref; | ||
| if (!((__ref = target.prelude) != null && __ref.isInstalled)) { | ||
| __import(target, exports); | ||
| var ref$; | ||
| if (!((ref$ = target.prelude) != null && ref$.isInstalled)) { | ||
| import$(target, exports); | ||
| target.prelude.isInstalled = true; | ||
@@ -760,10 +787,10 @@ } | ||
| exports.prelude = exports; | ||
| function __curry(f, args){ | ||
| function curry$(f, args){ | ||
| return f.length > 1 ? function(){ | ||
| var params = args ? args.concat() : []; | ||
| return params.push.apply(params, arguments) < f.length && arguments.length ? | ||
| __curry.call(this, f, params) : f.apply(this, params); | ||
| curry$.call(this, f, params) : f.apply(this, params); | ||
| } : f; | ||
| } | ||
| function __in(x, arr){ | ||
| function in$(x, arr){ | ||
| var i = 0, l = arr.length >>> 0; | ||
@@ -773,9 +800,11 @@ while (i < l) if (x === arr[i++]) return true; | ||
| } | ||
| function __compose(f, g){ | ||
| function compose$(fs){ | ||
| return function(){ | ||
| return f(g.apply(this, arguments)); | ||
| } | ||
| var i, args = arguments; | ||
| for (i = fs.length; i > 0; --i) { args = [fs[i-1].apply(this, args)]; } | ||
| return args[0]; | ||
| }; | ||
| } | ||
| function __not(x){ return !x; } | ||
| function __import(obj, src){ | ||
| function not$(x){ return !x; } | ||
| function import$(obj, src){ | ||
| var own = {}.hasOwnProperty; | ||
@@ -782,0 +811,0 @@ for (var key in src) if (own.call(src, key)) obj[key] = src[key]; |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
49244
142.15%6
50%1540
108.96%3
50%1
Infinity%1
Infinity%