squint-cljs 0.4.75 → 0.4.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cli.js +16 -16
- package/lib/cljs.pprint.js +80 -80
- package/lib/compiler.js +237 -237
- package/lib/compiler.node.js +5 -5
- package/lib/compiler.sci.js +729 -729
- package/lib/node.nrepl_server.js +1 -1
- package/lib/squint.core.umd.js +1 -1
- package/package.json +1 -1
- package/src/squint/core.js +15 -8
- package/src/squint/set.js +121 -0
package/lib/node.nrepl_server.js
CHANGED
|
@@ -7,7 +7,7 @@ import*as esm_import$fs from"fs";import*as esm_import$net from"net";
|
|
|
7
7
|
var K9=function(a,b){a=a.indexOf(b);if(0>a)throw Error("out of input");return a},L9=function(a,b){if(a.length<b)throw Error("out of input");return a.slice(b)},M9=function(a,b){if(b>a.length)throw Error("out of input");return a.slice(0,b)},N9=function(a){return console.debug($APP.wp.g(" ",a))},kga=function(a){return function(b,c){b=$APP.jf(b);var d=$APP.fe.g(b,$APP.KG),e=$APP.fe.g(b,jga);c=$APP.zi.j(c,"id",d);c=$APP.r(e)?$APP.zi.j(c,"session",e):c;return a.g?a.g(b,c):a.call(null,b,c)}},mga=function(){var a=
|
|
8
8
|
lga;return function(b,c){b=$APP.Pm.j(b,O9,$APP.ri);return a.g?a.g(b,c):a.call(null,b,c)}},oga=function(){var a=nga();return function(b,c){N9($APP.F(["request",b]));return a.g?a.g(b,c):a.call(null,b,c)}},pga=function(a){return function(b,c){N9($APP.F(["response",c]));return a.g?a.g(b,c):a.call(null,b,c)}},nga=function(){var a=mga();return function(b,c){return a.g?a.g(b,c):a.call(null,b,c)}},P9=function(a){return $APP.zi.j($APP.Yh(new $APP.J(null,3,5,$APP.N,["major","minor","incremental"],null),$APP.Vu.h(a.split("."))),
|
|
9
9
|
"version-string",a)},qga=function(a,b,c){if($APP.r(a))if(a=Q9.h?Q9.h(a):Q9.call(null,a),$APP.r(a)){b=$APP.jf(b);var d=$APP.fe.g(b,$APP.s9),e=$APP.fe.g(b,$APP.l9),f=$APP.fe.g(b,$APP.u9);b=$APP.Qa;var k=$APP.hi,l=$APP.T6;$APP.Qa=e;$APP.hi=f;$APP.T6=d;try{var m=new $APP.Fa;d=$APP.Ta;e=$APP.Ua;$APP.Ta=!0;$APP.Ua=function(h){return m.append(h)};try{a.h?a.h(c):a.call(null,c)}finally{$APP.Ua=e,$APP.Ta=d}return $APP.t.h(m)}finally{$APP.T6=l,$APP.hi=k,$APP.Qa=b}}else return N9($APP.F(["Pretty-Printing is only supported for cider.nrepl.pprint/pprint"])),
|
|
10
|
-
$APP.Oi.l($APP.F([c]));else return $APP.Oi.l($APP.F([c]))},sga=function(a){a:{var b=$APP.vq;$APP.vq=$APP.u(R9);try{var c=$APP.
|
|
10
|
+
$APP.Oi.l($APP.F([c]));else return $APP.Oi.l($APP.F([c]))},sga=function(a){a:{var b=$APP.vq;$APP.vq=$APP.u(R9);try{var c=$APP.Yt(a,new $APP.n(null,5,[$APP.np,$APP.mp,$APP.Oq,rga,$APP.Nt,!0,$APP.jt,!0,$APP.vs,!0],null),null);break a}finally{$APP.vq=b}c=void 0}c=$APP.jf(c);a=$APP.fe.g(c,$APP.Xt);c=$APP.fe.g(c,$APP.S);a=$APP.Wj("(async function () {\n%s\n}) ()","%s",a);$APP.Jf(R9,c);return a},yga=function(a,b){var c=$APP.jf(a);$APP.fe.g(c,$APP.S);a=$APP.fe.g(c,tga);$APP.fe.g(c,$APP.Wk);$APP.fe.g(c,uga);
|
|
11
11
|
$APP.fe.g(c,vga);return Promise.resolve(a).then(sga).then(function(d){$APP.FG.l($APP.F(["About to eval:"]));$APP.FG.l($APP.F([d]));return eval(d)}).then(function(d){d=new $APP.n(null,2,["ns",$APP.t.h($APP.u(R9)),"value",qga(wga.h(c),xga.h(c),d)],null);return b.g?b.g(c,d):b.call(null,c,d)}).catch(function(d){console.error(d);var e=$APP.JG.h($APP.mj(d));e=$APP.r(e)?e:d.message;$APP.r(e)&&(e=new $APP.n(null,1,["err",[$APP.t.h(e),"\n"].join("")],null),b.g?b.g(c,e):b.call(null,c,e));d=new $APP.n(null,
|
|
12
12
|
2,["ex",$APP.t.h(d),"ns",$APP.t.h($APP.vq)],null);return b.g?b.g(c,d):b.call(null,c,d)}).finally(function(){var d=new $APP.n(null,2,["ns",$APP.t.h($APP.u(R9)),"status",new $APP.J(null,1,5,$APP.N,["done"],null)],null);return b.g?b.g(c,d):b.call(null,c,d)})},S9=function(a){a=$APP.jf(a);$APP.fe.g(a,$APP.S);return null},lga=function(a,b){a=$APP.jf(a);var c=$APP.fe.g(a,O9),d=$APP.fe.g(T9,c);if($APP.r(d))return d.g?d.g(a,b):d.call(null,a,b);console.warn($APP.wp.g(" ",$APP.F(["Unhandled operation",c])));
|
|
13
13
|
c=new $APP.n(null,1,["status",new $APP.J(null,3,5,$APP.N,["error","unknown-op","done"],null)],null);return b.g?b.g(a,c):b.call(null,a,c)},zga=function(a){return function(b,c){return a.write(U9(c))}},Aga=function(a,b){N9($APP.F(["Connection accepted"]));b.setNoDelay(!0);var c=oga(),d=kga(pga(zga(b))),e=$APP.Si.h(null);b.on("data",function(f){var k=$APP.u(e);if($APP.r(k)){f=[$APP.t.h(k),$APP.t.h(f)].join("");$APP.Jf(e,null);var l=f}else l=f;a:for(f=$APP.F([$APP.Wu,!0]),k=$APP.lg;;){var m=$APP.Gf.j(V9,
|
package/lib/squint.core.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var squint;(squint||={}).core=(()=>{var P=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Zt=Object.prototype.hasOwnProperty;var Ht=(t,e)=>{for(var n in e)P(t,n,{get:e[n],enumerable:!0})},te=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Xt(e))!Zt.call(t,o)&&o!==n&&P(t,o,{get:()=>e[o],enumerable:!(r=Ut(e,o))||r.enumerable});return t};var ee=t=>te(P({},"__esModule",{value:!0}),t);var Rr={};Ht(Rr,{Atom:()=>mt,Cons:()=>xt,IIterable:()=>C,IIterable__iterator:()=>st,LazySeq:()=>En,NaN_QMARK_:()=>nr,PROTOCOL_SENTINEL:()=>je,_:()=>fe,_GT_:()=>ne,_GT__EQ_:()=>re,_LT_:()=>oe,_LT__EQ_:()=>ue,_PLUS_:()=>ie,_STAR_:()=>ce,_iterator:()=>N,aclone:()=>qn,add_watch:()=>Yn,alength:()=>Bn,apply:()=>Ye,array_QMARK_:()=>Et,aset:()=>$n,assoc:()=>v,assoc_BANG_:()=>A,assoc_in:()=>et,assoc_in_BANG_:()=>pe,atom:()=>Ne,boolean$:()=>Tn,boolean_QMARK_:()=>xr,bounded_count:()=>dr,butlast:()=>Rn,coll_QMARK_:()=>ur,comp:()=>_e,compare:()=>z,complement:()=>Mt,concat:()=>Rt,conj:()=>nt,conj_BANG_:()=>T,cons:()=>dt,constantly:()=>Fe,contains_QMARK_:()=>ot,count:()=>K,counted_QMARK_:()=>Dt,cycle:()=>cn,dec:()=>ye,deref:()=>wt,disj:()=>xe,disj_BANG_:()=>rt,dissoc:()=>he,dissoc_BANG_:()=>de,distinct:()=>fn,doall:()=>Pn,dorun:()=>zn,drop:()=>$,drop_last:()=>Sn,drop_while:()=>Ot,empty:()=>It,empty_QMARK_:()=>wn,es6_iterator:()=>O,even_QMARK_:()=>vt,every_QMARK_:()=>Lt,every_pred:()=>Jn,ex_cause:()=>sr,ex_data:()=>cr,ex_info:()=>ar,ex_message:()=>fr,false_QMARK_:()=>jn,ffirst:()=>we,filter:()=>V,filterv:()=>Ee,find:()=>hr,first:()=>R,fn_QMARK_:()=>er,fnil:()=>U,frequencies:()=>Mn,get:()=>d,get_in:()=>Gt,group_by:()=>vn,identical_QMARK_:()=>rn,identity:()=>St,inc:()=>ut,int_QMARK_:()=>Wt,integer_QMARK_:()=>lr,interleave:()=>Qt,interpose:()=>De,into:()=>Tt,into_array:()=>qt,iterable:()=>c,iterate:()=>Un,js_keys:()=>rr,js_obj:()=>Ln,juxt:()=>Xn,keep:()=>pn,keep_indexed:()=>Qe,key:()=>jt,keys:()=>Vt,last:()=>be,lazy:()=>a,list:()=>We,list_QMARK_:()=>Ve,map:()=>E,map_QMARK_:()=>Wn,map_indexed:()=>Se,mapcat:()=>Je,mapv:()=>At,max:()=>Pt,max_key:()=>wr,merge:()=>tn,merge_with:()=>en,meta:()=>pr,min:()=>Vn,min_key:()=>mr,mod:()=>yr,neg_QMARK_:()=>On,next:()=>Zn,nil_QMARK_:()=>Ie,not:()=>ht,not_any_QMARK_:()=>yn,not_empty:()=>Er,not_every_QMARK_:()=>ln,nth:()=>ct,number_QMARK_:()=>Ft,object_QMARK_:()=>ae,odd_QMARK_:()=>Ce,parse_long:()=>Ar,partial:()=>un,partition:()=>Ze,partition_all:()=>Xe,partition_by:()=>He,pos_QMARK_:()=>Gn,pr_str:()=>yt,println:()=>it,prn:()=>Te,quot:()=>vr,rand_int:()=>zt,rand_nth:()=>bn,range:()=>Ge,re_find:()=>Be,re_matches:()=>Le,re_pattern:()=>$e,re_seq:()=>Ct,reduce:()=>Q,reduce_kv:()=>Fn,reduced:()=>Ae,reduced_QMARK_:()=>lt,reductions:()=>ve,regexp_QMARK_:()=>ir,remove:()=>Re,remove_watch:()=>Cn,repeat:()=>D,repeatedly:()=>gn,replace:()=>mn,reset_BANG_:()=>bt,rest:()=>at,reverse:()=>_n,satisfies_QMARK_:()=>se,second:()=>me,select_keys:()=>Ue,seq:()=>M,seqable_QMARK_:()=>ft,set:()=>qe,shuffle:()=>hn,some:()=>$t,some_QMARK_:()=>kn,some_fn:()=>Dn,sort:()=>Bt,sort_by:()=>dn,split_at:()=>Qn,split_with:()=>Kn,str:()=>Ke,string_QMARK_:()=>Z,subs:()=>Yt,subvec:()=>ze,swap_BANG_:()=>Oe,system_time:()=>nn,t:()=>tr,take:()=>B,take_nth:()=>on,take_while:()=>Nt,to_array:()=>Hn,transduce:()=>tt,true_QMARK_:()=>In,truth_:()=>w,update:()=>sn,update_BANG_:()=>X,update_in:()=>an,val:()=>kt,vals:()=>or,vec:()=>G,vector:()=>W,vector_QMARK_:()=>Pe,warn_on_lazy_reusage_BANG_:()=>Me,with_meta:()=>_r,zero_QMARK_:()=>Nn,zipmap:()=>Mr});function s(t){if(t==null||t instanceof Function)return t;const e=typeof t;return e==="string"?(n,r)=>d(n,t,r):e==="object"?(n,r)=>d(t,n,r):t}function I(t,e){return t.every(function(n,r){return r===0||e(t[r-1],n)})}function ne(...t){return I(t,(e,n)=>e>n)}function re(...t){return I(t,(e,n)=>e>=n)}function oe(...t){return I(t,(e,n)=>e<n)}function ue(...t){return I(t,(e,n)=>e<=n)}function ie(...t){return t.reduce((e,n)=>e+n,0)}function ce(...t){return t.reduce((e,n)=>e*n,1)}function fe(...t){return t.length==1?0-t[0]:t.reduce((e,n)=>e-n)}function se(t,e){return e[t]}function A(t,e,n,...r){if(r.length%2!==0)throw new Error("Illegal argument: assoc expects an odd number of arguments.");switch(p(t)){case _:t.set(e,n);for(let o=0;o<r.length;o+=2)t.set(r[o],r[o+1]);break;case x:case y:t[e]=n;for(let o=0;o<r.length;o+=2)t[r[o]]=r[o+1];break;default:throw new Error(`Illegal argument: assoc! expects a Map, Array, or Object as the first argument, but got ${typeof t}.`)}return t}function q(t){switch(p(t)){case _:return new Map(t);case m:return new Set(t);case x:return[...t];case y:return{...t};default:throw new Error(`Don't know how to copy object of type ${typeof t}.`)}}function v(t,e,n,...r){t||(t={});const o=q(t);return A(o,e,n,...r),o}const _=1,x=2,y=3,g=4,m=5,j=6;function k(t){switch(t){case _:return new Map;case x:return[];case y:return{};case g:return new L;case m:return new Set;case j:return a(function*(){})}}function Y(t){return t.constructor===Object}function ae(t){return t!=null&&Y(t)}function p(t){if(t!=null){if(Y(t))return y;if(t instanceof Map)return _;if(t instanceof Set)return m;if(t instanceof L)return g;if(Array.isArray(t))return x;if(t instanceof F)return j;if(t instanceof Object)return y}}function le(t,e,n,r,o){const u=p(n);if(u!==_&&u!==x&&u!==y)throw new Error(`Illegal argument: ${e} expects the first argument to be a Map, Array, or Object.`);const i=[n];let f=n;for(let l=0;l<r.length-1;l+=1){const b=r[l];let h;f instanceof Map?h=f.get(b):h=f[b],h||(h=k(u)),i.push(h),f=h}i.push(o);for(let l=i.length-2;l>=0;l-=1)i[l]=t(i[l],r[l],i[l+1]);return i[0]}function et(t,e,n){return le(v,"assoc-in",t,e,n)}function pe(t,e,n){var r=t;const o=p(t);for(const u of e.splice(0,e.length-1)){let i=d(r,u);i===void 0&&(i=k(o),A(r,u,i)),r=i}return A(r,e[e.length-1],n),t}function _e(...t){if(t=t.map(s),t.length===0)return St;if(t.length===1)return t[0];const[e,...n]=t.slice().reverse();return function(...r){let o=e(...r);for(const u of n)o=u(o);return o}}function T(...t){if(t.length===0)return W();const[e,...n]=t;let r=e;switch(r==null&&(r=[]),p(r)){case m:for(const o of n)r.add(o);break;case g:r.unshift(...n.reverse());break;case x:r.push(...n);break;case _:for(const o of n)Array.isArray(o)?r.set(o[0],o[1]):c(o).forEach(u=>{r.set(u[0],u[1])});break;case y:for(const o of n)Array.isArray(o)?r[o[0]]=o[1]:Object.assign(r,o);break;default:throw new Error("Illegal argument: conj! expects a Set, Array, List, Map, or Object as the first argument.")}return r}function nt(...t){if(t.length===0)return W();const[e,...n]=t;let r=e;r==null&&(r=[]);let o,u;switch(p(r)){case m:return new Set([...r,...n]);case g:return new L(...n.reverse(),...r);case x:return[...r,...n];case _:o=new Map(r);for(const i of n)Array.isArray(i)?o.set(i[0],i[1]):c(i).forEach(f=>{o.set(f[0],f[1])});return o;case j:return a(function*(){yield*n,yield*r});case y:u={...r};for(const i of n)Array.isArray(i)?u[i[0]]=i[1]:Object.assign(u,i);return u;default:throw new Error("Illegal argument: conj expects a Set, Array, List, Map, or Object as the first argument.")}}function rt(t,...e){for(const n of e)t.delete(n);return t}function xe(t,...e){const n=new Set([...t]);return rt(n,...e)}function ot(t,e){switch(p(t)){case m:case _:return t.has(e);case void 0:return!1;default:return e in t}}function de(t,...e){for(const n of e)delete t[n];return t}function he(t,...e){const n={...t};for(const r of e)delete n[r];return n}function ut(t){return t+1}function ye(t){return t-1}function it(...t){console.log(...t)}function ct(t,e,n){if(t){var r=void 0;if(Array.isArray(t))r=t[e];else{const o=c(t);let u=0;for(const i of o)if(u++==e){r=i;break}}if(r!==void 0)return r}return n}function d(t,e,n=void 0){if(t==null)return n;let r;if(Y(t))return r=t[e],r===void 0?n:r;let o;switch(p(t)){case m:t.has(e)&&(r=e);break;case _:r=t.get(e);break;case x:r=t[e];break;default:if(o=t.get,o instanceof Function)try{r=t.get(e);break}catch{}r=t[e];break}return r!==void 0?r:n}function ft(t){return t==null||!!t[Symbol.iterator]}function c(t){if(t==null)return[];if(ft(t))return t;if(t instanceof Object)return Object.entries(t);throw new TypeError(`${t} is not iterable`)}const C=Symbol("Iterable"),st=Symbol.iterator;function N(t){return t[Symbol.iterator]()}const O=N;function M(t){if(t==null)return t;const e=c(t);return e.length===0||e.size===0||e[Symbol.iterator]().next().done?null:e}function R(t){const[e]=c(t);return e}function me(t){const[e,n]=c(t);return n}function we(t){return R(R(t))}function at(t){return a(function*(){let e=!0;for(const n of c(t))e?e=!1:yield n})}class S{value;constructor(e){this.value=e}_deref(){return this.value}}function be(t){t=c(t);let e;switch(p(t)){case x:return t[t.length-1];default:for(const n of t)e=n;return e}}function Ae(t){return new S(t)}function lt(t){return t instanceof S}function Q(t,e,n){t=s(t);let r,o;if(n===void 0){const u=c(e)[Symbol.iterator](),i=u.next();i.done?o=t():o=i.value,r=u}else o=e,r=c(n);if(o instanceof S)return o.value;for(const u of r)if(o=t(o,u),o instanceof S){o=o.value;break}return o}function*ge(t,e){const n=e.next();n.done?yield t():yield*pt(t,n.value,e)}function*pt(t,e,n){let r=e,o=n;for(;;){if(lt(r)){yield r.value;return}else yield r;const u=o.next();if(u.done)break;r=t(r,u.value)}}function ve(t,e,n){return t=s(t),a(n===void 0?function*(){yield*ge(t,c(e)[Symbol.iterator]())}:function*(){yield*pt(t,e,c(n)[Symbol.iterator]())})}var _t=!1;function Me(){_t=!0}class F{constructor(e){this.gen=e,this.usages=0}[Symbol.iterator](){if(this.usages++,this.usages>=2&&_t)try{throw new Error}catch(e){console.warn("Re-use of lazy value",e.stack)}return this.gen()}}F.prototype[C]=!0;function a(t){return new F(t)}class xt{constructor(e,n){this.x=e,this.coll=n}*[Symbol.iterator](){yield this.x,yield*c(this.coll)}}function dt(t,e){return new xt(t,e)}function E(t,...e){switch(t=s(t),e.length){case 0:return n=>(...r)=>{switch(r.length){case 0:return n();case 1:return n(r[0]);case 2:return n(r[0],t(r[1]));default:return n(r[0],t(...r.slice(1)))}};case 1:return a(function*(){for(const n of c(e[0]))yield t(n)});default:return a(function*(){const n=e.map(r=>O(c(r)));for(;;){const r=[];for(const o of n){const u=o.next();if(u.done)return;r.push(u.value)}yield t(...r)}})}}function V(t,e){return t=s(t),a(function*(){for(const n of c(e))w(t(n))&&(yield n)})}function Ee(t,e){return[...V(t,e)]}function Re(t,e){return V(Mt(t),e)}function Se(t,e){t=s(t);const n=[];let r=0;for(const o of c(e))n.push(t(r,o)),r++;return n}function Qe(t,e){t=s(t);const n=[];let r=0;for(const o of c(e)){const u=t(r,o);w(u)&&n.push(u),r++}return n}function Ke(...t){return t.join("")}function ht(t){return!w(t)}function Ie(t){return t==null}const je={};function ke(t){return t===null?"null":JSON.stringify(t,(e,n)=>{switch(p(n)){case m:case j:return[...n];case _:return Object.fromEntries(n);default:return n}})}function yt(...t){return t.map(ke).join(" ")}function Te(...t){it(yt(...t))}function mt(t){this.val=t,this._watches={},this._deref=()=>this.val,this._hasWatches=!1,this._reset_BANG_=e=>{const n=this.val;if(this.val=e,this._hasWatches)for(const r of Object.entries(this._watches)){const o=r[0],u=r[1];u(o,this,n,e)}return e},this._add_watch=(e,n)=>{this._watches[e]=n,this._hasWatches=!0},this._remove_watch=e=>{delete this._watches[e]}}function Ne(t){return new mt(t)}function wt(t){return t._deref()}function bt(t,e){t._reset_BANG_(e)}function Oe(t,e,...n){e=s(e);const r=e(wt(t),...n);return bt(t,r),r}function Ge(t,e,n){return a(function*(){let r=t,o=e,u=n;e===void 0&&(r=0,o=t);let i=r||0;for(u=n||1;o===void 0||i<o;)yield i,i+=u})}function Le(t,e){const n=t.exec(e);return n&&e===n[0]?n.length===1?n[0]:n:null}function Be(t,e){if(Z(e)){const n=t.exec(e);return n!=null?n.length===1?n[0]:[...n]:null}else throw new TypeError("re-find must match against a string.")}function $e(t){if(t instanceof RegExp)return t;const e=t.match(/^\(\?([dgimsuvy]*)\)/);return e?new RegExp(t.slice(e[0].length),e[1]):new RegExp(t)}function ze(t,e,n){return t.slice(e,n)}function W(...t){return t}function Pe(t){return p(t)===x}function At(...t){return[...E(...t)]}function G(t){return Et(t)?t:[...c(t)]}function qe(t){return new Set(c(t))}const gt=Symbol("IApply__apply");function Ye(t,...e){t=s(t);const n=e.slice(0,e.length-1),r=c(e[e.length-1]),o=t[gt];return o?o(...n,r):t(...n,...r)}function vt(t){return t%2==0}function Ce(t){return!vt(t)}function Mt(t){return t=s(t),(...e)=>ht(t(...e))}function Fe(t){return(...e)=>t}class L extends Array{constructor(...e){super(),this.push(...e)}}function Ve(t){return p(t)===g}function We(...t){return new L(...t)}function Et(t){return Array.isArray(t)}function J(t){return a(function*(){for(const e of t)yield*c(e)})}function Rt(...t){return J(t)}Rt[gt]=t=>J(t);function Je(t,...e){const n=E(t,...e);return J(n)}function St(t){return t}function Qt(...t){return a(function*(){const e=t.map(n=>O(c(n)));for(;;){const n=[];for(const r of e){const o=r.next();if(o.done)return;n.push(o.value)}yield*n}})}function De(t,e){return $(1,Qt(D(t),e))}function Ue(t,e){const n=p(t),r=k(n)||{};for(const o of e){const u=d(t,o);u!=null&&A(r,o,u)}return r}function Xe(t,...e){let n=t,r=e[0];return e.length===2&&([n,r]=e),Kt(t,n,[],r,!0)}function Ze(t,...e){let n=t,r=[],o=e[0];return e.length===2?[n,o]=e:e.length>2&&([n,r,o]=e),Kt(t,n,r,o,!1)}function Kt(t,e,n,r,o){return a(function*(){let u=[],i=0;for(const f of c(r))i<t&&(u.push(f),u.length===t&&(yield u,u=e<t?u.slice(e):[])),i++,i===e&&(i=0);u.length>0&&(u.length===t||o?yield u:n.length&&(u.push(...n.slice(0,t-u.length)),yield u))})}function He(t,e){return t=s(t),a(function*(){const n=O(e),r=n.next();r.done&&(yield*null);const o=r.value;let u=t(o),i=[o],f=[];for(;;){const l=n.next();if(l.done){yield i;break}const b=l.value,h=t(b);u==h?i.push(b):(yield i,f.push(b),i=f,u=h,f=[])}})}function It(t){const e=p(t);if(e!=null)return k(e);throw new Error(`Can't create empty of ${typeof t}`)}function tn(...t){const e=t[0];let n;return e==null?n={}:n=Tt(It(e),e),T(n,...t.slice(1))}function jt(t){return t[0]}function kt(t){return t[1]}function en(t,...e){t=s(t);var n=!1;for(const r of e)if(r!=null){n=!0;break}if(n){const r=(u,i)=>{const f=jt(i),l=kt(i);return ot(u,f)?v(u,f,t(d(u,f),l)):v(u,f,l)};return Q((u,i)=>Q(r,u||{},M(i)),e)}else return null}function nn(){return performance.now()}function Tt(...t){let e,n,r,o,u;switch(t.length){case 0:return[];case 1:return t[0];case 2:return nt(t[0]??[],...c(t[1]));case 3:return e=t[0],n=t[1],r=t[2],o=q(e),u=(i,f)=>f===void 0?i:T(i,f),tt(n,u,o,r);default:throw TypeError(`Invalid arity call of into: ${t.length}`)}}function rn(t,e){return t===e}function D(...t){if(t.length==0||t.length>2)throw new Error(`Invalid arity: ${t.length}`);return{[C]:!0,[st]:t.length==1?function*(){const e=t[0];for(;;)yield e}:function*(){const[e,n]=t;for(var r=0;r<e;r++)yield n}}}function B(t,e){return a(function*(){let n=t-1;for(const r of c(e))if(n-->=0&&(yield r),n<0)return})}function Nt(t,e){return t=s(t),a(function*(){for(const n of c(e))if(w(t(n)))yield n;else return})}function on(t,e){return t<=0?D(R(e)):a(function*(){let n=0;for(const r of c(e))n%t===0&&(yield r),n++})}function un(t,...e){return t=s(t),function(...n){return t(...e,...n)}}function cn(t){return a(function*(){for(;;)yield*t})}function $(t,e){return a(function*(){const n=N(c(e));for(let r=0;r<t;r++)n.next();yield*n})}function Ot(t,e){return t=s(t),a(function*(){const n=N(c(e));for(;;){const r=n.next();if(r.done)break;const o=r.value;if(!w(t(o))){yield o;break}}yield*n})}function fn(t){return a(function*(){const e=new Set;for(const n of c(t))e.has(n)||(yield n),e.add(n)})}function sn(t,e,n,...r){return n=s(n),v(t,e,n(d(t,e),...r))}function Gt(t,e,n){let r=t;for(const o of e)r=d(r,o);return r===void 0?n:r}function an(t,e,n,...r){return n=s(n),et(t,e,n(Gt(t,e),...r))}function U(t,e,...n){return t=s(t),function(r,...o){return r?t(r,...n,...o):t(e,...n,...o)}}function Lt(t,e){t=s(t);for(const n of c(e))if(!t(n))return!1;return!0}function ln(t,e){return!Lt(t,e)}function pn(t,e){return t=s(t),a(function*(){for(const n of c(e)){const r=t(n);w(r)&&(yield r)}})}function _n(t){return t=c(t),[...t].reverse()}function Bt(t,e){return e===void 0&&(e=t,t=void 0),t=s(t),e=c(e),[...e].sort(t||z)}function xn(t){return t===z?t:(e,n)=>{const r=t(e,n);return Ft(r)?r:r?-1:t(n,e)?1:0}}function dn(t,e,n){return n===void 0&&(n=e,e=z),t=s(t),e=s(e),Bt((r,o)=>{const u=xn(e),i=t(r),f=t(o);return u(i,f)},n)}function hn(t){return[...t].sort(function(e,n){return Math.random()-.5})}function $t(t,e){t=s(t);for(const n of c(e)){const r=t(n);if(w(r))return r}}function yn(t,e){return t=s(t),!$t(t,e)}function mn(t,e){return(Array.isArray(e)?At:E)(r=>{const o=t[r];return o!==void 0?o:r},e)}function wn(t){return!M(t)}function zt(t){return Math.floor(Math.random()*t)}function bn(t){const e=zt(K(t));return ct(t,e)}function An(t){return a(function*(){for(;;)yield t()})}function gn(t,e){e===void 0&&(e=t,t=void 0);const n=An(e);return t?B(t,n):n}function X(t,e,n,...r){const o=d(t,e);return A(t,e,n(o,...r))}function vn(t,e){const n={};for(const r of c(e)){const o=t(r);X(n,o,U(T,[]),r)}return n}function Mn(t){const e={},n=U(ut,0);for(const r of c(t))X(e,r,n);return e}class En{constructor(e){this.f=e,this.res=void 0}*[Symbol.iterator](){this.res===void 0&&(this.res=this.f(),this.f=null),yield*c(this.res)}}function Rn(t){const e=[...c(t)];return e.pop(),e.length>0?e:null}function Sn(...t){const[e,n]=t.length>1?t:[1,t[0]];return E((r,o)=>r,n,$(e,n))}function Qn(t,e){return[B(t,e),$(t,e)]}function Kn(t,e){return[Nt(t,e),Ot(t,e)]}function K(t){if(!t)return 0;const e=t.length||t.size;if(typeof e=="number")return e;let n=0;for(const r of c(t))n++;return n}function In(t){return t===!0}function jn(t){return t===!1}function kn(t){return t!=null}function Tn(t){return!!t}function Nn(t){return t===0}function On(t){return t<0}function Gn(t){return t>0}function Ln(...t){let e=0;const n={};for(;!(e>=t.length);)n[t[e]]=t[e+1],e=e+2;return n}function Bn(t){return t.length}function $n(t,e,n,...r){if(r.length==0)return t[e]=n,n;{const o=[e,n,...r],u=o[o.length-1];let i=t,f=0;const l=o.length-2;for(;f<l;f++)i=i[o[f]];return i[o[f]]=u,n}}function zn(t){for(const e of c(t));return null}function Pn(t){return G(t)}function qn(t){return[...t]}function Yn(t,e,n){return t._add_watch(e,n)}function Cn(t,e){return t._remove_watch(e)}function Fn(t,e,n){if(!n)return e;var r=e;for(const o of Object.entries(n))r=t(r,o[0],o[1]);return r}function Pt(t,e,...n){return e==null?t:Math.max(t,e,...n)}function Vn(t,e,...n){return e==null?t:Math.min(t,e,...n)}function Wn(t){return t instanceof Object}function Jn(...t){return(...e)=>{for(const n of t)for(const r of e)if(!n(r))return!1;return!0}}function Dn(...t){return(...e)=>{for(const n of t)for(const r of e){const o=n(r);if(o)return o}}}function qt(t,e){return G(e||t)}function Un(t,e){var n=e;return a(function*(){for(;;)yield n,n=t(n)})}function Xn(...t){return t=t.map(s),(...e)=>{const n=[];for(const r of t)n.push(r(...e));return n}}function Zn(t){if(Array.isArray(t)){const e=t.slice(1);return e.length>0?e:null}else return M(at(t))}function z(t,e){if(t===e)return 0;{if(t==null)return-1;if(e==null)return 1;const n=typeof t,r=typeof e;if(n==="number"&&r==="number"||n==="string"&&r==="string")return t===e?0:t<e?-1:1;throw new Error(`comparing ${n} to ${r}`)}}function Hn(t){return qt(t)}function w(t){return t!=null&&t!==!1}const tr=w;function Yt(t,e,n){return t.substring(e,n)}function er(t){return typeof t=="function"}function*Ct(t,e){const n=t.exec(e);if(n){const r=n[0],o=n.length===1?r:G(n);yield*dt(o,a(function*(){const u=n.index+Pt(1,r.length);u<=e.length&&(yield*Ct(t,Yt(e,u)))}))}}function nr(t){return Number.isNaN(t)}function Ft(t){return typeof t=="number"}function Vt(t){return t?Object.keys(t):null}function rr(t){return Vt(t)}function or(t){return t?Object.values(t):null}function Z(t){return typeof t=="string"}function ur(t){return p(t)!=null}function ir(t){return t instanceof RegExp}class H extends Error{constructor(e,n,r){super(e),this._data=n,this._cause=r}}function cr(t){return t instanceof H?t._data:null}function fr(t){return t instanceof Error?t.message:null}function sr(t){return t instanceof H?t._cause:null}function ar(t,e,n){return new H(t,e,n)}function Wt(t){return Number.isInteger(t)}const lr=Wt,Jt=Symbol("meta");function pr(t){return t instanceof Object?t[Jt]:null}function _r(t,e){const n=q(t);return n[Jt]=e,n}function xr(t){return t===!0||t===!1}function Dt(t){switch(p(t)){case m:return!0}return!1}function dr(t,e){return Dt(e)?K(e):K(B(t,e))}function hr(t,e){const n=d(t,e);if(n!==void 0)return[e,n]}function yr(t,e){return(t%e+e)%e}function mr(t,e,...n){if(n.length==0)return e;var r=t(e),o=e;return n.forEach(u=>{var i=t(u);i<=r&&(r=i,o=u)}),o}function wr(t,e,...n){if(n.length==0)return e;var r=t(e),o=e;return n.forEach(u=>{var i=t(u);i>=r&&(r=i,o=u)}),o}function br(t){throw new Error(`Expected string, got: ${typeof t}`)}function Ar(t){if(Z(t)){if(/^[+-]?\d+$/.test(t)){const e=parseInt(t);if(Number.MIN_SAFE_INTEGER<=e<=Number.MAX_SAFE_INTEGER)return e}return null}return br(t)}function gr(t){return t>=0?Math.floor(t):Math.ceil(t)}function vr(t,e){const n=t%e;return gr((t-n)/e)}function tt(t,...e){switch(e.length){case 2:{const n=e[0],r=e[1];return tt(t,n,n(),r)}default:{let n=e[0];const r=e[1],o=e[2];n=t(n);const u=Q(n,r,o);return n(u)}}}function Mr(t,e){const n={},r=c(t)[Symbol.iterator](),o=c(e)[Symbol.iterator]();let u,i;for(;u=r.next(),!(u.done||(i=o.next(),i.done));)n[u.value]=i.value;return n}function Er(t){return M(t)?t:null}return ee(Rr);})();
|
|
1
|
+
var squint;(squint||={}).core=(()=>{var q=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var te=(t,e)=>{for(var n in e)q(t,n,{get:e[n],enumerable:!0})},ee=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zt(e))!Ht.call(t,o)&&o!==n&&q(t,o,{get:()=>e[o],enumerable:!(r=Xt(e,o))||r.enumerable});return t};var ne=t=>ee(q({},"__esModule",{value:!0}),t);var Rr={};te(Rr,{Atom:()=>mt,Cons:()=>xt,IIterable:()=>C,IIterable__iterator:()=>st,LazySeq:()=>En,NaN_QMARK_:()=>nr,PROTOCOL_SENTINEL:()=>Te,_:()=>se,_GT_:()=>re,_GT__EQ_:()=>oe,_LT_:()=>ue,_LT__EQ_:()=>ie,_PLUS_:()=>ce,_STAR_:()=>fe,_iterator:()=>O,aclone:()=>qn,add_watch:()=>Yn,alength:()=>Bn,apply:()=>Ce,array_QMARK_:()=>Rt,aset:()=>$n,assoc:()=>v,assoc_BANG_:()=>A,assoc_in:()=>et,assoc_in_BANG_:()=>_e,atom:()=>Oe,boolean$:()=>jn,boolean_QMARK_:()=>xr,bounded_count:()=>dr,butlast:()=>Rn,coll_QMARK_:()=>ur,comp:()=>xe,compare:()=>P,complement:()=>Mt,concat:()=>St,conj:()=>nt,conj_BANG_:()=>N,cons:()=>dt,constantly:()=>Ve,contains_QMARK_:()=>ot,count:()=>K,counted_QMARK_:()=>Ut,cycle:()=>cn,dec:()=>me,deref:()=>wt,disj:()=>de,disj_BANG_:()=>rt,dissoc:()=>ye,dissoc_BANG_:()=>he,distinct:()=>fn,doall:()=>Pn,dorun:()=>zn,drop:()=>z,drop_last:()=>Sn,drop_while:()=>Gt,empty:()=>kt,empty_QMARK_:()=>wn,es6_iterator:()=>G,even_QMARK_:()=>vt,every_QMARK_:()=>Bt,every_pred:()=>Jn,ex_cause:()=>sr,ex_data:()=>cr,ex_info:()=>ar,ex_message:()=>fr,false_QMARK_:()=>kn,ffirst:()=>be,filter:()=>V,filterv:()=>Re,find:()=>hr,first:()=>R,fn_QMARK_:()=>er,fnil:()=>U,frequencies:()=>Mn,get:()=>d,get_in:()=>Lt,group_by:()=>vn,identical_QMARK_:()=>rn,identity:()=>Qt,inc:()=>ut,int_QMARK_:()=>Jt,integer_QMARK_:()=>lr,interleave:()=>Kt,interpose:()=>De,into:()=>Nt,into_array:()=>Yt,iterable:()=>c,iterate:()=>Un,js_keys:()=>rr,js_obj:()=>Ln,juxt:()=>Xn,keep:()=>pn,keep_indexed:()=>Ke,key:()=>Tt,keys:()=>Wt,last:()=>Ae,lazy:()=>a,list:()=>Et,list_QMARK_:()=>We,map:()=>E,map_QMARK_:()=>Wn,map_indexed:()=>Qe,mapcat:()=>Je,mapv:()=>At,max:()=>qt,max_key:()=>wr,merge:()=>tn,merge_with:()=>en,meta:()=>pr,min:()=>Vn,min_key:()=>mr,mod:()=>yr,neg_QMARK_:()=>On,next:()=>Zn,nil_QMARK_:()=>ke,not:()=>ht,not_any_QMARK_:()=>yn,not_empty:()=>Er,not_every_QMARK_:()=>ln,nth:()=>ct,number_QMARK_:()=>Vt,object_QMARK_:()=>le,odd_QMARK_:()=>Fe,parse_long:()=>Ar,partial:()=>un,partition:()=>Ze,partition_all:()=>Xe,partition_by:()=>He,pos_QMARK_:()=>Gn,pr_str:()=>yt,println:()=>it,prn:()=>Ne,quot:()=>vr,rand_int:()=>Pt,rand_nth:()=>bn,range:()=>Le,re_find:()=>$e,re_matches:()=>Be,re_pattern:()=>ze,re_seq:()=>Ft,reduce:()=>Q,reduce_kv:()=>Fn,reduced:()=>ge,reduced_QMARK_:()=>lt,reductions:()=>Me,regexp_QMARK_:()=>ir,remove:()=>Se,remove_watch:()=>Cn,repeat:()=>D,repeatedly:()=>gn,replace:()=>mn,reset_BANG_:()=>bt,rest:()=>at,reverse:()=>_n,satisfies_QMARK_:()=>ae,second:()=>we,select_keys:()=>Ue,seq:()=>M,seqable_QMARK_:()=>ft,set:()=>Ye,shuffle:()=>hn,some:()=>zt,some_QMARK_:()=>Tn,some_fn:()=>Dn,sort:()=>$t,sort_by:()=>dn,split_at:()=>Qn,split_with:()=>Kn,str:()=>Ie,string_QMARK_:()=>Z,subs:()=>Ct,subvec:()=>Pe,swap_BANG_:()=>Ge,system_time:()=>nn,t:()=>tr,take:()=>$,take_nth:()=>on,take_while:()=>Ot,to_array:()=>Hn,transduce:()=>tt,true_QMARK_:()=>In,truth_:()=>w,update:()=>sn,update_BANG_:()=>X,update_in:()=>an,val:()=>jt,vals:()=>or,vec:()=>L,vector:()=>W,vector_QMARK_:()=>qe,warn_on_lazy_reusage_BANG_:()=>Ee,with_meta:()=>_r,zero_QMARK_:()=>Nn,zipmap:()=>Mr});function s(t){if(t==null||t instanceof Function)return t;const e=typeof t;return e==="string"?(n,r)=>d(n,t,r):e==="object"?(n,r)=>d(t,n,r):t}function I(t,e){return t.every(function(n,r){return r===0||e(t[r-1],n)})}function re(...t){return I(t,(e,n)=>e>n)}function oe(...t){return I(t,(e,n)=>e>=n)}function ue(...t){return I(t,(e,n)=>e<n)}function ie(...t){return I(t,(e,n)=>e<=n)}function ce(...t){return t.reduce((e,n)=>e+n,0)}function fe(...t){return t.reduce((e,n)=>e*n,1)}function se(...t){return t.length==1?0-t[0]:t.reduce((e,n)=>e-n)}function ae(t,e){return e[t]}function A(t,e,n,...r){if(r.length%2!==0)throw new Error("Illegal argument: assoc expects an odd number of arguments.");switch(p(t)){case _:t.set(e,n);for(let o=0;o<r.length;o+=2)t.set(r[o],r[o+1]);break;case x:case y:t[e]=n;for(let o=0;o<r.length;o+=2)t[r[o]]=r[o+1];break;default:throw new Error(`Illegal argument: assoc! expects a Map, Array, or Object as the first argument, but got ${typeof t}.`)}return t}function k(t){switch(p(t)){case _:return new Map(t);case m:return new Set(t);case x:return[...t];case y:return{...t};default:throw new Error(`Don't know how to copy object of type ${typeof t}.`)}}function v(t,e,n,...r){t||(t={});const o=k(t);return A(o,e,n,...r),o}const _=1,x=2,y=3,g=4,m=5,T=6;function j(t){switch(t){case _:return new Map;case x:return[];case y:return{};case g:return new B;case m:return new Set;case T:return a(function*(){})}}function Y(t){return t.constructor===Object}function le(t){return t!=null&&Y(t)}function p(t){if(t!=null){if(Y(t))return y;if(t instanceof Map)return _;if(t instanceof Set)return m;if(t instanceof B)return g;if(Array.isArray(t))return x;if(t instanceof F)return T;if(t instanceof Object)return y}}function pe(t,e,n,r,o){const u=p(n);if(u!==_&&u!==x&&u!==y)throw new Error(`Illegal argument: ${e} expects the first argument to be a Map, Array, or Object.`);const i=[n];let f=n;for(let l=0;l<r.length-1;l+=1){const b=r[l];let h;f instanceof Map?h=f.get(b):h=f[b],h||(h=j(u)),i.push(h),f=h}i.push(o);for(let l=i.length-2;l>=0;l-=1)i[l]=t(i[l],r[l],i[l+1]);return i[0]}function et(t,e,n){return pe(v,"assoc-in",t,e,n)}function _e(t,e,n){var r=t;const o=p(t);for(const u of e.splice(0,e.length-1)){let i=d(r,u);i===void 0&&(i=j(o),A(r,u,i)),r=i}return A(r,e[e.length-1],n),t}function xe(...t){if(t=t.map(s),t.length===0)return Qt;if(t.length===1)return t[0];const[e,...n]=t.slice().reverse();return function(...r){let o=e(...r);for(const u of n)o=u(o);return o}}function N(...t){if(t.length===0)return W();const[e,...n]=t;let r=e;switch(r==null&&(r=[]),p(r)){case m:for(const o of n)r.add(o);break;case g:r.unshift(...n.reverse());break;case x:r.push(...n);break;case _:for(const o of n)Array.isArray(o)?r.set(o[0],o[1]):c(o).forEach(u=>{r.set(u[0],u[1])});break;case y:for(const o of n)Array.isArray(o)?r[o[0]]=o[1]:Object.assign(r,o);break;default:throw new Error("Illegal argument: conj! expects a Set, Array, List, Map, or Object as the first argument.")}return r}function nt(...t){if(t.length===0)return W();const[e,...n]=t;let r=e;r==null&&(r=Et());let o,u;switch(p(r)){case m:return new Set([...r,...n]);case g:return new B(...n.reverse(),...r);case x:return[...r,...n];case _:o=new Map(r);for(const i of n)Array.isArray(i)?o.set(i[0],i[1]):c(i).forEach(f=>{o.set(f[0],f[1])});return o;case T:return a(function*(){yield*n,yield*r});case y:u={...r};for(const i of n)Array.isArray(i)?u[i[0]]=i[1]:Object.assign(u,i);return u;default:throw new Error("Illegal argument: conj expects a Set, Array, List, Map, or Object as the first argument.")}}function rt(t,...e){for(const n of e)t.delete(n);return t}function de(t,...e){const n=new Set([...t]);return rt(n,...e)}function ot(t,e){switch(p(t)){case m:case _:return t.has(e);case void 0:return!1;default:return e in t}}function he(t,...e){for(const n of e)delete t[n];return t}function ye(t,...e){const n=k(t);switch(p(t)){case _:for(const r of e)n.delete(r);break;default:for(const r of e)delete n[r];break}return n}function ut(t){return t+1}function me(t){return t-1}function it(...t){console.log(...t)}function ct(t,e,n){if(t){var r=void 0;if(Array.isArray(t))r=t[e];else{const o=c(t);let u=0;for(const i of o)if(u++==e){r=i;break}}if(r!==void 0)return r}return n}function d(t,e,n=void 0){if(t==null)return n;let r;if(Y(t))return r=t[e],r===void 0?n:r;let o;switch(p(t)){case m:t.has(e)&&(r=e);break;case _:r=t.get(e);break;case x:r=t[e];break;default:if(o=t.get,o instanceof Function)try{r=t.get(e);break}catch{}r=t[e];break}return r!==void 0?r:n}function ft(t){return t==null||!!t[Symbol.iterator]}function c(t){if(t==null)return[];if(ft(t))return t;if(t instanceof Object)return Object.entries(t);throw new TypeError(`${t} is not iterable`)}const C=Symbol("Iterable"),st=Symbol.iterator;function O(t){return t[Symbol.iterator]()}const G=O;function M(t){if(t==null)return t;const e=c(t);return e.length===0||e.size===0||e[Symbol.iterator]().next().done?null:e}function R(t){const[e]=c(t);return e}function we(t){const[e,n]=c(t);return n}function be(t){return R(R(t))}function at(t){return a(function*(){let e=!0;for(const n of c(t))e?e=!1:yield n})}class S{value;constructor(e){this.value=e}_deref(){return this.value}}function Ae(t){t=c(t);let e;switch(p(t)){case x:return t[t.length-1];default:for(const n of t)e=n;return e}}function ge(t){return new S(t)}function lt(t){return t instanceof S}function Q(t,e,n){t=s(t);let r,o;if(n===void 0){const u=c(e)[Symbol.iterator](),i=u.next();i.done?o=t():o=i.value,r=u}else o=e,r=c(n);if(o instanceof S)return o.value;for(const u of r)if(o=t(o,u),o instanceof S){o=o.value;break}return o}function*ve(t,e){const n=e.next();n.done?yield t():yield*pt(t,n.value,e)}function*pt(t,e,n){let r=e,o=n;for(;;){if(lt(r)){yield r.value;return}else yield r;const u=o.next();if(u.done)break;r=t(r,u.value)}}function Me(t,e,n){return t=s(t),a(n===void 0?function*(){yield*ve(t,c(e)[Symbol.iterator]())}:function*(){yield*pt(t,e,c(n)[Symbol.iterator]())})}var _t=!1;function Ee(){_t=!0}class F{constructor(e){this.gen=e,this.usages=0}[Symbol.iterator](){if(this.usages++,this.usages>=2&&_t)try{throw new Error}catch(e){console.warn("Re-use of lazy value",e.stack)}return this.gen()}}F.prototype[C]=!0;function a(t){return new F(t)}class xt{constructor(e,n){this.x=e,this.coll=n}*[Symbol.iterator](){yield this.x,yield*c(this.coll)}}function dt(t,e){return new xt(t,e)}function E(t,...e){switch(t=s(t),e.length){case 0:return n=>(...r)=>{switch(r.length){case 0:return n();case 1:return n(r[0]);case 2:return n(r[0],t(r[1]));default:return n(r[0],t(...r.slice(1)))}};case 1:return a(function*(){for(const n of c(e[0]))yield t(n)});default:return a(function*(){const n=e.map(r=>G(c(r)));for(;;){const r=[];for(const o of n){const u=o.next();if(u.done)return;r.push(u.value)}yield t(...r)}})}}function V(t,e){return t=s(t),a(function*(){for(const n of c(e))w(t(n))&&(yield n)})}function Re(t,e){return[...V(t,e)]}function Se(t,e){return V(Mt(t),e)}function Qe(t,e){t=s(t);const n=[];let r=0;for(const o of c(e))n.push(t(r,o)),r++;return n}function Ke(t,e){t=s(t);const n=[];let r=0;for(const o of c(e)){const u=t(r,o);w(u)&&n.push(u),r++}return n}function Ie(...t){return t.join("")}function ht(t){return!w(t)}function ke(t){return t==null}const Te={};function je(t){return t===null?"null":JSON.stringify(t,(e,n)=>{switch(p(n)){case m:case T:return[...n];case _:return Object.fromEntries(n);default:return n}})}function yt(...t){return t.map(je).join(" ")}function Ne(...t){it(yt(...t))}function mt(t){this.val=t,this._watches={},this._deref=()=>this.val,this._hasWatches=!1,this._reset_BANG_=e=>{const n=this.val;if(this.val=e,this._hasWatches)for(const r of Object.entries(this._watches)){const o=r[0],u=r[1];u(o,this,n,e)}return e},this._add_watch=(e,n)=>{this._watches[e]=n,this._hasWatches=!0},this._remove_watch=e=>{delete this._watches[e]}}function Oe(t){return new mt(t)}function wt(t){return t._deref()}function bt(t,e){t._reset_BANG_(e)}function Ge(t,e,...n){e=s(e);const r=e(wt(t),...n);return bt(t,r),r}function Le(t,e,n){return a(function*(){let r=t,o=e,u=n;e===void 0&&(r=0,o=t);let i=r||0;for(u=n||1;o===void 0||i<o;)yield i,i+=u})}function Be(t,e){const n=t.exec(e);return n&&e===n[0]?n.length===1?n[0]:n:null}function $e(t,e){if(Z(e)){const n=t.exec(e);return n!=null?n.length===1?n[0]:[...n]:null}else throw new TypeError("re-find must match against a string.")}function ze(t){if(t instanceof RegExp)return t;const e=t.match(/^\(\?([dgimsuvy]*)\)/);return e?new RegExp(t.slice(e[0].length),e[1]):new RegExp(t)}function Pe(t,e,n){return t.slice(e,n)}function W(...t){return t}function qe(t){return p(t)===x}function At(...t){return[...E(...t)]}function L(t){return Rt(t)?t:[...c(t)]}function Ye(t){return new Set(c(t))}const gt=Symbol("IApply__apply");function Ce(t,...e){t=s(t);const n=e.slice(0,e.length-1),r=c(e[e.length-1]),o=t[gt];return o?o(...n,r):t(...n,...r)}function vt(t){return t%2==0}function Fe(t){return!vt(t)}function Mt(t){return t=s(t),(...e)=>ht(t(...e))}function Ve(t){return(...e)=>t}class B extends Array{constructor(...e){super(),this.push(...e)}}function We(t){return p(t)===g}function Et(...t){return new B(...t)}function Rt(t){return Array.isArray(t)}function J(t){return a(function*(){for(const e of t)yield*c(e)})}function St(...t){return J(t)}St[gt]=t=>J(t);function Je(t,...e){const n=E(t,...e);return J(n)}function Qt(t){return t}function Kt(...t){return a(function*(){const e=t.map(n=>G(c(n)));for(;;){const n=[];for(const r of e){const o=r.next();if(o.done)return;n.push(o.value)}yield*n}})}function De(t,e){return z(1,Kt(D(t),e))}function Ue(t,e){const n=p(t),r=j(n)||{};for(const o of e){const u=d(t,o);u!=null&&A(r,o,u)}return r}function Xe(t,...e){let n=t,r=e[0];return e.length===2&&([n,r]=e),It(t,n,[],r,!0)}function Ze(t,...e){let n=t,r=[],o=e[0];return e.length===2?[n,o]=e:e.length>2&&([n,r,o]=e),It(t,n,r,o,!1)}function It(t,e,n,r,o){return a(function*(){let u=[],i=0;for(const f of c(r))i<t&&(u.push(f),u.length===t&&(yield u,u=e<t?u.slice(e):[])),i++,i===e&&(i=0);u.length>0&&(u.length===t||o?yield u:n.length&&(u.push(...n.slice(0,t-u.length)),yield u))})}function He(t,e){return t=s(t),a(function*(){const n=G(e),r=n.next();r.done&&(yield*null);const o=r.value;let u=t(o),i=[o],f=[];for(;;){const l=n.next();if(l.done){yield i;break}const b=l.value,h=t(b);u==h?i.push(b):(yield i,f.push(b),i=f,u=h,f=[])}})}function kt(t){const e=p(t);if(e!=null)return j(e);throw new Error(`Can't create empty of ${typeof t}`)}function tn(...t){const e=t[0];let n;return e==null?n={}:n=Nt(kt(e),e),N(n,...t.slice(1))}function Tt(t){return t[0]}function jt(t){return t[1]}function en(t,...e){t=s(t);var n=!1;for(const r of e)if(r!=null){n=!0;break}if(n){const r=(u,i)=>{const f=Tt(i),l=jt(i);return ot(u,f)?v(u,f,t(d(u,f),l)):v(u,f,l)};return Q((u,i)=>Q(r,u||{},M(i)),e)}else return null}function nn(){return performance.now()}function Nt(...t){let e,n,r,o,u;switch(t.length){case 0:return[];case 1:return t[0];case 2:return nt(t[0]??[],...c(t[1]));case 3:return e=t[0],n=t[1],r=t[2],o=k(e),u=(i,f)=>f===void 0?i:N(i,f),tt(n,u,o,r);default:throw TypeError(`Invalid arity call of into: ${t.length}`)}}function rn(t,e){return t===e}function D(...t){if(t.length==0||t.length>2)throw new Error(`Invalid arity: ${t.length}`);return{[C]:!0,[st]:t.length==1?function*(){const e=t[0];for(;;)yield e}:function*(){const[e,n]=t;for(var r=0;r<e;r++)yield n}}}function $(t,e){return a(function*(){let n=t-1;for(const r of c(e))if(n-->=0&&(yield r),n<0)return})}function Ot(t,e){return t=s(t),a(function*(){for(const n of c(e))if(w(t(n)))yield n;else return})}function on(t,e){return t<=0?D(R(e)):a(function*(){let n=0;for(const r of c(e))n%t===0&&(yield r),n++})}function un(t,...e){return t=s(t),function(...n){return t(...e,...n)}}function cn(t){return a(function*(){for(;;)yield*t})}function z(t,e){return a(function*(){const n=O(c(e));for(let r=0;r<t;r++)n.next();yield*n})}function Gt(t,e){return t=s(t),a(function*(){const n=O(c(e));for(;;){const r=n.next();if(r.done)break;const o=r.value;if(!w(t(o))){yield o;break}}yield*n})}function fn(t){return a(function*(){const e=new Set;for(const n of c(t))e.has(n)||(yield n),e.add(n)})}function sn(t,e,n,...r){return n=s(n),v(t,e,n(d(t,e),...r))}function Lt(t,e,n){let r=t;for(const o of e)r=d(r,o);return r===void 0?n:r}function an(t,e,n,...r){return n=s(n),et(t,e,n(Lt(t,e),...r))}function U(t,e,...n){return t=s(t),function(r,...o){return r?t(r,...n,...o):t(e,...n,...o)}}function Bt(t,e){t=s(t);for(const n of c(e))if(!t(n))return!1;return!0}function ln(t,e){return!Bt(t,e)}function pn(t,e){return t=s(t),a(function*(){for(const n of c(e)){const r=t(n);w(r)&&(yield r)}})}function _n(t){return t=c(t),[...t].reverse()}function $t(t,e){return e===void 0&&(e=t,t=void 0),t=s(t),e=c(e),[...e].sort(t||P)}function xn(t){return t===P?t:(e,n)=>{const r=t(e,n);return Vt(r)?r:r?-1:t(n,e)?1:0}}function dn(t,e,n){return n===void 0&&(n=e,e=P),t=s(t),e=s(e),$t((r,o)=>{const u=xn(e),i=t(r),f=t(o);return u(i,f)},n)}function hn(t){return[...t].sort(function(e,n){return Math.random()-.5})}function zt(t,e){t=s(t);for(const n of c(e)){const r=t(n);if(w(r))return r}}function yn(t,e){return t=s(t),!zt(t,e)}function mn(t,e){return(Array.isArray(e)?At:E)(r=>{const o=t[r];return o!==void 0?o:r},e)}function wn(t){return!M(t)}function Pt(t){return Math.floor(Math.random()*t)}function bn(t){const e=Pt(K(t));return ct(t,e)}function An(t){return a(function*(){for(;;)yield t()})}function gn(t,e){e===void 0&&(e=t,t=void 0);const n=An(e);return t?$(t,n):n}function X(t,e,n,...r){const o=d(t,e);return A(t,e,n(o,...r))}function vn(t,e){const n={};for(const r of c(e)){const o=t(r);X(n,o,U(N,[]),r)}return n}function Mn(t){const e={},n=U(ut,0);for(const r of c(t))X(e,r,n);return e}class En{constructor(e){this.f=e,this.res=void 0}*[Symbol.iterator](){this.res===void 0&&(this.res=this.f(),this.f=null),yield*c(this.res)}}function Rn(t){const e=[...c(t)];return e.pop(),e.length>0?e:null}function Sn(...t){const[e,n]=t.length>1?t:[1,t[0]];return E((r,o)=>r,n,z(e,n))}function Qn(t,e){return[$(t,e),z(t,e)]}function Kn(t,e){return[Ot(t,e),Gt(t,e)]}function K(t){if(!t)return 0;const e=t.length||t.size;if(typeof e=="number")return e;let n=0;for(const r of c(t))n++;return n}function In(t){return t===!0}function kn(t){return t===!1}function Tn(t){return t!=null}function jn(t){return!!t}function Nn(t){return t===0}function On(t){return t<0}function Gn(t){return t>0}function Ln(...t){let e=0;const n={};for(;!(e>=t.length);)n[t[e]]=t[e+1],e=e+2;return n}function Bn(t){return t.length}function $n(t,e,n,...r){if(r.length==0)return t[e]=n,n;{const o=[e,n,...r],u=o[o.length-1];let i=t,f=0;const l=o.length-2;for(;f<l;f++)i=i[o[f]];return i[o[f]]=u,n}}function zn(t){for(const e of c(t));return null}function Pn(t){return L(t)}function qn(t){return[...t]}function Yn(t,e,n){return t._add_watch(e,n)}function Cn(t,e){return t._remove_watch(e)}function Fn(t,e,n){if(!n)return e;var r=e;for(const o of c(n))r=t(r,o[0],o[1]);return r}function qt(t,e,...n){return e==null?t:Math.max(t,e,...n)}function Vn(t,e,...n){return e==null?t:Math.min(t,e,...n)}function Wn(t){return t instanceof Object}function Jn(...t){return(...e)=>{for(const n of t)for(const r of e)if(!n(r))return!1;return!0}}function Dn(...t){return(...e)=>{for(const n of t)for(const r of e){const o=n(r);if(o)return o}}}function Yt(t,e){return L(e||t)}function Un(t,e){var n=e;return a(function*(){for(;;)yield n,n=t(n)})}function Xn(...t){return t=t.map(s),(...e)=>{const n=[];for(const r of t)n.push(r(...e));return n}}function Zn(t){if(Array.isArray(t)){const e=t.slice(1);return e.length>0?e:null}else return M(at(t))}function P(t,e){if(t===e)return 0;{if(t==null)return-1;if(e==null)return 1;const n=typeof t,r=typeof e;if(n==="number"&&r==="number"||n==="string"&&r==="string")return t===e?0:t<e?-1:1;throw new Error(`comparing ${n} to ${r}`)}}function Hn(t){return Yt(t)}function w(t){return t!=null&&t!==!1}const tr=w;function Ct(t,e,n){return t.substring(e,n)}function er(t){return typeof t=="function"}function*Ft(t,e){const n=t.exec(e);if(n){const r=n[0],o=n.length===1?r:L(n);yield*dt(o,a(function*(){const u=n.index+qt(1,r.length);u<=e.length&&(yield*Ft(t,Ct(e,u)))}))}}function nr(t){return Number.isNaN(t)}function Vt(t){return typeof t=="number"}function Wt(t){return t?Object.keys(t):null}function rr(t){return Wt(t)}function or(t){return t?Object.values(t):null}function Z(t){return typeof t=="string"}function ur(t){return p(t)!=null}function ir(t){return t instanceof RegExp}class H extends Error{constructor(e,n,r){super(e),this._data=n,this._cause=r}}function cr(t){return t instanceof H?t._data:null}function fr(t){return t instanceof Error?t.message:null}function sr(t){return t instanceof H?t._cause:null}function ar(t,e,n){return new H(t,e,n)}function Jt(t){return Number.isInteger(t)}const lr=Jt,Dt=Symbol("meta");function pr(t){return t instanceof Object?t[Dt]:null}function _r(t,e){const n=k(t);return n[Dt]=e,n}function xr(t){return t===!0||t===!1}function Ut(t){switch(p(t)){case m:return!0}return!1}function dr(t,e){return Ut(e)?K(e):K($(t,e))}function hr(t,e){const n=d(t,e);if(n!==void 0)return[e,n]}function yr(t,e){return(t%e+e)%e}function mr(t,e,...n){if(n.length==0)return e;var r=t(e),o=e;return n.forEach(u=>{var i=t(u);i<=r&&(r=i,o=u)}),o}function wr(t,e,...n){if(n.length==0)return e;var r=t(e),o=e;return n.forEach(u=>{var i=t(u);i>=r&&(r=i,o=u)}),o}function br(t){throw new Error(`Expected string, got: ${typeof t}`)}function Ar(t){if(Z(t)){if(/^[+-]?\d+$/.test(t)){const e=parseInt(t);if(Number.MIN_SAFE_INTEGER<=e<=Number.MAX_SAFE_INTEGER)return e}return null}return br(t)}function gr(t){return t>=0?Math.floor(t):Math.ceil(t)}function vr(t,e){const n=t%e;return gr((t-n)/e)}function tt(t,...e){switch(e.length){case 2:{const n=e[0],r=e[1];return tt(t,n,n(),r)}default:{let n=e[0];const r=e[1],o=e[2];n=t(n);const u=Q(n,r,o);return n(u)}}}function Mr(t,e){const n={},r=c(t)[Symbol.iterator](),o=c(e)[Symbol.iterator]();let u,i;for(;u=r.next(),!(u.done||(i=o.next(),i.done));)n[u.value]=i.value;return n}function Er(t){return M(t)?t:null}return ne(Rr);})();
|
package/package.json
CHANGED
package/src/squint/core.js
CHANGED
|
@@ -127,7 +127,7 @@ function emptyOfType(type) {
|
|
|
127
127
|
case ARRAY_TYPE:
|
|
128
128
|
return [];
|
|
129
129
|
case OBJECT_TYPE:
|
|
130
|
-
return {};
|
|
130
|
+
return {}; // Object.create?
|
|
131
131
|
case LIST_TYPE:
|
|
132
132
|
return new List();
|
|
133
133
|
case SET_TYPE:
|
|
@@ -289,7 +289,7 @@ export function conj(...xs) {
|
|
|
289
289
|
|
|
290
290
|
let o = _o;
|
|
291
291
|
if (o === null || o === undefined) {
|
|
292
|
-
o =
|
|
292
|
+
o = list();
|
|
293
293
|
}
|
|
294
294
|
let m, o2;
|
|
295
295
|
|
|
@@ -365,12 +365,19 @@ export function dissoc_BANG_(m, ...ks) {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
export function dissoc(m, ...ks) {
|
|
368
|
-
const m2 =
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
368
|
+
const m2 = copy(m);
|
|
369
|
+
switch (typeConst(m)) {
|
|
370
|
+
case MAP_TYPE:
|
|
371
|
+
for (const k of ks) {
|
|
372
|
+
m2.delete(k);
|
|
373
|
+
}
|
|
374
|
+
break;
|
|
375
|
+
default:
|
|
376
|
+
for (const k of ks) {
|
|
377
|
+
delete m2[k];
|
|
378
|
+
}
|
|
379
|
+
break;
|
|
372
380
|
}
|
|
373
|
-
|
|
374
381
|
return m2;
|
|
375
382
|
}
|
|
376
383
|
|
|
@@ -1661,7 +1668,7 @@ export function reduce_kv(f, init, m) {
|
|
|
1661
1668
|
return init;
|
|
1662
1669
|
}
|
|
1663
1670
|
var ret = init;
|
|
1664
|
-
for (const o of
|
|
1671
|
+
for (const o of iterable(m)) {
|
|
1665
1672
|
ret = f(ret, o[0], o[1]);
|
|
1666
1673
|
}
|
|
1667
1674
|
return ret;
|
package/src/squint/set.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as core from './core.js';
|
|
2
|
+
|
|
1
3
|
function _intersection2(x, y) {
|
|
2
4
|
if (x.size > y.size) {
|
|
3
5
|
const tmp = y;
|
|
@@ -21,3 +23,122 @@ export function intersection(...xs) {
|
|
|
21
23
|
default: return xs.reduce(_intersection2);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
|
|
27
|
+
function _difference2(x, y) {
|
|
28
|
+
const res = new Set();
|
|
29
|
+
for (const elem of x) {
|
|
30
|
+
if (!y.has(elem)) {
|
|
31
|
+
res.add(elem);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function difference(...xs) {
|
|
38
|
+
switch (xs.length) {
|
|
39
|
+
case 0: return null;
|
|
40
|
+
case 1: return xs[0];
|
|
41
|
+
case 2: return _difference2(xs[0], xs[1]);
|
|
42
|
+
default: return xs.reduce(_difference2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _union2(x, y) {
|
|
47
|
+
const res = new Set(x);
|
|
48
|
+
for (const elem of y) {
|
|
49
|
+
res.add(elem);
|
|
50
|
+
}
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function union(...xs) {
|
|
55
|
+
switch (xs.length) {
|
|
56
|
+
case 0: return null;
|
|
57
|
+
case 1: return xs[0];
|
|
58
|
+
case 2: return _union2(xs[0], xs[1]);
|
|
59
|
+
default: return xs.reduce(_union2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _subset_QMARK_2(x, y) {
|
|
64
|
+
for (const elem of x) {
|
|
65
|
+
if (!y.has(elem)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function subset_QMARK_(x, y) {
|
|
73
|
+
if (x === undefined) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (y === undefined) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (x.size > y.size) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return _subset_QMARK_2(x, y);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _superset_QMARK_2(x, y) {
|
|
86
|
+
for (const elem of x) {
|
|
87
|
+
if (!y.has(elem)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function superset_QMARK_(x, y) {
|
|
95
|
+
if (x === undefined) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (y === undefined) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
if (x.size < y.size) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return _superset_QMARK_2(y, x);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function select(pred, xset) {
|
|
108
|
+
if (xset === undefined) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const res = new Set();
|
|
112
|
+
for (const elem of xset) {
|
|
113
|
+
if (pred(elem)) {
|
|
114
|
+
res.add(elem);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return res;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function rename_keys(map, kmap) {
|
|
121
|
+
const ks = core.keys(kmap);
|
|
122
|
+
return ks.reduce((m, k) => {
|
|
123
|
+
const newKey = core.get(kmap, k);
|
|
124
|
+
if (core.contains_QMARK_(map, k)) {
|
|
125
|
+
return core.assoc(m, newKey, core.get(map, k));
|
|
126
|
+
}
|
|
127
|
+
return m;
|
|
128
|
+
}, core.dissoc(map, ...ks));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function rename(xrel, kmap) {
|
|
132
|
+
return core.set(core.map(x => rename_keys(x, kmap), xrel));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function project(xrel, ...ks) {
|
|
136
|
+
return core.set(core.map(x => core.select_keys(x, ...ks), xrel));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function map_invert(xmap) {
|
|
140
|
+
if (xmap === undefined) {
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
143
|
+
return core.reduce_kv((m, k, v) => core.assoc_BANG_(m, v, k), core.empty(xmap), xmap);
|
|
144
|
+
}
|