fable-standalone
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -66,7 +66,5 @@ import { defaultArg, value as value$$12, some } from "./Option.js"; | ||
} else { | ||
const mapping = function mapping(x, i$$3) { | ||
return f(i$$3, x); | ||
}; | ||
return source.map(mapping); | ||
return source.map(function (delegateArg0, delegateArg1) { | ||
return f(delegateArg1, delegateArg0); | ||
}); | ||
} | ||
@@ -85,7 +83,5 @@ } | ||
} else { | ||
const mapping$$1 = function mapping$$1(x$$1) { | ||
return source$$1.map(function mapping$$1(x$$1) { | ||
return f$$1(x$$1); | ||
}; | ||
return source$$1.map(mapping$$1); | ||
}); | ||
} | ||
@@ -151,12 +147,9 @@ } | ||
} else { | ||
const len$$2 = matchValue | 0; | ||
let acc = state; | ||
const res = new cons$$7(len$$2); | ||
const res = new cons$$7(matchValue); | ||
for (let i$$9 = 0; i$$9 <= array$$9.length - 1; i$$9++) { | ||
const patternInput = mapping$$2(acc, array$$9[i$$9]); | ||
const s$0027 = patternInput[1]; | ||
const h$0027 = patternInput[0]; | ||
res[i$$9] = h$0027; | ||
acc = s$0027; | ||
res[i$$9] = patternInput[0]; | ||
acc = patternInput[1]; | ||
} | ||
@@ -173,12 +166,9 @@ | ||
} else { | ||
const len$$3 = matchValue$$1 | 0; | ||
let acc$$1 = state$$1; | ||
const res$$1 = new cons$$8(len$$3); | ||
const res$$1 = new cons$$8(matchValue$$1); | ||
for (let i$$10 = array$$10.length - 1; i$$10 >= 0; i$$10--) { | ||
const patternInput$$1 = mapping$$3(array$$10[i$$10], acc$$1); | ||
const s$0027$$1 = patternInput$$1[1]; | ||
const h$0027$$1 = patternInput$$1[0]; | ||
res$$1[i$$10] = h$0027$$1; | ||
acc$$1 = s$0027$$1; | ||
res$$1[i$$10] = patternInput$$1[0]; | ||
acc$$1 = patternInput$$1[1]; | ||
} | ||
@@ -204,2 +194,3 @@ | ||
export function concat(arrays, cons$$9) { | ||
var arr$$3; | ||
const arrays$$1 = Array.from(arrays); | ||
@@ -221,3 +212,3 @@ const matchValue$$2 = arrays$$1.length | 0; | ||
{ | ||
if (ArrayBuffer.isView(arrays$$1[0])) { | ||
if (arr$$3 = arrays$$1[0], ArrayBuffer.isView(arr$$3)) { | ||
let totalIdx = 0; | ||
@@ -263,7 +254,7 @@ let totalLength = 0; | ||
if (matchValue$$3[0]) { | ||
const prev = matchValue$$3[1] | 0; | ||
dict.set(key, prev + 1); | ||
dict.set(key, matchValue$$3[1] + 1); | ||
} else { | ||
dict.set(key, 1); | ||
keys.push(key), null; | ||
const value$$3 = keys.push(key); | ||
value$$3, null; | ||
} | ||
@@ -280,3 +271,4 @@ } | ||
return filter(function predicate$$2($arg$$3) { | ||
return addToSet(projection$$1($arg$$3), hashSet); | ||
const arg00 = projection$$1($arg$$3); | ||
return addToSet(arg00, hashSet); | ||
}, array$$17); | ||
@@ -293,4 +285,6 @@ } | ||
export function contains(value$$4, array$$22, eq$$3) { | ||
const loop = function loop(i$$12) { | ||
const loop = function loop($i$$12$$75) { | ||
loop: while (true) { | ||
const i$$12 = $i$$12$$75; | ||
if (i$$12 >= array$$22.length) { | ||
@@ -301,4 +295,3 @@ return false; | ||
} else { | ||
const $i$$12$$51 = i$$12; | ||
i$$12 = $i$$12$$51 + 1; | ||
$i$$12$$75 = i$$12 + 1; | ||
continue loop; | ||
@@ -333,7 +326,7 @@ } | ||
if (matchValue$$4[0]) { | ||
const prev$$1 = matchValue$$4[1]; | ||
dict$$1.set(key$$2, new List(v, prev$$1)); | ||
dict$$1.set(key$$2, new List(v, matchValue$$4[1])); | ||
} else { | ||
addToDict(dict$$1, key$$2, new List(v, new List())); | ||
keys$$1.push(key$$2), null; | ||
const value$$5 = keys$$1.push(key$$2); | ||
value$$5, null; | ||
} | ||
@@ -343,3 +336,4 @@ } | ||
const result$$6 = map(function (key$$3) { | ||
return [key$$3, cons$$11.from(getItemFromDict(dict$$1, key$$3)).reverse()]; | ||
var array$$28; | ||
return [key$$3, (array$$28 = cons$$11.from(getItemFromDict(dict$$1, key$$3)), (array$$28.reverse()))]; | ||
}, keys$$1, Array); | ||
@@ -400,3 +394,4 @@ return result$$6; | ||
export function reverse(array$$33, cons$$18) { | ||
return array$$33.slice().reverse(); | ||
const array$$35 = array$$33.slice(); | ||
return array$$35.reverse(); | ||
} | ||
@@ -445,3 +440,4 @@ export function scan(folder, state$$2, array$$37, cons$$19) { | ||
} else { | ||
return array$$41.slice(count$$14); | ||
const count$$15 = count$$14 | 0; | ||
return array$$41.slice(count$$15); | ||
} | ||
@@ -474,3 +470,4 @@ } | ||
} else { | ||
return array$$45.slice(0, 0 + count$$18); | ||
const count$$19 = count$$18 | 0; | ||
return array$$45.slice(0, 0 + count$$19); | ||
} | ||
@@ -480,3 +477,4 @@ } | ||
iterate$$1(function (x$$3) { | ||
array$$47.push(x$$3), null; | ||
const value$$7 = array$$47.push(x$$3); | ||
value$$7, null; | ||
}, range); | ||
@@ -488,3 +486,4 @@ } | ||
if (i$$18 > -1) { | ||
array$$49.splice(i$$18, 1), null; | ||
const value$$8 = array$$49.splice(i$$18, 1); | ||
value$$8, null; | ||
return true; | ||
@@ -500,3 +499,4 @@ } else { | ||
if (i$$19 > -1) { | ||
array$$52.splice(i$$19, 1), null; | ||
const value$$9 = array$$52.splice(i$$19, 1); | ||
value$$9, null; | ||
return countRemoveAll(count$$20) + 1 | 0; | ||
@@ -534,3 +534,3 @@ } else { | ||
return [truncate(iTrue, res1), truncate(iFalse, res2)]; | ||
return [(truncate(iTrue, res1)), (truncate(iFalse, res2))]; | ||
} | ||
@@ -551,8 +551,6 @@ export function find(predicate$$11, array$$57) { | ||
export function findIndex(predicate$$15, array$$61) { | ||
var index; | ||
const matchValue$$6 = array$$61.findIndex(predicate$$15); | ||
if (index = matchValue$$6 | 0, index > -1) { | ||
const index$$1 = matchValue$$6 | 0; | ||
return index$$1 | 0; | ||
if (matchValue$$6 > -1) { | ||
return matchValue$$6 | 0; | ||
} else { | ||
@@ -563,8 +561,6 @@ return indexNotFound() | 0; | ||
export function tryFindIndex(predicate$$17, array$$63) { | ||
var index$$2; | ||
const matchValue$$7 = array$$63.findIndex(predicate$$17); | ||
if (index$$2 = matchValue$$7 | 0, index$$2 > -1) { | ||
const index$$3 = matchValue$$7 | 0; | ||
return index$$3; | ||
if (matchValue$$7 > -1) { | ||
return matchValue$$7; | ||
} else { | ||
@@ -575,4 +571,6 @@ return null; | ||
export function pick(chooser, array$$65) { | ||
const loop$$1 = function loop$$1(i$$22) { | ||
const loop$$1 = function loop$$1($i$$22$$143) { | ||
loop$$1: while (true) { | ||
const i$$22 = $i$$22$$143; | ||
if (i$$22 >= array$$65.length) { | ||
@@ -587,4 +585,3 @@ return indexNotFound(); | ||
} else { | ||
const $i$$22$$88 = i$$22; | ||
i$$22 = $i$$22$$88 + 1; | ||
$i$$22$$143 = i$$22 + 1; | ||
continue loop$$1; | ||
@@ -601,4 +598,6 @@ } | ||
export function tryPick(chooser$$1, array$$66) { | ||
const loop$$2 = function loop$$2(i$$23) { | ||
const loop$$2 = function loop$$2($i$$23$$146) { | ||
loop$$2: while (true) { | ||
const i$$23 = $i$$23$$146; | ||
if (i$$23 >= array$$66.length) { | ||
@@ -610,8 +609,6 @@ return null; | ||
if (matchValue$$9 == null) { | ||
const $i$$23$$91 = i$$23; | ||
i$$23 = $i$$23$$91 + 1; | ||
$i$$23$$146 = i$$23 + 1; | ||
continue loop$$2; | ||
} else { | ||
const res$$6 = matchValue$$9; | ||
return res$$6; | ||
return matchValue$$9; | ||
} | ||
@@ -627,4 +624,6 @@ } | ||
export function findBack(predicate$$19, array$$67) { | ||
const loop$$3 = function loop$$3(i$$24) { | ||
const loop$$3 = function loop$$3($i$$24$$149) { | ||
loop$$3: while (true) { | ||
const i$$24 = $i$$24$$149; | ||
if (i$$24 < 0) { | ||
@@ -635,4 +634,3 @@ return indexNotFound(); | ||
} else { | ||
const $i$$24$$94 = i$$24; | ||
i$$24 = $i$$24$$94 - 1; | ||
$i$$24$$149 = i$$24 - 1; | ||
continue loop$$3; | ||
@@ -648,4 +646,6 @@ } | ||
export function tryFindBack(predicate$$20, array$$68) { | ||
const loop$$4 = function loop$$4(i$$25) { | ||
const loop$$4 = function loop$$4($i$$25$$152) { | ||
loop$$4: while (true) { | ||
const i$$25 = $i$$25$$152; | ||
if (i$$25 < 0) { | ||
@@ -656,4 +656,3 @@ return null; | ||
} else { | ||
const $i$$25$$97 = i$$25; | ||
i$$25 = $i$$25$$97 - 1; | ||
$i$$25$$152 = i$$25 - 1; | ||
continue loop$$4; | ||
@@ -669,4 +668,6 @@ } | ||
export function findLastIndex(predicate$$21, array$$69) { | ||
const loop$$5 = function loop$$5(i$$26) { | ||
const loop$$5 = function loop$$5($i$$26$$155) { | ||
loop$$5: while (true) { | ||
const i$$26 = $i$$26$$155; | ||
if (i$$26 < 0) { | ||
@@ -677,4 +678,3 @@ return -1 | 0; | ||
} else { | ||
const $i$$26$$100 = i$$26; | ||
i$$26 = $i$$26$$100 - 1; | ||
$i$$26$$155 = i$$26 - 1; | ||
continue loop$$5; | ||
@@ -690,4 +690,6 @@ } | ||
export function findIndexBack(predicate$$22, array$$70) { | ||
const loop$$6 = function loop$$6(i$$27) { | ||
const loop$$6 = function loop$$6($i$$27$$158) { | ||
loop$$6: while (true) { | ||
const i$$27 = $i$$27$$158; | ||
if (i$$27 < 0) { | ||
@@ -698,4 +700,3 @@ return indexNotFound() | 0; | ||
} else { | ||
const $i$$27$$103 = i$$27; | ||
i$$27 = $i$$27$$103 - 1; | ||
$i$$27$$158 = i$$27 - 1; | ||
continue loop$$6; | ||
@@ -711,4 +712,6 @@ } | ||
export function tryFindIndexBack(predicate$$23, array$$71) { | ||
const loop$$7 = function loop$$7(i$$28) { | ||
const loop$$7 = function loop$$7($i$$28$$161) { | ||
loop$$7: while (true) { | ||
const i$$28 = $i$$28$$161; | ||
if (i$$28 < 0) { | ||
@@ -719,4 +722,3 @@ return null; | ||
} else { | ||
const $i$$28$$106 = i$$28; | ||
i$$28 = $i$$28$$106 - 1; | ||
$i$$28$$161 = i$$28 - 1; | ||
continue loop$$7; | ||
@@ -732,23 +734,20 @@ } | ||
export function choose(chooser$$2, array$$72, cons$$30) { | ||
const f$$7 = function f$$7(x$$4) { | ||
return chooser$$2(x$$4) != null; | ||
}; | ||
const g = function g(x$$5) { | ||
return value$$12(chooser$$2(x$$5)); | ||
}; | ||
const arr$$6 = array$$72.filter(f$$7); | ||
return map(g, arr$$6, cons$$30); | ||
const arr$$6 = array$$72.filter(function f$$7(x$$4) { | ||
const option = chooser$$2(x$$4); | ||
return option != null; | ||
}); | ||
return map(function g(x$$5) { | ||
const option$$1 = chooser$$2(x$$5); | ||
return value$$12(option$$1); | ||
}, arr$$6, cons$$30); | ||
} | ||
export function foldIndexed(folder$$2, state$$4, array$$74) { | ||
const folder$$3 = function folder$$3(acc$$2, x$$6, i$$29) { | ||
return folder$$2(i$$29, acc$$2, x$$6); | ||
}; | ||
return array$$74.reduce(folder$$3, state$$4); | ||
return array$$74.reduce(function (delegateArg0$$1, delegateArg1$$1, delegateArg2) { | ||
return folder$$2(delegateArg2, delegateArg0$$1, delegateArg1$$1); | ||
}, state$$4); | ||
} | ||
export function fold(folder$$4, state$$6, array$$76) { | ||
const folder$$5 = folder$$4; | ||
return array$$76.reduce(folder$$5, state$$6); | ||
return array$$76.reduce(function (delegateArg0$$2, delegateArg1$$2) { | ||
return folder$$4(delegateArg0$$2, delegateArg1$$2); | ||
}, state$$6); | ||
} | ||
@@ -819,3 +818,5 @@ export function iterate(action, array$$78) { | ||
if (ArrayBuffer.isView(target$$5) ? source$$5.length <= length : false) { | ||
return target$$5.set(source$$5, lower$$1); | ||
const target$$6 = target$$5; | ||
const source$$6 = source$$5; | ||
return target$$6.set(source$$6, lower$$1); | ||
} else { | ||
@@ -849,35 +850,27 @@ for (let i$$35 = 0; i$$35 <= length; i$$35++) { | ||
export function sort(xs$$2, comparer$$2) { | ||
const comparer$$3 = function comparer$$3(x$$12, y$$3) { | ||
const xs$$3 = copyArray(xs$$2); | ||
xs$$3.sort(function comparer$$3(x$$12, y$$3) { | ||
return comparer$$2.Compare(x$$12, y$$3); | ||
}; | ||
const xs$$3 = copyArray(xs$$2); | ||
xs$$3.sort(comparer$$3); | ||
}); | ||
return xs$$3; | ||
} | ||
export function sortBy(projection$$4, xs$$4, comparer$$4) { | ||
const comparer$$5 = function comparer$$5(x$$13, y$$4) { | ||
const xs$$5 = copyArray(xs$$4); | ||
xs$$5.sort(function comparer$$5(x$$13, y$$4) { | ||
return comparer$$4.Compare(projection$$4(x$$13), projection$$4(y$$4)); | ||
}; | ||
const xs$$5 = copyArray(xs$$4); | ||
xs$$5.sort(comparer$$5); | ||
}); | ||
return xs$$5; | ||
} | ||
export function sortDescending(xs$$6, comparer$$6) { | ||
const comparer$$7 = function comparer$$7(x$$14, y$$5) { | ||
const xs$$7 = copyArray(xs$$6); | ||
xs$$7.sort(function comparer$$7(x$$14, y$$5) { | ||
return comparer$$6.Compare(x$$14, y$$5) * -1; | ||
}; | ||
const xs$$7 = copyArray(xs$$6); | ||
xs$$7.sort(comparer$$7); | ||
}); | ||
return xs$$7; | ||
} | ||
export function sortByDescending(projection$$5, xs$$8, comparer$$8) { | ||
const comparer$$9 = function comparer$$9(x$$15, y$$6) { | ||
const xs$$9 = copyArray(xs$$8); | ||
xs$$9.sort(function comparer$$9(x$$15, y$$6) { | ||
return comparer$$8.Compare(projection$$5(x$$15), projection$$5(y$$6)) * -1; | ||
}; | ||
const xs$$9 = copyArray(xs$$8); | ||
xs$$9.sort(comparer$$9); | ||
}); | ||
return xs$$9; | ||
@@ -893,4 +886,5 @@ } | ||
const loop$$8 = function loop$$8(state$$9) { | ||
const loop$$8 = function loop$$8($state$$9$$220) { | ||
loop$$8: while (true) { | ||
const state$$9 = $state$$9$$220; | ||
const matchValue$$10 = generator(state$$9); | ||
@@ -901,4 +895,5 @@ | ||
const s$0027$$2 = matchValue$$10[1]; | ||
res$$8.push(x$$16), null; | ||
state$$9 = s$0027$$2; | ||
const value$$10 = res$$8.push(x$$16); | ||
value$$10, null; | ||
$state$$9$$220 = s$0027$$2; | ||
continue loop$$8; | ||
@@ -919,6 +914,4 @@ } | ||
iterateIndexed(function (i$$37, tupledArg) { | ||
const item1 = tupledArg[0]; | ||
const item2 = tupledArg[1]; | ||
res1$$1[i$$37] = item1; | ||
res2$$1[i$$37] = item2; | ||
res1$$1[i$$37] = tupledArg[0]; | ||
res2$$1[i$$37] = tupledArg[1]; | ||
}, array$$86); | ||
@@ -933,8 +926,5 @@ return [res1$$1, res2$$1]; | ||
iterateIndexed(function (i$$38, tupledArg$$1) { | ||
const item1$$1 = tupledArg$$1[0]; | ||
const item2$$1 = tupledArg$$1[1]; | ||
const item3 = tupledArg$$1[2]; | ||
res1$$2[i$$38] = item1$$1; | ||
res2$$2[i$$38] = item2$$1; | ||
res3[i$$38] = item3; | ||
res1$$2[i$$38] = tupledArg$$1[0]; | ||
res2$$2[i$$38] = tupledArg$$1[1]; | ||
res3[i$$38] = tupledArg$$1[2]; | ||
}, array$$87); | ||
@@ -948,3 +938,5 @@ return [res1$$2, res2$$2, res3]; | ||
const result$$11 = new Array(array1$$4.length); | ||
let result$$11; | ||
const len$$16 = array1$$4.length | 0; | ||
result$$11 = new Array(len$$16); | ||
@@ -962,3 +954,5 @@ for (let i$$39 = 0; i$$39 <= array1$$4.length - 1; i$$39++) { | ||
const result$$12 = new Array(array1$$5.length); | ||
let result$$12; | ||
const len$$17 = array1$$5.length | 0; | ||
result$$12 = new Array(len$$17); | ||
@@ -984,3 +978,4 @@ for (let i$$40 = 0; i$$40 <= array1$$5.length - 1; i$$40++) { | ||
const slice = array$$88.slice(start$$8, start$$8 + chunkSize); | ||
result$$13.push(slice), null; | ||
const value$$11 = result$$13.push(slice); | ||
value$$11, null; | ||
} | ||
@@ -1075,14 +1070,10 @@ | ||
export function foldBackIndexed(folder$$6, array$$101, state$$10) { | ||
const folder$$7 = function folder$$7(acc$$4, x$$18, i$$42) { | ||
return folder$$6(i$$42, x$$18, acc$$4); | ||
}; | ||
return array$$101.reduceRight(folder$$7, state$$10); | ||
return array$$101.reduceRight(function (delegateArg0$$3, delegateArg1$$3, delegateArg2$$1) { | ||
return folder$$6(delegateArg2$$1, delegateArg1$$3, delegateArg0$$3); | ||
}, state$$10); | ||
} | ||
export function foldBack(folder$$8, array$$103, state$$12) { | ||
const folder$$9 = function folder$$9(acc$$5, x$$19) { | ||
return folder$$8(x$$19, acc$$5); | ||
}; | ||
return array$$103.reduceRight(folder$$9, state$$12); | ||
return array$$103.reduceRight(function (delegateArg0$$4, delegateArg1$$4) { | ||
return folder$$8(delegateArg1$$4, delegateArg0$$4); | ||
}, state$$12); | ||
} | ||
@@ -1146,7 +1137,7 @@ export function foldIndexed2(folder$$10, state$$14, array1$$8, array2$$8) { | ||
} | ||
export function existsOffset($arg$$178, $arg$$179, $arg$$180) { | ||
export function existsOffset($predicate$$28$$275, $array$$109$$276, $index$$7$$277) { | ||
existsOffset: while (true) { | ||
const predicate$$28 = $arg$$178, | ||
array$$109 = $arg$$179, | ||
index$$7 = $arg$$180; | ||
const predicate$$28 = $predicate$$28$$275, | ||
array$$109 = $array$$109$$276, | ||
index$$7 = $index$$7$$277; | ||
@@ -1158,5 +1149,5 @@ if (index$$7 === array$$109.length) { | ||
} else { | ||
$arg$$178 = predicate$$28; | ||
$arg$$179 = array$$109; | ||
$arg$$180 = index$$7 + 1; | ||
$predicate$$28$$275 = predicate$$28; | ||
$array$$109$$276 = array$$109; | ||
$index$$7$$277 = index$$7 + 1; | ||
continue existsOffset; | ||
@@ -1171,8 +1162,8 @@ } | ||
} | ||
export function existsOffset2($arg$$183, $arg$$184, $arg$$185, $arg$$186) { | ||
export function existsOffset2($predicate$$30$$280, $array1$$13$$281, $array2$$13$$282, $index$$8$$283) { | ||
existsOffset2: while (true) { | ||
const predicate$$30 = $arg$$183, | ||
array1$$13 = $arg$$184, | ||
array2$$13 = $arg$$185, | ||
index$$8 = $arg$$186; | ||
const predicate$$30 = $predicate$$30$$280, | ||
array1$$13 = $array1$$13$$281, | ||
array2$$13 = $array2$$13$$282, | ||
index$$8 = $index$$8$$283; | ||
@@ -1184,6 +1175,6 @@ if (index$$8 === array1$$13.length) { | ||
} else { | ||
$arg$$183 = predicate$$30; | ||
$arg$$184 = array1$$13; | ||
$arg$$185 = array2$$13; | ||
$arg$$186 = index$$8 + 1; | ||
$predicate$$30$$280 = predicate$$30; | ||
$array1$$13$$281 = array1$$13; | ||
$array2$$13$$282 = array2$$13; | ||
$index$$8$$283 = index$$8 + 1; | ||
continue existsOffset2; | ||
@@ -1287,3 +1278,5 @@ } | ||
const res$$9 = new Array(max$$1(comparePrimitives, 0, source$$10.length - windowSize)); | ||
let res$$9; | ||
const len$$19 = max$$1(comparePrimitives, 0, source$$10.length - windowSize) | 0; | ||
res$$9 = new Array(len$$19); | ||
@@ -1290,0 +1283,0 @@ for (let i$$50 = windowSize; i$$50 <= source$$10.length; i$$50++) { |
@@ -39,8 +39,8 @@ export class CancellationToken { | ||
export class Trampoline { | ||
constructor() { | ||
this.callCount = 0; | ||
} | ||
static get maxTrampolineCallCount() { | ||
return 2000; | ||
} | ||
constructor() { | ||
this.callCount = 0; | ||
} | ||
incrementAndCheck() { | ||
@@ -47,0 +47,0 @@ return this.callCount++ > Trampoline.maxTrampolineCallCount; |
@@ -50,4 +50,6 @@ import { BigInteger$$$op_Inequality$$56F059C0 as BigInteger$0024$0024$0024op_Inequality$0024$002456F059C0, BigInteger$$$op_Equality$$56F059C0 as BigInteger$0024$0024$0024op_Equality$0024$002456F059C0, BigInteger$$$op_GreaterThanOrEqual$$56F059C0 as BigInteger$0024$0024$0024op_GreaterThanOrEqual$0024$002456F059C0, BigInteger$$$op_GreaterThan$$56F059C0 as BigInteger$0024$0024$0024op_GreaterThan$0024$002456F059C0, BigInteger$$$op_LessThanOrEqual$$56F059C0 as BigInteger$0024$0024$0024op_LessThanOrEqual$0024$002456F059C0, BigInteger$$$op_LessThan$$56F059C0 as BigInteger$0024$0024$0024op_LessThan$0024$002456F059C0, BigInteger$$$op_ExclusiveOr$$56F059C0 as BigInteger$0024$0024$0024op_ExclusiveOr$0024$002456F059C0, BigInteger$$$op_BitwiseOr$$56F059C0 as BigInteger$0024$0024$0024op_BitwiseOr$0024$002456F059C0, BigInteger$$$op_BitwiseAnd$$56F059C0 as BigInteger$0024$0024$0024op_BitwiseAnd$0024$002456F059C0, BigInteger$$$op_LeftShift$$62E082A2 as BigInteger$0024$0024$0024op_LeftShift$0024$002462E082A2, BigInteger$$$op_RightShift$$62E082A2 as BigInteger$0024$0024$0024op_RightShift$0024$002462E082A2, BigInteger$$$op_UnaryPlus$$Z665282C2 as BigInteger$0024$0024$0024op_UnaryPlus$0024$0024Z665282C2, BigInteger$$$op_UnaryNegation$$Z665282C2 as BigInteger$0024$0024$0024op_UnaryNegation$0024$0024Z665282C2, BigInteger$$$op_Modulus$$56F059C0 as BigInteger$0024$0024$0024op_Modulus$0024$002456F059C0, BigInteger$$$op_Division$$56F059C0 as BigInteger$0024$0024$0024op_Division$0024$002456F059C0, BigInteger$$$op_Multiply$$56F059C0 as BigInteger$0024$0024$0024op_Multiply$0024$002456F059C0, BigInteger$$$op_Subtraction$$56F059C0 as BigInteger$0024$0024$0024op_Subtraction$0024$002456F059C0, BigInteger$$$op_Addition$$56F059C0 as BigInteger$0024$0024$0024op_Addition$0024$002456F059C0, BigInteger$$get_IsOne as BigInteger$0024$0024get_IsOne, BigInteger$$get_IsZero as BigInteger$0024$0024get_IsZero, BigInteger$$get_Sign as BigInteger$0024$0024get_Sign, BigInteger$$get_ToDecimal as BigInteger$0024$0024get_ToDecimal, BigInteger$$get_ToDouble as BigInteger$0024$0024get_ToDouble, BigInteger$$get_ToSingle as BigInteger$0024$0024get_ToSingle, BigInteger$$get_ToUInt64 as BigInteger$0024$0024get_ToUInt64, BigInteger$$get_ToInt64 as BigInteger$0024$0024get_ToInt64, BigInteger$$get_ToUInt32 as BigInteger$0024$0024get_ToUInt32, BigInteger$$get_ToInt32 as BigInteger$0024$0024get_ToInt32, BigInteger$$get_ToUInt16 as BigInteger$0024$0024get_ToUInt16, BigInteger$$get_ToInt16 as BigInteger$0024$0024get_ToInt16, BigInteger$$get_ToByte as BigInteger$0024$0024get_ToByte, BigInteger$$get_ToSByte as BigInteger$0024$0024get_ToSByte, BigInteger$$$$002Ector$$Z524259A4 as BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259A4, BigInteger$$$$002Ector$$Z524259C1 as BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259C1, BigInteger$$$get_Two as BigInteger$0024$0024$0024get_Two, BigInteger$$$get_One as BigInteger$0024$0024$0024get_One, BigInteger$$$Abs$$Z665282C2 as BigInteger$0024$0024$0024Abs$0024$0024Z665282C2, BigInteger$$$Pow$$62E082A2 as BigInteger$0024$0024$0024Pow$0024$002462E082A2, BigInteger$$$GreatestCommonDivisor$$56F059C0 as BigInteger$0024$0024$0024GreatestCommonDivisor$0024$002456F059C0, BigInteger$$$DivRem$$56F059C0 as BigInteger$0024$0024$0024DivRem$0024$002456F059C0, BigInteger$$$Parse$$Z721C83C5 as BigInteger$0024$0024$0024Parse$0024$0024Z721C83C5, BigInteger$$$get_Zero as BigInteger$0024$0024$0024get_Zero, BigInteger } from "./BigInt/z.js"; | ||
export function fromInt32(i$$1) { | ||
var value; | ||
if (i$$1 > 2147483647) { | ||
return BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259C1(fromInteger(i$$1, false, 6)); | ||
return BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259C1((value = i$$1, (fromInteger(value, false, 6)))); | ||
} else { | ||
@@ -174,5 +176,7 @@ return BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259A4(i$$1); | ||
} else { | ||
const firstBitIndex = find(function predicate(i$$2) { | ||
let firstBitIndex; | ||
const list = ofSeq(rangeNumber(0, 1, 7)); | ||
firstBitIndex = find(function predicate(i$$2) { | ||
return (currByte & 1 << i$$2) > 0; | ||
}, ofSeq(rangeNumber(0, 1, 7))) | 0; | ||
}, list); | ||
return [(currByte ^ 254 << firstBitIndex) & 255, true]; | ||
@@ -188,47 +192,62 @@ } | ||
const value$$2 = isPositive ? value$$1 : BigInteger$0024$0024$0024op_Multiply$0024$002456F059C0(BigInteger$0024$0024$0024$0024002Ector$0024$0024Z524259A4(-1), value$$1); | ||
const mask32 = fromInt64(fromInteger(4294967295, false, 6)); | ||
let mask32; | ||
let i$$3; | ||
i$$3 = fromInteger(4294967295, false, 6); | ||
mask32 = fromInt64(i$$3); | ||
const loop = function loop(accumBytes, consumeValue, lowBitFound$$1) { | ||
const loop = function loop($accumBytes$$74, $consumeValue$$75, $lowBitFound$$1$$76) { | ||
var value$$9, value$$10, value$$11; | ||
loop: while (true) { | ||
const accumBytes = $accumBytes$$74, | ||
consumeValue = $consumeValue$$75, | ||
lowBitFound$$1 = $lowBitFound$$1$$76; | ||
if (consumeValue.CompareTo(zero) <= 0) { | ||
const accumBytes$$1 = isPositive ? skipWhile(function predicate$$1(b) { | ||
return b === 0; | ||
}, accumBytes) : skipWhile(function predicate$$2(b$$1) { | ||
return b$$1 === 255; | ||
}, accumBytes); | ||
let accumBytes$$1; | ||
if (isPositive) { | ||
accumBytes$$1 = skipWhile(function predicate$$1(b) { | ||
return b === 0; | ||
}, accumBytes); | ||
} else { | ||
accumBytes$$1 = skipWhile(function predicate$$2(b$$1) { | ||
return b$$1 === 255; | ||
}, accumBytes); | ||
} | ||
const isHighBitOne = (head(accumBytes$$1) & 128) !== 0; | ||
const accumBytes$$2 = (isPositive ? isHighBitOne : false) ? new List(0, accumBytes$$1) : (!isPositive ? !isHighBitOne : false) ? new List(255, accumBytes$$1) : accumBytes$$1; | ||
return reverse(ofList(accumBytes$$2, Uint8Array), Uint8Array); | ||
let array; | ||
array = ofList(accumBytes$$2, Uint8Array); | ||
return reverse(array, Uint8Array); | ||
} else { | ||
const currValue = toUInt32(BigInteger$0024$0024$0024op_BitwiseAnd$0024$002456F059C0(consumeValue, mask32)); | ||
let currValue; | ||
const x$$19 = BigInteger$0024$0024$0024op_BitwiseAnd$0024$002456F059C0(consumeValue, mask32); | ||
currValue = toUInt32(x$$19); | ||
if (isPositive) { | ||
const b0 = currValue & 0xFF; | ||
const b1 = currValue >>> 8 & 0xFF; | ||
const b2 = currValue >>> 16 & 0xFF; | ||
const b3 = currValue >>> 24 & 0xFF; | ||
const $accumBytes$$3 = accumBytes; | ||
const $consumeValue$$4 = consumeValue; | ||
accumBytes = new List(b3, new List(b2, new List(b1, new List(b0, $accumBytes$$3)))); | ||
consumeValue = BigInteger$0024$0024$0024op_RightShift$0024$002462E082A2($consumeValue$$4, 32); | ||
lowBitFound$$1 = false; | ||
let b0; | ||
b0 = currValue & 0xFF; | ||
let b1; | ||
const value$$5 = currValue >>> 8; | ||
b1 = value$$5 & 0xFF; | ||
let b2; | ||
const value$$6 = currValue >>> 16; | ||
b2 = value$$6 & 0xFF; | ||
let b3; | ||
const value$$7 = currValue >>> 24; | ||
b3 = value$$7 & 0xFF; | ||
$accumBytes$$74 = new List(b3, new List(b2, new List(b1, new List(b0, accumBytes)))); | ||
$consumeValue$$75 = BigInteger$0024$0024$0024op_RightShift$0024$002462E082A2(consumeValue, 32); | ||
$lowBitFound$$1$$76 = false; | ||
continue loop; | ||
} else { | ||
const patternInput = flipTwosComplement(currValue & 0xFF, lowBitFound$$1); | ||
const lowBitFound$$2 = patternInput[1]; | ||
const b0$$1 = patternInput[0]; | ||
const patternInput$$1 = flipTwosComplement(currValue >>> 8 & 0xFF, lowBitFound$$2); | ||
const lowBitFound$$3 = patternInput$$1[1]; | ||
const b1$$1 = patternInput$$1[0]; | ||
const patternInput$$2 = flipTwosComplement(currValue >>> 16 & 0xFF, lowBitFound$$3); | ||
const lowBitFound$$4 = patternInput$$2[1]; | ||
const b2$$1 = patternInput$$2[0]; | ||
const patternInput$$3 = flipTwosComplement(currValue >>> 24 & 0xFF, lowBitFound$$4); | ||
const lowBitFound$$5 = patternInput$$3[1]; | ||
const b3$$1 = patternInput$$3[0]; | ||
const $accumBytes$$5 = accumBytes; | ||
const $consumeValue$$6 = consumeValue; | ||
accumBytes = new List(b3$$1, new List(b2$$1, new List(b1$$1, new List(b0$$1, $accumBytes$$5)))); | ||
consumeValue = BigInteger$0024$0024$0024op_RightShift$0024$002462E082A2($consumeValue$$6, 32); | ||
lowBitFound$$1 = lowBitFound$$5; | ||
const patternInput = flipTwosComplement((currValue & 0xFF), lowBitFound$$1); | ||
const patternInput$$1 = flipTwosComplement((value$$9 = currValue >>> 8, (value$$9 & 0xFF)), patternInput[1]); | ||
const patternInput$$2 = flipTwosComplement((value$$10 = currValue >>> 16, (value$$10 & 0xFF)), patternInput$$1[1]); | ||
const patternInput$$3 = flipTwosComplement((value$$11 = currValue >>> 24, (value$$11 & 0xFF)), patternInput$$2[1]); | ||
$accumBytes$$74 = new List(patternInput$$3[0], new List(patternInput$$2[0], new List(patternInput$$1[0], new List(patternInput[0], accumBytes)))); | ||
$consumeValue$$75 = BigInteger$0024$0024$0024op_RightShift$0024$002462E082A2(consumeValue, 32); | ||
$lowBitFound$$1$$76 = patternInput$$3[1]; | ||
continue loop; | ||
@@ -256,7 +275,14 @@ } | ||
const loop$$1 = function loop$$1(accumUInt32, currIndex, bytesRemaining, lowBitFound$$6) { | ||
const loop$$1 = function loop$$1($accumUInt32$$80, $currIndex$$81, $bytesRemaining$$82, $lowBitFound$$6$$83) { | ||
loop$$1: while (true) { | ||
const accumUInt32 = $accumUInt32$$80, | ||
currIndex = $currIndex$$81, | ||
bytesRemaining = $bytesRemaining$$82, | ||
lowBitFound$$6 = $lowBitFound$$6$$83; | ||
if (bytesRemaining === 0) { | ||
const value$$14 = fold(function folder(acc, value$$12) { | ||
return BigInteger$0024$0024$0024op_Addition$0024$002456F059C0(BigInteger$0024$0024$0024op_LeftShift$0024$002462E082A2(acc, 32), fromInt64(fromInteger(value$$12, false, 6))); | ||
let value$$14; | ||
value$$14 = fold(function folder(acc, value$$12) { | ||
var i$$4; | ||
return BigInteger$0024$0024$0024op_Addition$0024$002456F059C0(BigInteger$0024$0024$0024op_LeftShift$0024$002462E082A2(acc, 32), (i$$4 = (fromInteger(value$$12, false, 6)), (fromInt64(i$$4)))); | ||
}, zero, accumUInt32); | ||
@@ -279,9 +305,6 @@ | ||
const value$$15 = (((buffer[0] | buffer[1] << 8 >>> 0) >>> 0 | buffer[2] << 16 >>> 0) >>> 0 | buffer[3] << 24 >>> 0) >>> 0; | ||
const $accumUInt32$$7 = accumUInt32; | ||
const $bytesRemaining$$9 = bytesRemaining; | ||
const $currIndex$$8 = currIndex; | ||
accumUInt32 = new List(value$$15, $accumUInt32$$7); | ||
currIndex = $currIndex$$8 + bytesToProcess; | ||
bytesRemaining = $bytesRemaining$$9 - bytesToProcess; | ||
lowBitFound$$6 = false; | ||
$accumUInt32$$80 = new List(value$$15, accumUInt32); | ||
$currIndex$$81 = currIndex + bytesToProcess; | ||
$bytesRemaining$$82 = bytesRemaining - bytesToProcess; | ||
$lowBitFound$$6$$83 = false; | ||
continue loop$$1; | ||
@@ -291,21 +314,10 @@ } else { | ||
const patternInput$$4 = flipTwosComplement(buffer[0], lowBitFound$$6); | ||
const lowBitFound$$7 = patternInput$$4[1]; | ||
const b0$$2 = patternInput$$4[0]; | ||
const patternInput$$5 = flipTwosComplement(buffer[1], lowBitFound$$7); | ||
const lowBitFound$$8 = patternInput$$5[1]; | ||
const b1$$2 = patternInput$$5[0]; | ||
const patternInput$$6 = flipTwosComplement(buffer[2], lowBitFound$$8); | ||
const lowBitFound$$9 = patternInput$$6[1]; | ||
const b2$$2 = patternInput$$6[0]; | ||
const patternInput$$7 = flipTwosComplement(buffer[3], lowBitFound$$9); | ||
const lowBitFound$$10 = patternInput$$7[1]; | ||
const b3$$2 = patternInput$$7[0]; | ||
const value$$16 = (((b0$$2 | b1$$2 << 8 >>> 0) >>> 0 | b2$$2 << 16 >>> 0) >>> 0 | b3$$2 << 24 >>> 0) >>> 0; | ||
const $accumUInt32$$10 = accumUInt32; | ||
const $bytesRemaining$$12 = bytesRemaining; | ||
const $currIndex$$11 = currIndex; | ||
accumUInt32 = new List(value$$16, $accumUInt32$$10); | ||
currIndex = $currIndex$$11 + bytesToProcess; | ||
bytesRemaining = $bytesRemaining$$12 - bytesToProcess; | ||
lowBitFound$$6 = lowBitFound$$10; | ||
const patternInput$$5 = flipTwosComplement(buffer[1], patternInput$$4[1]); | ||
const patternInput$$6 = flipTwosComplement(buffer[2], patternInput$$5[1]); | ||
const patternInput$$7 = flipTwosComplement(buffer[3], patternInput$$6[1]); | ||
const value$$16 = (((patternInput$$4[0] | patternInput$$5[0] << 8 >>> 0) >>> 0 | patternInput$$6[0] << 16 >>> 0) >>> 0 | patternInput$$7[0] << 24 >>> 0) >>> 0; | ||
$accumUInt32$$80 = new List(value$$16, accumUInt32); | ||
$currIndex$$81 = currIndex + bytesToProcess; | ||
$bytesRemaining$$82 = bytesRemaining - bytesToProcess; | ||
$lowBitFound$$6$$83 = patternInput$$7[1]; | ||
continue loop$$1; | ||
@@ -312,0 +324,0 @@ } |
@@ -14,11 +14,12 @@ import { List, declare, Record } from "../Types.js"; | ||
} | ||
export function BigNatModule$002EFFT$$$pow32(x, n) { | ||
export function BigNatModule$002EFFT$$$pow32($x$$1, $n$$2) { | ||
BigNatModule$002EFFT$$$pow32: while (true) { | ||
const x = $x$$1, | ||
n = $n$$2; | ||
if (n === 0) { | ||
return 1; | ||
} else if (n % 2 === 0) { | ||
const $n$$2 = n; | ||
const $x$$1 = x; | ||
x = $x$$1 * $x$$1; | ||
n = ~~($n$$2 / 2); | ||
$x$$1 = x * x; | ||
$n$$2 = ~~(n / 2); | ||
continue BigNatModule$002EFFT$$$pow32; | ||
@@ -33,13 +34,14 @@ } else { | ||
export function BigNatModule$002EFFT$$$leastBounding2Power(b) { | ||
const findBounding2Power = function findBounding2Power(b$$1, tp, i) { | ||
const findBounding2Power = function findBounding2Power($b$$1$$4, $tp$$5, $i$$6) { | ||
findBounding2Power: while (true) { | ||
const b$$1 = $b$$1$$4, | ||
tp = $tp$$5, | ||
i = $i$$6; | ||
if (b$$1 <= tp) { | ||
return [tp, i]; | ||
} else { | ||
const $b$$1$$3 = b$$1; | ||
const $i$$5 = i; | ||
const $tp$$4 = tp; | ||
b$$1 = $b$$1$$3; | ||
tp = $tp$$4 * 2; | ||
i = $i$$5 + 1; | ||
$b$$1$$4 = b$$1; | ||
$tp$$5 = tp * 2; | ||
$i$$6 = i + 1; | ||
continue findBounding2Power; | ||
@@ -73,14 +75,16 @@ } | ||
export const BigNatModule$002EFFT$002EFp$$$mtwo = 2; | ||
export function BigNatModule$002EFFT$002EFp$$$mpow(x$$3, n$$1) { | ||
export function BigNatModule$002EFFT$002EFp$$$mpow($x$$3$$9, $n$$1$$10) { | ||
BigNatModule$002EFFT$002EFp$$$mpow: while (true) { | ||
const x$$3 = $x$$3$$9, | ||
n$$1 = $n$$1$$10; | ||
if (n$$1 === 0) { | ||
return BigNatModule$002EFFT$002EFp$$$mone; | ||
} else if (n$$1 % 2 === 0) { | ||
const $n$$1$$7 = n$$1; | ||
const $x$$3$$6 = x$$3; | ||
x$$3 = toInt(op_Modulus(op_Multiply(fromInteger($x$$3$$6, true, 6), fromInteger($x$$3$$6, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
n$$1 = ~~($n$$1$$7 / 2); | ||
$x$$3$$9 = toInt(op_Modulus(op_Multiply(fromInteger(x$$3, true, 6), fromInteger(x$$3, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
$n$$1$$10 = ~~(n$$1 / 2); | ||
continue BigNatModule$002EFFT$002EFp$$$mpow; | ||
} else { | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$3, true, 6), fromInteger(BigNatModule$002EFFT$002EFp$$$mpow(toInt(op_Modulus(op_Multiply(fromInteger(x$$3, true, 6), fromInteger(x$$3, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0, ~~(n$$1 / 2)), true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
const y$$2 = BigNatModule$002EFFT$002EFp$$$mpow(toInt(op_Modulus(op_Multiply(fromInteger(x$$3, true, 6), fromInteger(x$$3, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0, ~~(n$$1 / 2)); | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$3, true, 6), fromInteger(y$$2, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
} | ||
@@ -91,14 +95,16 @@ | ||
} | ||
export function BigNatModule$002EFFT$002EFp$$$mpowL(x$$7, n$$2) { | ||
export function BigNatModule$002EFFT$002EFp$$$mpowL($x$$7$$11, $n$$2$$12) { | ||
BigNatModule$002EFFT$002EFp$$$mpowL: while (true) { | ||
const x$$7 = $x$$7$$11, | ||
n$$2 = $n$$2$$12; | ||
if (equals(n$$2, fromBits(0, 0, false))) { | ||
return BigNatModule$002EFFT$002EFp$$$mone; | ||
} else if (equals(op_Modulus(n$$2, fromBits(2, 0, false)), fromBits(0, 0, false))) { | ||
const $n$$2$$9 = n$$2; | ||
const $x$$7$$8 = x$$7; | ||
x$$7 = toInt(op_Modulus(op_Multiply(fromInteger($x$$7$$8, true, 6), fromInteger($x$$7$$8, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
n$$2 = op_Division($n$$2$$9, fromBits(2, 0, false)); | ||
$x$$7$$11 = toInt(op_Modulus(op_Multiply(fromInteger(x$$7, true, 6), fromInteger(x$$7, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
$n$$2$$12 = op_Division(n$$2, fromBits(2, 0, false)); | ||
continue BigNatModule$002EFFT$002EFp$$$mpowL; | ||
} else { | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$7, true, 6), fromInteger(BigNatModule$002EFFT$002EFp$$$mpowL(toInt(op_Modulus(op_Multiply(fromInteger(x$$7, true, 6), fromInteger(x$$7, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0, op_Division(n$$2, fromBits(2, 0, false))), true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
const y$$5 = BigNatModule$002EFFT$002EFp$$$mpowL(toInt(op_Modulus(op_Multiply(fromInteger(x$$7, true, 6), fromInteger(x$$7, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0, op_Division(n$$2, fromBits(2, 0, false))); | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$7, true, 6), fromInteger(y$$5, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
} | ||
@@ -129,5 +135,12 @@ | ||
const odd = res[offsetHalfN + j]; | ||
res[offset + j] = (even + (toInt(op_Modulus(op_Multiply(fromInteger(wj, true, 6), fromInteger(odd, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0)) % BigNatModule$002EFFT$002EFp$$$p; | ||
res[offsetHalfN + j] = (even + BigNatModule$002EFFT$002EFp$$$p - (toInt(op_Modulus(op_Multiply(fromInteger(wj, true, 6), fromInteger(odd, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0)) % BigNatModule$002EFFT$002EFp$$$p; | ||
wj = toInt(op_Modulus(op_Multiply(fromInteger(w, true, 6), fromInteger(wj, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
let y$$8; | ||
const x$$13 = wj; | ||
y$$8 = toInt(op_Modulus(op_Multiply(fromInteger(x$$13, true, 6), fromInteger(odd, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
res[offset + j] = (even + y$$8) % BigNatModule$002EFFT$002EFp$$$p; | ||
let y$$10; | ||
const x$$15 = wj; | ||
y$$10 = toInt(op_Modulus(op_Multiply(fromInteger(x$$15, true, 6), fromInteger(odd, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
res[offsetHalfN + j] = (even + BigNatModule$002EFFT$002EFp$$$p - y$$10) % BigNatModule$002EFFT$002EFp$$$p; | ||
const y$$11 = wj; | ||
wj = toInt(op_Modulus(op_Multiply(fromInteger(w, true, 6), fromInteger(y$$11, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
} | ||
@@ -137,7 +150,4 @@ } | ||
export function BigNatModule$002EFFT$$$computFftInPlace(n$$5, w$$1, u$$1) { | ||
const lambda$$1 = 1; | ||
const mu$$1 = 0; | ||
const res$$1 = fill(new Uint32Array(n$$5), 0, n$$5, BigNatModule$002EFFT$002EFp$$$mzero); | ||
const offset$$1 = 0; | ||
BigNatModule$002EFFT$$$computeFFT(lambda$$1, mu$$1, n$$5, w$$1, u$$1, res$$1, offset$$1); | ||
BigNatModule$002EFFT$$$computeFFT(1, 0, n$$5, w$$1, u$$1, res$$1, 0); | ||
return res$$1; | ||
@@ -157,9 +167,10 @@ } | ||
const w$$3 = BigNatModule$002EFFT$002EFp$$$m2PowNthRoot(k); | ||
const n$$7 = bigK | 0; | ||
const uT$$1 = BigNatModule$002EFFT$$$computFftInPlace(n$$7, w$$3, u$$2); | ||
const vT = BigNatModule$002EFFT$$$computFftInPlace(n$$7, w$$3, v); | ||
const rT = initialize(n$$7, function (i$$2) { | ||
return toInt(op_Modulus(op_Multiply(fromInteger(uT$$1[i$$2], true, 6), fromInteger(vT[i$$2], true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
const uT$$1 = BigNatModule$002EFFT$$$computFftInPlace(bigK, w$$3, u$$2); | ||
const vT = BigNatModule$002EFFT$$$computFftInPlace(bigK, w$$3, v); | ||
const rT = initialize(bigK, function (i$$2) { | ||
const x$$19 = uT$$1[i$$2]; | ||
const y$$14 = vT[i$$2]; | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$19, true, 6), fromInteger(y$$14, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
}, Uint32Array); | ||
const r = BigNatModule$002EFFT$$$computeInverseFftInPlace(n$$7, w$$3, rT); | ||
const r = BigNatModule$002EFFT$$$computeInverseFftInPlace(bigK, w$$3, rT); | ||
return r; | ||
@@ -177,14 +188,13 @@ } | ||
const patternInput = BigNatModule$002EFFT$$$leastBounding2Power(bound); | ||
const k$$1 = patternInput[1] | 0; | ||
const bigK$$1 = patternInput[0] | 0; | ||
const w$$4 = BigNatModule$002EFFT$002EFp$$$m2PowNthRoot(k$$1); | ||
const u$$5 = BigNatModule$002EFFT$$$padTo(bigK$$1, u$$4); | ||
const v$$2 = BigNatModule$002EFFT$$$padTo(bigK$$1, v$$1); | ||
const n$$9 = bigK$$1 | 0; | ||
const uT$$2 = BigNatModule$002EFFT$$$computFftInPlace(n$$9, w$$4, u$$5); | ||
const vT$$1 = BigNatModule$002EFFT$$$computFftInPlace(n$$9, w$$4, v$$2); | ||
const rT$$1 = initialize(n$$9, function (i$$4) { | ||
return toInt(op_Modulus(op_Multiply(fromInteger(uT$$2[i$$4], true, 6), fromInteger(vT$$1[i$$4], true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
const w$$4 = BigNatModule$002EFFT$002EFp$$$m2PowNthRoot(patternInput[1]); | ||
const u$$5 = BigNatModule$002EFFT$$$padTo(patternInput[0], u$$4); | ||
const v$$2 = BigNatModule$002EFFT$$$padTo(patternInput[0], v$$1); | ||
const uT$$2 = BigNatModule$002EFFT$$$computFftInPlace(patternInput[0], w$$4, u$$5); | ||
const vT$$1 = BigNatModule$002EFFT$$$computFftInPlace(patternInput[0], w$$4, v$$2); | ||
const rT$$1 = initialize(patternInput[0], function (i$$4) { | ||
const x$$20 = uT$$2[i$$4]; | ||
const y$$15 = vT$$1[i$$4]; | ||
return toInt(op_Modulus(op_Multiply(fromInteger(x$$20, true, 6), fromInteger(y$$15, true, 6)), BigNatModule$002EFFT$002EFp$$$p64)) >>> 0; | ||
}, Uint32Array); | ||
const r$$1 = BigNatModule$002EFFT$$$computeInverseFftInPlace(n$$9, w$$4, rT$$1); | ||
const r$$1 = BigNatModule$002EFFT$$$computeInverseFftInPlace(patternInput[0], w$$4, rT$$1); | ||
return map(BigNatModule$002EFFT$002EFp$$$toInt, r$$1, Int32Array); | ||
@@ -210,11 +220,12 @@ } | ||
} | ||
export function BigNatModule$$$pow64(x$$23, n$$15) { | ||
export function BigNatModule$$$pow64($x$$23$$48, $n$$15$$49) { | ||
BigNatModule$$$pow64: while (true) { | ||
const x$$23 = $x$$23$$48, | ||
n$$15 = $n$$15$$49; | ||
if (n$$15 === 0) { | ||
return fromBits(1, 0, false); | ||
} else if (n$$15 % 2 === 0) { | ||
const $n$$15$$11 = n$$15; | ||
const $x$$23$$10 = x$$23; | ||
x$$23 = op_Multiply($x$$23$$10, $x$$23$$10); | ||
n$$15 = ~~($n$$15$$11 / 2); | ||
$x$$23$$48 = op_Multiply(x$$23, x$$23); | ||
$n$$15$$49 = ~~(n$$15 / 2); | ||
continue BigNatModule$$$pow64; | ||
@@ -228,11 +239,12 @@ } else { | ||
} | ||
export function BigNatModule$$$pow32(x$$24, n$$16) { | ||
export function BigNatModule$$$pow32($x$$24$$50, $n$$16$$51) { | ||
BigNatModule$$$pow32: while (true) { | ||
const x$$24 = $x$$24$$50, | ||
n$$16 = $n$$16$$51; | ||
if (n$$16 === 0) { | ||
return 1; | ||
} else if (n$$16 % 2 === 0) { | ||
const $n$$16$$13 = n$$16; | ||
const $x$$24$$12 = x$$24; | ||
x$$24 = $x$$24$$12 * $x$$24$$12; | ||
n$$16 = ~~($n$$16$$13 / 2); | ||
$x$$24$$50 = x$$24 * x$$24; | ||
$n$$16$$51 = ~~(n$$16 / 2); | ||
continue BigNatModule$$$pow32; | ||
@@ -296,11 +308,12 @@ } else { | ||
export function BigNatModule$$$normN(n$$18) { | ||
const findLeastBound = function findLeastBound(na, i$$9) { | ||
const findLeastBound = function findLeastBound($na$$62, $i$$9$$63) { | ||
findLeastBound: while (true) { | ||
const na = $na$$62, | ||
i$$9 = $i$$9$$63; | ||
if (i$$9 === -1 ? true : na[i$$9] !== 0) { | ||
return i$$9 + 1 | 0; | ||
} else { | ||
const $i$$9$$15 = i$$9; | ||
const $na$$14 = na; | ||
na = $na$$14; | ||
i$$9 = $i$$9$$15 - 1; | ||
$na$$62 = na; | ||
$i$$9$$63 = i$$9 - 1; | ||
continue findLeastBound; | ||
@@ -403,4 +416,11 @@ } | ||
} | ||
export function BigNatModule$$$addP(i$$16, n$$25, c, p, q, r$$5) { | ||
export function BigNatModule$$$addP($i$$16$$75, $n$$25$$76, $c$$77, $p$$78, $q$$79, $r$$5$$80) { | ||
BigNatModule$$$addP: while (true) { | ||
const i$$16 = $i$$16$$75, | ||
n$$25 = $n$$25$$76, | ||
c = $c$$77, | ||
p = $p$$78, | ||
q = $q$$79, | ||
r$$5 = $r$$5$$80; | ||
if (i$$16 < n$$25) { | ||
@@ -410,13 +430,8 @@ const x$$32 = (i$$16 < p.bound ? p.digits[i$$16] : 0) + (i$$16 < q.bound ? q.digits[i$$16] : 0) + c | 0; | ||
const c$$1 = BigNatModule$$$divbase(x$$32) | 0; | ||
const $i$$16$$16 = i$$16; | ||
const $n$$25$$17 = n$$25; | ||
const $p$$18 = p; | ||
const $q$$19 = q; | ||
const $r$$5$$20 = r$$5; | ||
i$$16 = $i$$16$$16 + 1; | ||
n$$25 = $n$$25$$17; | ||
c = c$$1; | ||
p = $p$$18; | ||
q = $q$$19; | ||
r$$5 = $r$$5$$20; | ||
$i$$16$$75 = i$$16 + 1; | ||
$n$$25$$76 = n$$25; | ||
$c$$77 = c$$1; | ||
$p$$78 = p; | ||
$q$$79 = q; | ||
$r$$5$$80 = r$$5; | ||
continue BigNatModule$$$addP; | ||
@@ -431,8 +446,14 @@ } | ||
const r$$6 = BigNatModule$$$createN(rbound); | ||
const carry = 0; | ||
BigNatModule$$$addP(0, rbound, carry, p$$1, q$$1, r$$6); | ||
BigNatModule$$$addP(0, rbound, 0, p$$1, q$$1, r$$6); | ||
return BigNatModule$$$normN(r$$6); | ||
} | ||
export function BigNatModule$$$subP(i$$19, n$$26, c$$2, p$$2, q$$2, r$$7) { | ||
export function BigNatModule$$$subP($i$$19$$83, $n$$26$$84, $c$$2$$85, $p$$2$$86, $q$$2$$87, $r$$7$$88) { | ||
BigNatModule$$$subP: while (true) { | ||
const i$$19 = $i$$19$$83, | ||
n$$26 = $n$$26$$84, | ||
c$$2 = $c$$2$$85, | ||
p$$2 = $p$$2$$86, | ||
q$$2 = $q$$2$$87, | ||
r$$7 = $r$$7$$88; | ||
if (i$$19 < n$$26) { | ||
@@ -444,13 +465,8 @@ const x$$33 = (i$$19 < p$$2.bound ? p$$2.digits[i$$19] : 0) - (i$$19 < q$$2.bound ? q$$2.digits[i$$19] : 0) + c$$2 | 0; | ||
const c$$3 = BigNatModule$$$divbase(x$$33) | 0; | ||
const $i$$19$$21 = i$$19; | ||
const $n$$26$$22 = n$$26; | ||
const $p$$2$$23 = p$$2; | ||
const $q$$2$$24 = q$$2; | ||
const $r$$7$$25 = r$$7; | ||
i$$19 = $i$$19$$21 + 1; | ||
n$$26 = $n$$26$$22; | ||
c$$2 = c$$3; | ||
p$$2 = $p$$2$$23; | ||
q$$2 = $q$$2$$24; | ||
r$$7 = $r$$7$$25; | ||
$i$$19$$83 = i$$19 + 1; | ||
$n$$26$$84 = n$$26; | ||
$c$$2$$85 = c$$3; | ||
$p$$2$$86 = p$$2; | ||
$q$$2$$87 = q$$2; | ||
$r$$7$$88 = r$$7; | ||
continue BigNatModule$$$subP; | ||
@@ -461,13 +477,8 @@ } else { | ||
const c$$4 = BigNatModule$$$divbase(x$$34) - 1 | 0; | ||
const $i$$19$$26 = i$$19; | ||
const $n$$26$$27 = n$$26; | ||
const $p$$2$$28 = p$$2; | ||
const $q$$2$$29 = q$$2; | ||
const $r$$7$$30 = r$$7; | ||
i$$19 = $i$$19$$26 + 1; | ||
n$$26 = $n$$26$$27; | ||
c$$2 = c$$4; | ||
p$$2 = $p$$2$$28; | ||
q$$2 = $q$$2$$29; | ||
r$$7 = $r$$7$$30; | ||
$i$$19$$83 = i$$19 + 1; | ||
$n$$26$$84 = n$$26; | ||
$c$$2$$85 = c$$4; | ||
$p$$2$$86 = p$$2; | ||
$q$$2$$87 = q$$2; | ||
$r$$7$$88 = r$$7; | ||
continue BigNatModule$$$subP; | ||
@@ -486,4 +497,3 @@ } | ||
const r$$8 = BigNatModule$$$createN(rbound$$1); | ||
const carry$$1 = 0; | ||
const underflow$$1 = BigNatModule$$$subP(0, rbound$$1, carry$$1, p$$3, q$$3, r$$8); | ||
const underflow$$1 = BigNatModule$$$subP(0, rbound$$1, 0, p$$3, q$$3, r$$8); | ||
@@ -511,13 +521,14 @@ if (underflow$$1) { | ||
if (p$$7.bound === q$$4.bound) { | ||
const check = function check(pa, qa, i$$22) { | ||
const check = function check($pa$$96, $qa$$97, $i$$22$$98) { | ||
check: while (true) { | ||
const pa = $pa$$96, | ||
qa = $qa$$97, | ||
i$$22 = $i$$22$$98; | ||
if (i$$22 === -1) { | ||
return true; | ||
} else if (pa[i$$22] === qa[i$$22]) { | ||
const $i$$22$$33 = i$$22; | ||
const $pa$$31 = pa; | ||
const $qa$$32 = qa; | ||
pa = $pa$$31; | ||
qa = $qa$$32; | ||
i$$22 = $i$$22$$33 - 1; | ||
$pa$$96 = pa; | ||
$qa$$97 = qa; | ||
$i$$22$$98 = i$$22 - 1; | ||
continue check; | ||
@@ -543,4 +554,8 @@ } else { | ||
} else { | ||
const check$$1 = function check$$1(pa$$1, qa$$1, i$$23) { | ||
const check$$1 = function check$$1($pa$$1$$103, $qa$$1$$104, $i$$23$$105) { | ||
check$$1: while (true) { | ||
const pa$$1 = $pa$$1$$103, | ||
qa$$1 = $qa$$1$$104, | ||
i$$23 = $i$$23$$105; | ||
if (i$$23 === -1) { | ||
@@ -553,8 +568,5 @@ return 0; | ||
if (pai === qai) { | ||
const $i$$23$$36 = i$$23; | ||
const $pa$$1$$34 = pa$$1; | ||
const $qa$$1$$35 = qa$$1; | ||
pa$$1 = $pa$$1$$34; | ||
qa$$1 = $qa$$1$$35; | ||
i$$23 = $i$$23$$36 - 1; | ||
$pa$$1$$103 = pa$$1; | ||
$qa$$1$$104 = qa$$1; | ||
$i$$23$$105 = i$$23 - 1; | ||
continue check$$1; | ||
@@ -581,13 +593,14 @@ } else if (pai < qai) { | ||
} else { | ||
const check$$2 = function check$$2(pa$$2, qa$$2, i$$24) { | ||
const check$$2 = function check$$2($pa$$2$$108, $qa$$2$$109, $i$$24$$110) { | ||
check$$2: while (true) { | ||
const pa$$2 = $pa$$2$$108, | ||
qa$$2 = $qa$$2$$109, | ||
i$$24 = $i$$24$$110; | ||
if (i$$24 === -1) { | ||
return 0; | ||
} else if (pa$$2[i$$24] === qa$$2[i$$24]) { | ||
const $i$$24$$39 = i$$24; | ||
const $pa$$2$$37 = pa$$2; | ||
const $qa$$2$$38 = qa$$2; | ||
pa$$2 = $pa$$2$$37; | ||
qa$$2 = $qa$$2$$38; | ||
i$$24 = $i$$24$$39 - 1; | ||
$pa$$2$$108 = pa$$2; | ||
$qa$$2$$109 = qa$$2; | ||
$i$$24$$110 = i$$24 - 1; | ||
continue check$$2; | ||
@@ -633,15 +646,18 @@ } else if (pa$$2[i$$24] < qa$$2[i$$24]) { | ||
} | ||
export function BigNatModule$$$contributeArr(a$$4, i$$25, c$$5) { | ||
export function BigNatModule$$$contributeArr($a$$4$$123, $i$$25$$124, $c$$5$$125) { | ||
BigNatModule$$$contributeArr: while (true) { | ||
const a$$4 = $a$$4$$123, | ||
i$$25 = $i$$25$$124, | ||
c$$5 = $c$$5$$125; | ||
const x$$35 = op_Addition(fromInteger(a$$4[i$$25], false, 2), c$$5); | ||
const c$$6 = op_Division(x$$35, BigNatModule$$$baseNi64); | ||
const x$$38 = ~~toInt(op_BitwiseAnd(x$$35, BigNatModule$$$baseMaski64)) | 0; | ||
let x$$38; | ||
const value = op_BitwiseAnd(x$$35, BigNatModule$$$baseMaski64); | ||
x$$38 = ~~toInt(value); | ||
a$$4[i$$25] = x$$38; | ||
if (compare(c$$6, fromBits(0, 0, false)) > 0) { | ||
const $a$$4$$40 = a$$4; | ||
const $i$$25$$41 = i$$25; | ||
a$$4 = $a$$4$$40; | ||
i$$25 = $i$$25$$41 + 1; | ||
c$$5 = c$$6; | ||
$a$$4$$123 = a$$4; | ||
$i$$25$$124 = i$$25 + 1; | ||
$c$$5$$125 = c$$6; | ||
continue BigNatModule$$$contributeArr; | ||
@@ -666,18 +682,23 @@ } | ||
export function BigNatModule$$$mulSchoolBookBothSmall(p$$15, q$$11) { | ||
var value$$1; | ||
const r$$11 = BigNatModule$$$createN(2); | ||
const rak = op_Multiply(fromInteger(p$$15, false, 2), fromInteger(q$$11, false, 2)); | ||
BigNatModule$$$setCoeff(r$$11, 0, ~~toInt(op_BitwiseAnd(rak, BigNatModule$$$baseMaski64))); | ||
BigNatModule$$$setCoeff(r$$11, 0, (value$$1 = op_BitwiseAnd(rak, BigNatModule$$$baseMaski64), (~~toInt(value$$1)))); | ||
BigNatModule$$$setCoeff(r$$11, 1, ~~toInt(op_Division(rak, BigNatModule$$$baseNi64))); | ||
return BigNatModule$$$normN(r$$11); | ||
} | ||
export function BigNatModule$$$mulSchoolBookCarry(r$$12, c$$8, k$$4) { | ||
export function BigNatModule$$$mulSchoolBookCarry($r$$12$$130, $c$$8$$131, $k$$4$$132) { | ||
var value$$2; | ||
BigNatModule$$$mulSchoolBookCarry: while (true) { | ||
const r$$12 = $r$$12$$130, | ||
c$$8 = $c$$8$$131, | ||
k$$4 = $k$$4$$132; | ||
if (compare(c$$8, fromBits(0, 0, false)) > 0) { | ||
const rak$$1 = op_Addition(BigNatModule$$$coeff64(r$$12, k$$4), c$$8); | ||
BigNatModule$$$setCoeff(r$$12, k$$4, ~~toInt(op_BitwiseAnd(rak$$1, BigNatModule$$$baseMaski64))); | ||
const $k$$4$$43 = k$$4; | ||
const $r$$12$$42 = r$$12; | ||
r$$12 = $r$$12$$42; | ||
c$$8 = op_Division(rak$$1, BigNatModule$$$baseNi64); | ||
k$$4 = $k$$4$$43 + 1; | ||
BigNatModule$$$setCoeff(r$$12, k$$4, (value$$2 = op_BitwiseAnd(rak$$1, BigNatModule$$$baseMaski64), (~~toInt(value$$2)))); | ||
$r$$12$$130 = r$$12; | ||
$c$$8$$131 = op_Division(rak$$1, BigNatModule$$$baseNi64); | ||
$k$$4$$132 = k$$4 + 1; | ||
continue BigNatModule$$$mulSchoolBookCarry; | ||
@@ -690,2 +711,3 @@ } | ||
export function BigNatModule$$$mulSchoolBookOneSmall(p$$16, q$$12) { | ||
var value$$3; | ||
const bp = BigNatModule$$$bound(p$$16) | 0; | ||
@@ -699,3 +721,3 @@ const rbound$$3 = bp + 1 | 0; | ||
const rak$$2 = op_Addition(op_Addition(c$$9, BigNatModule$$$coeff64(r$$13, i$$28)), op_Multiply(BigNatModule$$$coeff64(p$$16, i$$28), q$$13)); | ||
BigNatModule$$$setCoeff(r$$13, i$$28, ~~toInt(op_BitwiseAnd(rak$$2, BigNatModule$$$baseMaski64))); | ||
BigNatModule$$$setCoeff(r$$13, i$$28, (value$$3 = op_BitwiseAnd(rak$$2, BigNatModule$$$baseMaski64), (~~toInt(value$$3)))); | ||
c$$9 = op_Division(rak$$2, BigNatModule$$$baseNi64); | ||
@@ -708,10 +730,8 @@ } | ||
export function BigNatModule$$$mulSchoolBookNeitherSmall(p$$17, q$$14) { | ||
var value$$4; | ||
const rbound$$4 = p$$17.bound + q$$14.bound | 0; | ||
const r$$14 = BigNatModule$$$createN(rbound$$4); | ||
const ra = r$$14.digits; | ||
const pa$$3 = p$$17.digits; | ||
const qa$$3 = q$$14.digits; | ||
for (let i$$29 = 0; i$$29 <= p$$17.bound - 1; i$$29++) { | ||
const pai$$1 = fromInteger(pa$$3[i$$29], false, 2); | ||
const pai$$1 = fromInteger(p$$17.digits[i$$29], false, 2); | ||
let c$$10 = fromBits(0, 0, false); | ||
@@ -721,5 +741,5 @@ let k$$5 = i$$29 | 0; | ||
for (let j$$1 = 0; j$$1 <= q$$14.bound - 1; j$$1++) { | ||
const qaj = fromInteger(qa$$3[j$$1], false, 2); | ||
const rak$$3 = op_Addition(op_Addition(fromInteger(ra[k$$5], false, 2), c$$10), op_Multiply(pai$$1, qaj)); | ||
ra[k$$5] = ~~toInt(op_BitwiseAnd(rak$$3, BigNatModule$$$baseMaski64)); | ||
const qaj = fromInteger(q$$14.digits[j$$1], false, 2); | ||
const rak$$3 = op_Addition(op_Addition(fromInteger(r$$14.digits[k$$5], false, 2), c$$10), op_Multiply(pai$$1, qaj)); | ||
r$$14.digits[k$$5] = (value$$4 = op_BitwiseAnd(rak$$3, BigNatModule$$$baseMaski64), (~~toInt(value$$4))); | ||
c$$10 = op_Division(rak$$3, BigNatModule$$$baseNi64); | ||
@@ -773,7 +793,8 @@ k$$5 = k$$5 + 1; | ||
export function BigNatModule$$$encodingGivenResultBits(bitsRes) { | ||
const selectFrom = function selectFrom(i$$31) { | ||
const selectFrom = function selectFrom($i$$31$$145) { | ||
selectFrom: while (true) { | ||
const i$$31 = $i$$31$$145; | ||
if (i$$31 + 1 < BigNatModule$$$table.length ? bitsRes < BigNatModule$$$table[i$$31 + 1].bigN : false) { | ||
const $i$$31$$44 = i$$31; | ||
i$$31 = $i$$31$$44 + 1; | ||
$i$$31$$145 = i$$31 + 1; | ||
continue selectFrom; | ||
@@ -804,4 +825,6 @@ } else { | ||
export function BigNatModule$$$wordBits(word) { | ||
const hi = function hi(k$$8) { | ||
const hi = function hi($k$$8$$147) { | ||
hi: while (true) { | ||
const k$$8 = $k$$8$$147; | ||
if (k$$8 === 0) { | ||
@@ -812,4 +835,3 @@ return 0; | ||
} else { | ||
const $k$$8$$45 = k$$8; | ||
k$$8 = $k$$8$$45 - 1; | ||
$k$$8$$147 = k$$8 - 1; | ||
continue hi; | ||
@@ -858,4 +880,7 @@ } | ||
const encoder = function encoder(i$$38, bi$$1) { | ||
const encoder = function encoder($i$$38$$154, $bi$$1$$155) { | ||
encoder: while (true) { | ||
const i$$38 = $i$$38$$154, | ||
bi$$1 = $bi$$1$$155; | ||
if (i$$38 === enc$$1.bigK ? true : bi$$1 > biMax) {} else { | ||
@@ -866,4 +891,4 @@ const pi = BigNatModule$$$extractBits(n$$28, enc$$1, bi$$1) | 0; | ||
const bi$$2 = bi$$1 + enc$$1.bigL | 0; | ||
i$$38 = i$$39; | ||
bi$$1 = bi$$2; | ||
$i$$38$$154 = i$$39; | ||
$bi$$1$$155 = bi$$2; | ||
continue encoder; | ||
@@ -895,4 +920,8 @@ } | ||
const evaluate = function evaluate(i$$41, j$$2, d$$3) { | ||
const evaluate = function evaluate($i$$41$$160, $j$$2$$161, $d$$3$$162) { | ||
evaluate: while (true) { | ||
const i$$41 = $i$$41$$160, | ||
j$$2 = $j$$2$$161, | ||
d$$3 = $d$$3$$162; | ||
if (i$$41 === enc$$3.bigK) {} else { | ||
@@ -907,7 +936,5 @@ if (j$$2 >= rbound$$5) {} else { | ||
const patternInput$$1 = d$$4 >= BigNatModule$$$baseBits ? [j$$2 + 1, d$$4 - BigNatModule$$$baseBits] : [j$$2, d$$4]; | ||
const j$$3 = patternInput$$1[0] | 0; | ||
const d$$5 = patternInput$$1[1] | 0; | ||
i$$41 = i$$43; | ||
j$$2 = j$$3; | ||
d$$3 = d$$5; | ||
$i$$41$$160 = i$$43; | ||
$j$$2$$161 = patternInput$$1[0]; | ||
$d$$3$$162 = patternInput$$1[1]; | ||
continue evaluate; | ||
@@ -947,6 +974,4 @@ } | ||
const q2 = mul(a1, b1); | ||
const p0 = q0; | ||
const p1 = BigNatModule$$$sub(q1, BigNatModule$$$add(q0, q2)); | ||
const p2 = q2; | ||
const r$$18 = BigNatModule$$$add(p0, BigNatModule$$$shiftUp(k$$9, BigNatModule$$$add(p1, BigNatModule$$$shiftUp(k$$9, p2)))); | ||
const r$$18 = BigNatModule$$$add(q0, BigNatModule$$$shiftUp(k$$9, BigNatModule$$$add(p1, BigNatModule$$$shiftUp(k$$9, q2)))); | ||
return r$$18; | ||
@@ -967,31 +992,33 @@ } else { | ||
export function BigNatModule$$$scaleSubInPlace(x$$57, f, a$$5, n$$30) { | ||
const invariant = function invariant(tupledArg) {}; | ||
const xres = x$$57; | ||
const xd = BigNatModule$$$degree(x$$57) | 0; | ||
const x$$58 = x$$57.digits; | ||
const ad = BigNatModule$$$degree(a$$5) | 0; | ||
const a$$6 = a$$5.digits; | ||
const patternInput$$2 = [x$$57.digits, BigNatModule$$$degree(x$$57)]; | ||
const patternInput$$3 = [a$$5.digits, BigNatModule$$$degree(a$$5)]; | ||
const f$$1 = fromInteger(f, false, 2); | ||
let j$$4 = 0; | ||
let z$$7 = op_Multiply(f$$1, fromInteger(a$$6[0], false, 2)); | ||
let z$$7 = op_Multiply(f$$1, fromInteger(patternInput$$3[0][0], false, 2)); | ||
while (compare(z$$7, fromBits(0, 0, false)) > 0 ? true : j$$4 < ad) { | ||
if (j$$4 > xd) { | ||
while (compare(z$$7, fromBits(0, 0, false)) > 0 ? true : j$$4 < patternInput$$3[1]) { | ||
if (j$$4 > patternInput$$2[1]) { | ||
throw new Error("scaleSubInPlace: pre-condition did not apply, result would be -ve"); | ||
} | ||
invariant([z$$7, j$$4, n$$30]); | ||
let zLo = ~~toInt(op_BitwiseAnd(z$$7, BigNatModule$$$baseMaski64)) | 0; | ||
let zHi = op_Division(z$$7, BigNatModule$$$baseNi64); | ||
const tupledArg = [z$$7, j$$4, n$$30]; | ||
let zLo; | ||
let value$$6; | ||
const x$$59 = z$$7; | ||
const value$$5 = op_BitwiseAnd(x$$59, BigNatModule$$$baseMaski64); | ||
value$$6 = ~~toInt(value$$5); | ||
zLo = value$$6; | ||
let zHi; | ||
const x$$60 = z$$7; | ||
zHi = op_Division(x$$60, BigNatModule$$$baseNi64); | ||
if (zLo <= x$$58[j$$4 + n$$30]) { | ||
x$$58[j$$4 + n$$30] = x$$58[j$$4 + n$$30] - zLo; | ||
if (zLo <= patternInput$$2[0][j$$4 + n$$30]) { | ||
patternInput$$2[0][j$$4 + n$$30] = patternInput$$2[0][j$$4 + n$$30] - zLo; | ||
} else { | ||
x$$58[j$$4 + n$$30] = x$$58[j$$4 + n$$30] + (BigNatModule$$$baseN - zLo); | ||
patternInput$$2[0][j$$4 + n$$30] = patternInput$$2[0][j$$4 + n$$30] + (BigNatModule$$$baseN - zLo); | ||
zHi = op_Addition(zHi, fromBits(1, 0, false)); | ||
} | ||
if (j$$4 < ad) { | ||
z$$7 = op_Addition(zHi, op_Multiply(f$$1, fromInteger(a$$6[j$$4 + 1], false, 2))); | ||
if (j$$4 < patternInput$$3[1]) { | ||
z$$7 = op_Addition(zHi, op_Multiply(f$$1, fromInteger(patternInput$$3[0][j$$4 + 1], false, 2))); | ||
} else { | ||
@@ -1004,3 +1031,3 @@ z$$7 = zHi; | ||
BigNatModule$$$normN(xres), null; | ||
BigNatModule$$$normN(x$$57), null; | ||
} | ||
@@ -1013,31 +1040,33 @@ export function BigNatModule$$$scaleSub(x$$61, f$$2, a$$7, n$$31) { | ||
export function BigNatModule$$$scaleAddInPlace(x$$62, f$$3, a$$8, n$$32) { | ||
const invariant$$1 = function invariant$$1(tupledArg$$1) {}; | ||
const xres$$1 = x$$62; | ||
const xd$$1 = BigNatModule$$$degree(x$$62) | 0; | ||
const x$$63 = x$$62.digits; | ||
const ad$$1 = BigNatModule$$$degree(a$$8) | 0; | ||
const a$$9 = a$$8.digits; | ||
const patternInput$$4 = [x$$62.digits, BigNatModule$$$degree(x$$62)]; | ||
const patternInput$$5 = [a$$8.digits, BigNatModule$$$degree(a$$8)]; | ||
const f$$4 = fromInteger(f$$3, false, 2); | ||
let j$$5 = 0; | ||
let z$$8 = op_Multiply(f$$4, fromInteger(a$$9[0], false, 2)); | ||
let z$$8 = op_Multiply(f$$4, fromInteger(patternInput$$5[0][0], false, 2)); | ||
while (compare(z$$8, fromBits(0, 0, false)) > 0 ? true : j$$5 < ad$$1) { | ||
if (j$$5 > xd$$1) { | ||
while (compare(z$$8, fromBits(0, 0, false)) > 0 ? true : j$$5 < patternInput$$5[1]) { | ||
if (j$$5 > patternInput$$4[1]) { | ||
throw new Error("scaleSubInPlace: pre-condition did not apply, result would be -ve"); | ||
} | ||
invariant$$1([z$$8, j$$5, n$$32]); | ||
let zLo$$1 = ~~toInt(op_BitwiseAnd(z$$8, BigNatModule$$$baseMaski64)) | 0; | ||
let zHi$$1 = op_Division(z$$8, BigNatModule$$$baseNi64); | ||
const tupledArg$$1 = [z$$8, j$$5, n$$32]; | ||
let zLo$$1; | ||
let value$$8; | ||
const x$$64 = z$$8; | ||
const value$$7 = op_BitwiseAnd(x$$64, BigNatModule$$$baseMaski64); | ||
value$$8 = ~~toInt(value$$7); | ||
zLo$$1 = value$$8; | ||
let zHi$$1; | ||
const x$$65 = z$$8; | ||
zHi$$1 = op_Division(x$$65, BigNatModule$$$baseNi64); | ||
if (zLo$$1 < BigNatModule$$$baseN - x$$63[j$$5 + n$$32]) { | ||
x$$63[j$$5 + n$$32] = x$$63[j$$5 + n$$32] + zLo$$1; | ||
if (zLo$$1 < BigNatModule$$$baseN - patternInput$$4[0][j$$5 + n$$32]) { | ||
patternInput$$4[0][j$$5 + n$$32] = patternInput$$4[0][j$$5 + n$$32] + zLo$$1; | ||
} else { | ||
x$$63[j$$5 + n$$32] = zLo$$1 - (BigNatModule$$$baseN - x$$63[j$$5 + n$$32]); | ||
patternInput$$4[0][j$$5 + n$$32] = zLo$$1 - (BigNatModule$$$baseN - patternInput$$4[0][j$$5 + n$$32]); | ||
zHi$$1 = op_Addition(zHi$$1, fromBits(1, 0, false)); | ||
} | ||
if (j$$5 < ad$$1) { | ||
z$$8 = op_Addition(zHi$$1, op_Multiply(f$$4, fromInteger(a$$9[j$$5 + 1], false, 2))); | ||
if (j$$5 < patternInput$$5[1]) { | ||
z$$8 = op_Addition(zHi$$1, op_Multiply(f$$4, fromInteger(patternInput$$5[0][j$$5 + 1], false, 2))); | ||
} else { | ||
@@ -1050,3 +1079,3 @@ z$$8 = zHi$$1; | ||
BigNatModule$$$normN(xres$$1), null; | ||
BigNatModule$$$normN(x$$62), null; | ||
} | ||
@@ -1060,23 +1089,19 @@ export function BigNatModule$$$scaleAdd(x$$66, f$$5, a$$10, n$$33) { | ||
const patternInput$$6 = [BigNatModule$$$degree(a$$11), BigNatModule$$$degree(x$$67)]; | ||
const degx = patternInput$$6[1] | 0; | ||
const dega = patternInput$$6[0] | 0; | ||
if (degx < dega + n$$34) { | ||
if (patternInput$$6[1] < patternInput$$6[0] + n$$34) { | ||
return 0; | ||
} else { | ||
const xa = x$$67.digits; | ||
const aa = a$$11.digits; | ||
let f$$6; | ||
if (dega === 0) { | ||
if (degx === n$$34) { | ||
f$$6 = ~~(xa[n$$34] / aa[0]); | ||
if (patternInput$$6[0] === 0) { | ||
if (patternInput$$6[1] === n$$34) { | ||
f$$6 = ~~(x$$67.digits[n$$34] / a$$11.digits[0]); | ||
} else { | ||
const f64 = op_Division(op_Addition(op_Multiply(fromInteger(xa[degx], false, 2), BigNatModule$$$baseNi64), fromInteger(xa[degx - 1], false, 2)), fromInteger(aa[0], false, 2)); | ||
const f64 = op_Division(op_Addition(op_Multiply(fromInteger(x$$67.digits[patternInput$$6[1]], false, 2), BigNatModule$$$baseNi64), fromInteger(x$$67.digits[patternInput$$6[1] - 1], false, 2)), fromInteger(a$$11.digits[0], false, 2)); | ||
f$$6 = ~~toInt(f64); | ||
} | ||
} else if (degx === dega + n$$34) { | ||
f$$6 = ~~(xa[degx] / (aa[dega] + 1)); | ||
} else if (patternInput$$6[1] === patternInput$$6[0] + n$$34) { | ||
f$$6 = ~~(x$$67.digits[patternInput$$6[1]] / (a$$11.digits[patternInput$$6[0]] + 1)); | ||
} else { | ||
const f64$$1 = op_Division(op_Addition(op_Multiply(fromInteger(xa[degx], false, 2), BigNatModule$$$baseNi64), fromInteger(xa[degx - 1], false, 2)), op_Addition(fromInteger(aa[dega], false, 2), fromBits(1, 0, false))); | ||
const f64$$1 = op_Division(op_Addition(op_Multiply(fromInteger(x$$67.digits[patternInput$$6[1]], false, 2), BigNatModule$$$baseNi64), fromInteger(x$$67.digits[patternInput$$6[1] - 1], false, 2)), op_Addition(fromInteger(a$$11.digits[patternInput$$6[0]], false, 2), fromBits(1, 0, false))); | ||
f$$6 = ~~toInt(f64$$1); | ||
@@ -1186,11 +1211,13 @@ } | ||
export function BigNatModule$$$hcf(a$$18, b$$13) { | ||
const hcfloop = function hcfloop(a$$19, b$$14) { | ||
const hcfloop = function hcfloop($a$$19$$206, $b$$14$$207) { | ||
hcfloop: while (true) { | ||
const a$$19 = $a$$19$$206, | ||
b$$14 = $b$$14$$207; | ||
if (BigNatModule$$$equal(BigNatModule$$$zero, a$$19)) { | ||
return b$$14; | ||
} else { | ||
const r$$22 = BigNatModule$$$divmod(b$$14, a$$19)[1]; | ||
const $a$$19$$49 = a$$19; | ||
a$$19 = r$$22; | ||
b$$14 = $a$$19$$49; | ||
const patternInput$$8 = BigNatModule$$$divmod(b$$14, a$$19); | ||
$a$$19$$206 = patternInput$$8[1]; | ||
$b$$14$$207 = a$$19; | ||
continue hcfloop; | ||
@@ -1211,21 +1238,19 @@ } | ||
export function BigNatModule$$$powi(x$$69, n$$36) { | ||
const power = function power(acc$$2, x$$70, n$$37) { | ||
const power = function power($acc$$2$$210, $x$$70$$211, $n$$37$$212) { | ||
power: while (true) { | ||
const acc$$2 = $acc$$2$$210, | ||
x$$70 = $x$$70$$211, | ||
n$$37 = $n$$37$$212; | ||
if (n$$37 === 0) { | ||
return acc$$2; | ||
} else if (n$$37 % 2 === 0) { | ||
const $acc$$2$$50 = acc$$2; | ||
const $n$$37$$52 = n$$37; | ||
const $x$$70$$51 = x$$70; | ||
acc$$2 = $acc$$2$$50; | ||
x$$70 = BigNatModule$$$mul($x$$70$$51, $x$$70$$51); | ||
n$$37 = ~~($n$$37$$52 / 2); | ||
$acc$$2$$210 = acc$$2; | ||
$x$$70$$211 = BigNatModule$$$mul(x$$70, x$$70); | ||
$n$$37$$212 = ~~(n$$37 / 2); | ||
continue power; | ||
} else { | ||
const $acc$$2$$53 = acc$$2; | ||
const $n$$37$$55 = n$$37; | ||
const $x$$70$$54 = x$$70; | ||
acc$$2 = BigNatModule$$$mul($x$$70$$54, $acc$$2$$53); | ||
x$$70 = BigNatModule$$$mul($x$$70$$54, $x$$70$$54); | ||
n$$37 = ~~($n$$37$$55 / 2); | ||
$acc$$2$$210 = BigNatModule$$$mul(x$$70, acc$$2); | ||
$x$$70$$211 = BigNatModule$$$mul(x$$70, x$$70); | ||
$n$$37$$212 = ~~(n$$37 / 2); | ||
continue power; | ||
@@ -1241,4 +1266,8 @@ } | ||
export function BigNatModule$$$pow(x$$71, n$$38) { | ||
const power$$1 = function power$$1(acc$$3, x$$72, n$$39) { | ||
const power$$1 = function power$$1($acc$$3$$215, $x$$72$$216, $n$$39$$217) { | ||
power$$1: while (true) { | ||
const acc$$3 = $acc$$3$$215, | ||
x$$72 = $x$$72$$216, | ||
n$$39 = $n$$39$$217; | ||
if (BigNatModule$$$isZero(n$$39)) { | ||
@@ -1248,18 +1277,12 @@ return acc$$3; | ||
const patternInput$$9 = BigNatModule$$$divmod(n$$39, BigNatModule$$$two); | ||
const nmod2 = patternInput$$9[1]; | ||
const ndiv2 = patternInput$$9[0]; | ||
if (BigNatModule$$$isZero(nmod2)) { | ||
const $acc$$3$$56 = acc$$3; | ||
const $x$$72$$57 = x$$72; | ||
acc$$3 = $acc$$3$$56; | ||
x$$72 = BigNatModule$$$mul($x$$72$$57, $x$$72$$57); | ||
n$$39 = ndiv2; | ||
if (BigNatModule$$$isZero(patternInput$$9[1])) { | ||
$acc$$3$$215 = acc$$3; | ||
$x$$72$$216 = BigNatModule$$$mul(x$$72, x$$72); | ||
$n$$39$$217 = patternInput$$9[0]; | ||
continue power$$1; | ||
} else { | ||
const $acc$$3$$58 = acc$$3; | ||
const $x$$72$$59 = x$$72; | ||
acc$$3 = BigNatModule$$$mul($x$$72$$59, $acc$$3$$58); | ||
x$$72 = BigNatModule$$$mul($x$$72$$59, $x$$72$$59); | ||
n$$39 = ndiv2; | ||
$acc$$3$$215 = BigNatModule$$$mul(x$$72, acc$$3); | ||
$x$$72$$216 = BigNatModule$$$mul(x$$72, x$$72); | ||
$n$$39$$217 = patternInput$$9[0]; | ||
continue power$$1; | ||
@@ -1278,13 +1301,14 @@ } | ||
const evalFloat = function evalFloat(acc$$4, k$$10, i$$49) { | ||
const evalFloat = function evalFloat($acc$$4$$219, $k$$10$$220, $i$$49$$221) { | ||
evalFloat: while (true) { | ||
const acc$$4 = $acc$$4$$219, | ||
k$$10 = $k$$10$$220, | ||
i$$49 = $i$$49$$221; | ||
if (i$$49 === n$$40.bound) { | ||
return acc$$4; | ||
} else { | ||
const $acc$$4$$60 = acc$$4; | ||
const $i$$49$$62 = i$$49; | ||
const $k$$10$$61 = k$$10; | ||
acc$$4 = $acc$$4$$60 + $k$$10$$61 * n$$40.digits[$i$$49$$62]; | ||
k$$10 = $k$$10$$61 * basef; | ||
i$$49 = $i$$49$$62 + 1; | ||
$acc$$4$$219 = acc$$4 + k$$10 * n$$40.digits[i$$49]; | ||
$k$$10$$220 = k$$10 * basef; | ||
$i$$49$$221 = i$$49 + 1; | ||
continue evalFloat; | ||
@@ -1316,3 +1340,4 @@ } | ||
{ | ||
return n$$43.digits[0] >>> 0; | ||
const value$$9 = n$$43.digits[0] | 0; | ||
return value$$9 >>> 0; | ||
} | ||
@@ -1323,10 +1348,8 @@ | ||
const patternInput$$10 = [n$$43.digits[0], n$$43.digits[1]]; | ||
const xB = patternInput$$10[1] | 0; | ||
const xA = patternInput$$10[0] | 0; | ||
if (xB > BigNatModule$$$baseMask32B) { | ||
if (patternInput$$10[1] > BigNatModule$$$baseMask32B) { | ||
throw new Error(); | ||
} | ||
return ((xA & BigNatModule$$$baseMask32A) >>> 0) + ((xB & BigNatModule$$$baseMask32B) >>> 0 << BigNatModule$$$baseShift32B >>> 0); | ||
return ((patternInput$$10[0] & BigNatModule$$$baseMask32A) >>> 0) + ((patternInput$$10[1] & BigNatModule$$$baseMask32B) >>> 0 << BigNatModule$$$baseShift32B >>> 0); | ||
} | ||
@@ -1351,3 +1374,4 @@ | ||
{ | ||
return fromInteger(n$$44.digits[0], true, 2); | ||
const value$$10 = n$$44.digits[0] | 0; | ||
return fromInteger(value$$10, true, 2); | ||
} | ||
@@ -1358,5 +1382,3 @@ | ||
const patternInput$$11 = [n$$44.digits[0], n$$44.digits[1]]; | ||
const xB$$1 = patternInput$$11[1] | 0; | ||
const xA$$1 = patternInput$$11[0] | 0; | ||
return op_Addition(fromInteger(xA$$1 & BigNatModule$$$baseMask64A, true, 2), op_LeftShift(fromInteger(xB$$1 & BigNatModule$$$baseMask64B, true, 2), BigNatModule$$$baseShift64B)); | ||
return op_Addition(fromInteger(patternInput$$11[0] & BigNatModule$$$baseMask64A, true, 2), op_LeftShift(fromInteger(patternInput$$11[1] & BigNatModule$$$baseMask64B, true, 2), BigNatModule$$$baseShift64B)); | ||
} | ||
@@ -1367,11 +1389,8 @@ | ||
const patternInput$$12 = [n$$44.digits[0], n$$44.digits[1], n$$44.digits[2]]; | ||
const xC = patternInput$$12[2] | 0; | ||
const xB$$2 = patternInput$$12[1] | 0; | ||
const xA$$2 = patternInput$$12[0] | 0; | ||
if (xC > BigNatModule$$$baseMask64C) { | ||
if (patternInput$$12[2] > BigNatModule$$$baseMask64C) { | ||
throw new Error(); | ||
} | ||
return op_Addition(op_Addition(fromInteger(xA$$2 & BigNatModule$$$baseMask64A, true, 2), op_LeftShift(fromInteger(xB$$2 & BigNatModule$$$baseMask64B, true, 2), BigNatModule$$$baseShift64B)), op_LeftShift(fromInteger(xC & BigNatModule$$$baseMask64C, true, 2), BigNatModule$$$baseShift64C)); | ||
return op_Addition(op_Addition(fromInteger(patternInput$$12[0] & BigNatModule$$$baseMask64A, true, 2), op_LeftShift(fromInteger(patternInput$$12[1] & BigNatModule$$$baseMask64B, true, 2), BigNatModule$$$baseShift64B)), op_LeftShift(fromInteger(patternInput$$12[2] & BigNatModule$$$baseMask64C, true, 2), BigNatModule$$$baseShift64C)); | ||
} | ||
@@ -1388,13 +1407,14 @@ | ||
const route = function route(prior, k$$11, ten2k) { | ||
const route = function route($prior$$227, $k$$11$$228, $ten2k$$229) { | ||
route: while (true) { | ||
const prior = $prior$$227, | ||
k$$11 = $k$$11$$228, | ||
ten2k = $ten2k$$229; | ||
if (BigNatModule$$$degree(ten2k) > degn) { | ||
return new List([k$$11, ten2k], prior); | ||
} else { | ||
const $k$$11$$64 = k$$11; | ||
const $prior$$63 = prior; | ||
const $ten2k$$65 = ten2k; | ||
prior = new List([$k$$11$$64, $ten2k$$65], $prior$$63); | ||
k$$11 = $k$$11$$64 + 1; | ||
ten2k = BigNatModule$$$mul($ten2k$$65, $ten2k$$65); | ||
$prior$$227 = new List([k$$11, ten2k], prior); | ||
$k$$11$$228 = k$$11 + 1; | ||
$ten2k$$229 = BigNatModule$$$mul(ten2k, ten2k); | ||
continue route; | ||
@@ -1411,14 +1431,10 @@ } | ||
if (_arg1$$3.tail != null) { | ||
const ten2k$$1 = _arg1$$3.head[1]; | ||
const prior$$1 = _arg1$$3.tail; | ||
const patternInput$$13 = BigNatModule$$$divmod(n$$46, ten2k$$1); | ||
const nL = patternInput$$13[1]; | ||
const nH = patternInput$$13[0]; | ||
const patternInput$$13 = BigNatModule$$$divmod(n$$46, _arg1$$3.head[1]); | ||
if (isLeading ? BigNatModule$$$isZero(nH) : false) { | ||
const digits$$1 = collect(isLeading, digits, nL, prior$$1); | ||
if (isLeading ? BigNatModule$$$isZero(patternInput$$13[0]) : false) { | ||
const digits$$1 = collect(isLeading, digits, patternInput$$13[1], _arg1$$3.tail); | ||
return digits$$1; | ||
} else { | ||
const digits$$2 = collect(false, digits, nL, prior$$1); | ||
const digits$$3 = collect(isLeading, digits$$2, nH, prior$$1); | ||
const digits$$2 = collect(false, digits, patternInput$$13[1], _arg1$$3.tail); | ||
const digits$$3 = collect(isLeading, digits$$2, patternInput$$13[0], _arg1$$3.tail); | ||
return digits$$3; | ||
@@ -1437,4 +1453,3 @@ } | ||
const prior$$2 = kten2ks; | ||
const digits$$4 = collect(true, new List(), n$$45, prior$$2); | ||
const digits$$4 = collect(true, new List(), n$$45, kten2ks); | ||
@@ -1444,3 +1459,5 @@ if (digits$$4.tail == null) { | ||
} else { | ||
return join("", ...ofList(digits$$4, Array)); | ||
let arg00; | ||
arg00 = ofList(digits$$4, Array); | ||
return join("", ...arg00); | ||
} | ||
@@ -1457,4 +1474,7 @@ } | ||
const build = function build(acc$$5, i$$50) { | ||
const build = function build($acc$$5$$235, $i$$50$$236) { | ||
build: while (true) { | ||
const acc$$5 = $acc$$5$$235, | ||
i$$50 = $i$$50$$236; | ||
if (i$$50 === len) { | ||
@@ -1467,6 +1487,4 @@ return acc$$5; | ||
if (0 <= d$$7 ? d$$7 <= 9 : false) { | ||
const $acc$$5$$66 = acc$$5; | ||
const $i$$50$$67 = i$$50; | ||
acc$$5 = BigNatModule$$$add(BigNatModule$$$mul(ten, $acc$$5$$66), BigNatModule$$$embed(d$$7)); | ||
i$$50 = $i$$50$$67 + 1; | ||
$acc$$5$$235 = BigNatModule$$$add(BigNatModule$$$mul(ten, acc$$5), BigNatModule$$$embed(d$$7)); | ||
$i$$50$$236 = i$$50 + 1; | ||
continue build; | ||
@@ -1473,0 +1491,0 @@ } else { |
@@ -59,39 +59,39 @@ import { declare, Record } from "../Types.js"; | ||
const matchValue = [BigInteger$$get_SignInt(x$$3), BigInteger$$get_SignInt(y)]; | ||
var $target$$2; | ||
var $target$$12; | ||
if (matchValue[0] === -1) { | ||
if (matchValue[1] === -1) { | ||
$target$$2 = 1; | ||
$target$$12 = 1; | ||
} else if (matchValue[1] === 0) { | ||
$target$$2 = 8; | ||
$target$$12 = 8; | ||
} else if (matchValue[1] === 1) { | ||
$target$$2 = 3; | ||
$target$$12 = 3; | ||
} else { | ||
$target$$2 = 9; | ||
$target$$12 = 9; | ||
} | ||
} else if (matchValue[0] === 0) { | ||
if (matchValue[1] === -1) { | ||
$target$$2 = 6; | ||
$target$$12 = 6; | ||
} else if (matchValue[1] === 0) { | ||
$target$$2 = 4; | ||
$target$$12 = 4; | ||
} else if (matchValue[1] === 1) { | ||
$target$$2 = 5; | ||
$target$$12 = 5; | ||
} else { | ||
$target$$2 = 9; | ||
$target$$12 = 9; | ||
} | ||
} else if (matchValue[0] === 1) { | ||
if (matchValue[1] === -1) { | ||
$target$$2 = 2; | ||
$target$$12 = 2; | ||
} else if (matchValue[1] === 0) { | ||
$target$$2 = 7; | ||
$target$$12 = 7; | ||
} else if (matchValue[1] === 1) { | ||
$target$$2 = 0; | ||
$target$$12 = 0; | ||
} else { | ||
$target$$2 = 9; | ||
$target$$12 = 9; | ||
} | ||
} else { | ||
$target$$2 = 9; | ||
$target$$12 = 9; | ||
} | ||
switch ($target$$2) { | ||
switch ($target$$12) { | ||
case 0: | ||
@@ -161,39 +161,39 @@ { | ||
const matchValue$$1 = [BigInteger$$get_SignInt(x$$5), BigInteger$$get_SignInt(y$$2)]; | ||
var $target$$3; | ||
var $target$$17; | ||
if (matchValue$$1[0] === -1) { | ||
if (matchValue$$1[1] === -1) { | ||
$target$$3 = 1; | ||
$target$$17 = 1; | ||
} else if (matchValue$$1[1] === 0) { | ||
$target$$3 = 8; | ||
$target$$17 = 8; | ||
} else if (matchValue$$1[1] === 1) { | ||
$target$$3 = 3; | ||
$target$$17 = 3; | ||
} else { | ||
$target$$3 = 9; | ||
$target$$17 = 9; | ||
} | ||
} else if (matchValue$$1[0] === 0) { | ||
if (matchValue$$1[1] === -1) { | ||
$target$$3 = 6; | ||
$target$$17 = 6; | ||
} else if (matchValue$$1[1] === 0) { | ||
$target$$3 = 4; | ||
$target$$17 = 4; | ||
} else if (matchValue$$1[1] === 1) { | ||
$target$$3 = 5; | ||
$target$$17 = 5; | ||
} else { | ||
$target$$3 = 9; | ||
$target$$17 = 9; | ||
} | ||
} else if (matchValue$$1[0] === 1) { | ||
if (matchValue$$1[1] === -1) { | ||
$target$$3 = 2; | ||
$target$$17 = 2; | ||
} else if (matchValue$$1[1] === 0) { | ||
$target$$3 = 7; | ||
$target$$17 = 7; | ||
} else if (matchValue$$1[1] === 1) { | ||
$target$$3 = 0; | ||
$target$$17 = 0; | ||
} else { | ||
$target$$3 = 9; | ||
$target$$17 = 9; | ||
} | ||
} else { | ||
$target$$3 = 9; | ||
$target$$17 = 9; | ||
} | ||
switch ($target$$3) { | ||
switch ($target$$17) { | ||
case 0: | ||
@@ -256,39 +256,39 @@ { | ||
const matchValue$$2 = [BigInteger$$get_SignInt(x$$6), BigInteger$$get_SignInt(y$$3)]; | ||
var $target$$4; | ||
var $target$$20; | ||
if (matchValue$$2[0] === -1) { | ||
if (matchValue$$2[1] === -1) { | ||
$target$$4 = 1; | ||
$target$$20 = 1; | ||
} else if (matchValue$$2[1] === 0) { | ||
$target$$4 = 8; | ||
$target$$20 = 8; | ||
} else if (matchValue$$2[1] === 1) { | ||
$target$$4 = 3; | ||
$target$$20 = 3; | ||
} else { | ||
$target$$4 = 9; | ||
$target$$20 = 9; | ||
} | ||
} else if (matchValue$$2[0] === 0) { | ||
if (matchValue$$2[1] === -1) { | ||
$target$$4 = 6; | ||
$target$$20 = 6; | ||
} else if (matchValue$$2[1] === 0) { | ||
$target$$4 = 4; | ||
$target$$20 = 4; | ||
} else if (matchValue$$2[1] === 1) { | ||
$target$$4 = 5; | ||
$target$$20 = 5; | ||
} else { | ||
$target$$4 = 9; | ||
$target$$20 = 9; | ||
} | ||
} else if (matchValue$$2[0] === 1) { | ||
if (matchValue$$2[1] === -1) { | ||
$target$$4 = 2; | ||
$target$$20 = 2; | ||
} else if (matchValue$$2[1] === 0) { | ||
$target$$4 = 7; | ||
$target$$20 = 7; | ||
} else if (matchValue$$2[1] === 1) { | ||
$target$$4 = 0; | ||
$target$$20 = 0; | ||
} else { | ||
$target$$4 = 9; | ||
$target$$20 = 9; | ||
} | ||
} else { | ||
$target$$4 = 9; | ||
$target$$20 = 9; | ||
} | ||
switch ($target$$4) { | ||
switch ($target$$20) { | ||
case 0: | ||
@@ -399,9 +399,3 @@ { | ||
const this$ = this; | ||
if (obj instanceof BigInteger) { | ||
const that = obj; | ||
return BigInteger$$$op_Equality$$56F059C0(this$, that); | ||
} else { | ||
return false; | ||
} | ||
return obj instanceof BigInteger ? BigInteger$$$op_Equality$$56F059C0(this$, obj) : false; | ||
}; | ||
@@ -447,4 +441,3 @@ | ||
} else { | ||
const i = matchValue$$4 | 0; | ||
return BigInteger$$$create$$Z2BE94A1(op_UnaryNegation_Int32(i), BigInteger$$get_V(z$$1)); | ||
return BigInteger$$$create$$Z2BE94A1(op_UnaryNegation_Int32(matchValue$$4), BigInteger$$get_V(z$$1)); | ||
} | ||
@@ -492,25 +485,25 @@ } | ||
const matchValue$$5 = [BigInteger$$get_SignInt(x$$12), BigInteger$$get_SignInt(y$$4)]; | ||
var $target$$5; | ||
var $target$$38; | ||
if (matchValue$$5[0] === -1) { | ||
if (matchValue$$5[1] === -1) { | ||
$target$$5 = 1; | ||
$target$$38 = 1; | ||
} else if (matchValue$$5[1] === 1) { | ||
$target$$5 = 3; | ||
$target$$38 = 3; | ||
} else { | ||
$target$$5 = 4; | ||
$target$$38 = 4; | ||
} | ||
} else if (matchValue$$5[0] === 1) { | ||
if (matchValue$$5[1] === -1) { | ||
$target$$5 = 2; | ||
$target$$38 = 2; | ||
} else if (matchValue$$5[1] === 1) { | ||
$target$$5 = 0; | ||
$target$$38 = 0; | ||
} else { | ||
$target$$5 = 4; | ||
$target$$38 = 4; | ||
} | ||
} else { | ||
$target$$5 = 4; | ||
$target$$38 = 4; | ||
} | ||
switch ($target$$5) { | ||
switch ($target$$38) { | ||
case 0: | ||
@@ -550,25 +543,25 @@ { | ||
const matchValue$$6 = [BigInteger$$get_SignInt(x$$13), BigInteger$$get_SignInt(y$$5)]; | ||
var $target$$6; | ||
var $target$$41; | ||
if (matchValue$$6[0] === -1) { | ||
if (matchValue$$6[1] === -1) { | ||
$target$$6 = 1; | ||
$target$$41 = 1; | ||
} else if (matchValue$$6[1] === 1) { | ||
$target$$6 = 3; | ||
$target$$41 = 3; | ||
} else { | ||
$target$$6 = 4; | ||
$target$$41 = 4; | ||
} | ||
} else if (matchValue$$6[0] === 1) { | ||
if (matchValue$$6[1] === -1) { | ||
$target$$6 = 2; | ||
$target$$41 = 2; | ||
} else if (matchValue$$6[1] === 1) { | ||
$target$$6 = 0; | ||
$target$$41 = 0; | ||
} else { | ||
$target$$6 = 4; | ||
$target$$41 = 4; | ||
} | ||
} else { | ||
$target$$6 = 4; | ||
$target$$41 = 4; | ||
} | ||
switch ($target$$6) { | ||
switch ($target$$41) { | ||
case 0: | ||
@@ -624,31 +617,29 @@ { | ||
const patternInput = BigNatModule$0024$0024$0024divmod(BigInteger$$get_V(x$$15), BigInteger$$get_V(y$$7)); | ||
const r = patternInput[1]; | ||
const d = patternInput[0]; | ||
const matchValue$$7 = [BigInteger$$get_SignInt(x$$15), BigInteger$$get_SignInt(y$$7)]; | ||
var $target$$7; | ||
var $target$$46; | ||
if (matchValue$$7[0] === -1) { | ||
if (matchValue$$7[1] === -1) { | ||
$target$$7 = 1; | ||
$target$$46 = 1; | ||
} else if (matchValue$$7[1] === 1) { | ||
$target$$7 = 3; | ||
$target$$46 = 3; | ||
} else { | ||
$target$$7 = 4; | ||
$target$$46 = 4; | ||
} | ||
} else if (matchValue$$7[0] === 1) { | ||
if (matchValue$$7[1] === -1) { | ||
$target$$7 = 2; | ||
$target$$46 = 2; | ||
} else if (matchValue$$7[1] === 1) { | ||
$target$$7 = 0; | ||
$target$$46 = 0; | ||
} else { | ||
$target$$7 = 4; | ||
$target$$46 = 4; | ||
} | ||
} else { | ||
$target$$7 = 4; | ||
$target$$46 = 4; | ||
} | ||
switch ($target$$7) { | ||
switch ($target$$46) { | ||
case 0: | ||
{ | ||
return [BigInteger$$$posn$$Z67CCE57D(d), BigInteger$$$posn$$Z67CCE57D(r)]; | ||
return [BigInteger$$$posn$$Z67CCE57D(patternInput[0]), BigInteger$$$posn$$Z67CCE57D(patternInput[1])]; | ||
} | ||
@@ -658,3 +649,3 @@ | ||
{ | ||
return [BigInteger$$$posn$$Z67CCE57D(d), BigInteger$$$negn$$Z67CCE57D(r)]; | ||
return [BigInteger$$$posn$$Z67CCE57D(patternInput[0]), BigInteger$$$negn$$Z67CCE57D(patternInput[1])]; | ||
} | ||
@@ -664,3 +655,3 @@ | ||
{ | ||
return [BigInteger$$$negn$$Z67CCE57D(d), BigInteger$$$posn$$Z67CCE57D(r)]; | ||
return [BigInteger$$$negn$$Z67CCE57D(patternInput[0]), BigInteger$$$posn$$Z67CCE57D(patternInput[1])]; | ||
} | ||
@@ -670,3 +661,3 @@ | ||
{ | ||
return [BigInteger$$$negn$$Z67CCE57D(d), BigInteger$$$negn$$Z67CCE57D(r)]; | ||
return [BigInteger$$$negn$$Z67CCE57D(patternInput[0]), BigInteger$$$negn$$Z67CCE57D(patternInput[1])]; | ||
} | ||
@@ -682,6 +673,8 @@ | ||
export function BigInteger$$$op_Division$$56F059C0(x$$16, y$$8) { | ||
return BigInteger$$$DivRem$$56F059C0(x$$16, y$$8)[0]; | ||
const tuple = BigInteger$$$DivRem$$56F059C0(x$$16, y$$8); | ||
return tuple[0]; | ||
} | ||
export function BigInteger$$$op_Modulus$$56F059C0(x$$17, y$$9) { | ||
return BigInteger$$$DivRem$$56F059C0(x$$17, y$$9)[1]; | ||
const tuple$$1 = BigInteger$$$DivRem$$56F059C0(x$$17, y$$9); | ||
return tuple$$1[1]; | ||
} | ||
@@ -741,39 +734,39 @@ export function BigInteger$$$op_RightShift$$62E082A2(x$$18, y$$10) { | ||
const matchValue$$9 = [BigInteger$$get_SignInt(x$$27), BigInteger$$get_SignInt(y$$16)]; | ||
var $target$$8; | ||
var $target$$68; | ||
if (matchValue$$9[0] === -1) { | ||
if (matchValue$$9[1] === -1) { | ||
$target$$8 = 1; | ||
$target$$68 = 1; | ||
} else if (matchValue$$9[1] === 0) { | ||
$target$$8 = 6; | ||
$target$$68 = 6; | ||
} else if (matchValue$$9[1] === 1) { | ||
$target$$8 = 3; | ||
$target$$68 = 3; | ||
} else { | ||
$target$$8 = 9; | ||
$target$$68 = 9; | ||
} | ||
} else if (matchValue$$9[0] === 0) { | ||
if (matchValue$$9[1] === -1) { | ||
$target$$8 = 8; | ||
$target$$68 = 8; | ||
} else if (matchValue$$9[1] === 0) { | ||
$target$$8 = 4; | ||
$target$$68 = 4; | ||
} else if (matchValue$$9[1] === 1) { | ||
$target$$8 = 7; | ||
$target$$68 = 7; | ||
} else { | ||
$target$$8 = 9; | ||
$target$$68 = 9; | ||
} | ||
} else if (matchValue$$9[0] === 1) { | ||
if (matchValue$$9[1] === -1) { | ||
$target$$8 = 2; | ||
$target$$68 = 2; | ||
} else if (matchValue$$9[1] === 0) { | ||
$target$$8 = 5; | ||
$target$$68 = 5; | ||
} else if (matchValue$$9[1] === 1) { | ||
$target$$8 = 0; | ||
$target$$68 = 0; | ||
} else { | ||
$target$$8 = 9; | ||
$target$$68 = 9; | ||
} | ||
} else { | ||
$target$$8 = 9; | ||
$target$$68 = 9; | ||
} | ||
switch ($target$$8) { | ||
switch ($target$$68) { | ||
case 0: | ||
@@ -836,39 +829,39 @@ { | ||
const matchValue$$10 = [BigInteger$$get_SignInt(x$$28), BigInteger$$get_SignInt(y$$17)]; | ||
var $target$$9; | ||
var $target$$71; | ||
if (matchValue$$10[0] === -1) { | ||
if (matchValue$$10[1] === -1) { | ||
$target$$9 = 1; | ||
$target$$71 = 1; | ||
} else if (matchValue$$10[1] === 0) { | ||
$target$$9 = 6; | ||
$target$$71 = 6; | ||
} else if (matchValue$$10[1] === 1) { | ||
$target$$9 = 3; | ||
$target$$71 = 3; | ||
} else { | ||
$target$$9 = 9; | ||
$target$$71 = 9; | ||
} | ||
} else if (matchValue$$10[0] === 0) { | ||
if (matchValue$$10[1] === -1) { | ||
$target$$9 = 8; | ||
$target$$71 = 8; | ||
} else if (matchValue$$10[1] === 0) { | ||
$target$$9 = 4; | ||
$target$$71 = 4; | ||
} else if (matchValue$$10[1] === 1) { | ||
$target$$9 = 7; | ||
$target$$71 = 7; | ||
} else { | ||
$target$$9 = 9; | ||
$target$$71 = 9; | ||
} | ||
} else if (matchValue$$10[0] === 1) { | ||
if (matchValue$$10[1] === -1) { | ||
$target$$9 = 2; | ||
$target$$71 = 2; | ||
} else if (matchValue$$10[1] === 0) { | ||
$target$$9 = 5; | ||
$target$$71 = 5; | ||
} else if (matchValue$$10[1] === 1) { | ||
$target$$9 = 0; | ||
$target$$71 = 0; | ||
} else { | ||
$target$$9 = 9; | ||
$target$$71 = 9; | ||
} | ||
} else { | ||
$target$$9 = 9; | ||
$target$$71 = 9; | ||
} | ||
switch ($target$$9) { | ||
switch ($target$$71) { | ||
case 0: | ||
@@ -1096,4 +1089,3 @@ { | ||
if (obj$$1 instanceof BigInteger) { | ||
const that$$1 = obj$$1; | ||
return BigInteger$$$compare$$56F059C0(this$$$1, that$$1) | 0; | ||
return BigInteger$$$compare$$56F059C0(this$$$1, obj$$1) | 0; | ||
} else { | ||
@@ -1100,0 +1092,0 @@ throw new Error("the objects are not comparable\\nParameter name: obj"); |
@@ -30,3 +30,3 @@ import { fromBits, getHighBits, getHighBitsUnsigned, getLowBits, getLowBitsUnsigned } from "./Long.js"; | ||
} | ||
export function getBytesInt64(value /* Long */) { | ||
export function getBytesInt64(value) { | ||
const bytes = new Uint8Array(8); | ||
@@ -50,3 +50,3 @@ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); | ||
} | ||
export function getBytesUInt64(value /* Long */) { | ||
export function getBytesUInt64(value) { | ||
const bytes = new Uint8Array(8); | ||
@@ -70,3 +70,3 @@ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength); | ||
} | ||
export function int64BitsToDouble(value /* Long */) { | ||
export function int64BitsToDouble(value) { | ||
const buffer = new ArrayBuffer(8); | ||
@@ -73,0 +73,0 @@ const view = new DataView(buffer); |
import { Observer, protect } from "./Observable.js"; | ||
import { tryValueIfChoice1, tryValueIfChoice2, value } from "./Option.js"; | ||
import { some, tryValueIfChoice1, tryValueIfChoice2, value } from "./Option.js"; | ||
import { iterate as seqIterate } from "./Seq.js"; | ||
@@ -75,3 +75,3 @@ export default class Event { | ||
export function filter(predicate, sourceEvent) { | ||
return choose((x) => predicate(x) ? x : null, sourceEvent); | ||
return choose((x) => predicate(x) ? some(x) : null, sourceEvent); | ||
} | ||
@@ -78,0 +78,0 @@ export function map(mapping, sourceEvent) { |
@@ -52,8 +52,7 @@ import { structuralHash, equals } from "./Util.js"; | ||
export function PrintfModule$$$PrintFormatToStringBuilderThen(continuation, builder, format) { | ||
const append = function append(s) { | ||
StringBuilder$0024$0024Append$0024$0024Z721C83C5(builder, s), null; | ||
return format.cont(function append(s) { | ||
const value = StringBuilder$0024$0024Append$0024$0024Z721C83C5(builder, s); | ||
value, null; | ||
return continuation(); | ||
}; | ||
return format.cont(append); | ||
}); | ||
} | ||
@@ -60,0 +59,0 @@ export function PrintfModule$$$PrintFormatToStringBuilder(builder$$1, format$$1) { |
import { defaultArg, value as value$$1, some } from "./Option.js"; | ||
import { List } from "./Types.js"; | ||
import { collect as collect$$1, scanBack as scanBack$$1, scan as scan$$1, foldBack2 as foldBack2$$1, fold2 as fold2$$1, fold as fold$$1, map as map$$1 } from "./Seq.js"; | ||
import { partialApply, getItemFromDict, addToDict, tryGetValue, addToSet, count, uncurry } from "./Util.js"; | ||
import { partialApply, getItemFromDict, addToDict, tryGetValue, addToSet, count } from "./Util.js"; | ||
import { ofList } from "./Array.js"; | ||
@@ -11,4 +11,3 @@ import { permute as permute$$1, findIndexBack as findIndexBack$$1, tryFindIndexBack as tryFindIndexBack$$1 } from "./Array.js"; | ||
if (_arg1.tail != null) { | ||
const x = _arg1.head; | ||
return x; | ||
return _arg1.head; | ||
} else { | ||
@@ -20,4 +19,3 @@ throw new Error("List was empty"); | ||
if (_arg1$$1.tail != null) { | ||
const x$$1 = _arg1$$1.head; | ||
return some(x$$1); | ||
return some(_arg1$$1.head); | ||
} else { | ||
@@ -29,4 +27,3 @@ return null; | ||
if (_arg1$$2.tail != null) { | ||
const xs = _arg1$$2.tail; | ||
return xs; | ||
return _arg1$$2.tail; | ||
} else { | ||
@@ -36,11 +33,11 @@ throw new Error("List was empty"); | ||
} | ||
export function last(_arg1$$3) { | ||
export function last($_arg1$$3$$5) { | ||
last: while (true) { | ||
const _arg1$$3 = $_arg1$$3$$5; | ||
if (_arg1$$3.tail != null) { | ||
if (_arg1$$3.tail.tail == null) { | ||
const x$$2 = _arg1$$3.head; | ||
return x$$2; | ||
return _arg1$$3.head; | ||
} else { | ||
const xs$$1 = _arg1$$3.tail; | ||
_arg1$$3 = xs$$1; | ||
$_arg1$$3$$5 = _arg1$$3.tail; | ||
continue last; | ||
@@ -55,11 +52,11 @@ } | ||
} | ||
export function tryLast(_arg1$$4) { | ||
export function tryLast($_arg1$$4$$6) { | ||
tryLast: while (true) { | ||
const _arg1$$4 = $_arg1$$4$$6; | ||
if (_arg1$$4.tail != null) { | ||
if (_arg1$$4.tail.tail == null) { | ||
const x$$3 = _arg1$$4.head; | ||
return some(x$$3); | ||
return some(_arg1$$4.head); | ||
} else { | ||
const xs$$2 = _arg1$$4.tail; | ||
_arg1$$4 = xs$$2; | ||
$_arg1$$4$$6 = _arg1$$4.tail; | ||
continue tryLast; | ||
@@ -78,19 +75,17 @@ } | ||
} else { | ||
const loop = function loop(xs$$4, ys$$1) { | ||
const loop = function loop($xs$$4$$10, $ys$$1$$11) { | ||
loop: while (true) { | ||
const xs$$4 = $xs$$4$$10, | ||
ys$$1 = $ys$$1$$11; | ||
if (xs$$4.tail != null) { | ||
if (ys$$1.tail != null) { | ||
const x$$4 = xs$$4.head; | ||
const xs$$5 = xs$$4.tail; | ||
const y = ys$$1.head; | ||
const ys$$2 = ys$$1.tail; | ||
const matchValue$$1 = comparer(x$$4, y) | 0; | ||
const matchValue$$1 = comparer(xs$$4.head, ys$$1.head) | 0; | ||
if (matchValue$$1 === 0) { | ||
xs$$4 = xs$$5; | ||
ys$$1 = ys$$2; | ||
$xs$$4$$10 = xs$$4.tail; | ||
$ys$$1$$11 = ys$$1.tail; | ||
continue loop; | ||
} else { | ||
const res = matchValue$$1 | 0; | ||
return res | 0; | ||
return matchValue$$1 | 0; | ||
} | ||
@@ -113,16 +108,14 @@ } else { | ||
} | ||
export function foldIndexedAux($arg$$5, $arg$$6, $arg$$7, $arg$$8) { | ||
export function foldIndexedAux($f$$12, $i$$13, $acc$$14, $_arg1$$5$$15) { | ||
foldIndexedAux: while (true) { | ||
const f = $arg$$5, | ||
i = $arg$$6, | ||
acc = $arg$$7, | ||
_arg1$$5 = $arg$$8; | ||
const f = $f$$12, | ||
i = $i$$13, | ||
acc = $acc$$14, | ||
_arg1$$5 = $_arg1$$5$$15; | ||
if (_arg1$$5.tail != null) { | ||
const xs$$6 = _arg1$$5.tail; | ||
const x$$5 = _arg1$$5.head; | ||
$arg$$5 = f; | ||
$arg$$6 = i + 1; | ||
$arg$$7 = f(i, acc, x$$5); | ||
$arg$$8 = xs$$6; | ||
$f$$12 = f; | ||
$i$$13 = i + 1; | ||
$acc$$14 = f(i, acc, _arg1$$5.head); | ||
$_arg1$$5$$15 = _arg1$$5.tail; | ||
continue foldIndexedAux; | ||
@@ -139,14 +132,12 @@ } else { | ||
} | ||
export function fold($arg$$12, $arg$$13, $arg$$14) { | ||
export function fold($f$$2$$19, $state$$1$$20, $xs$$8$$21) { | ||
fold: while (true) { | ||
const f$$2 = $arg$$12, | ||
state$$1 = $arg$$13, | ||
xs$$8 = $arg$$14; | ||
const f$$2 = $f$$2$$19, | ||
state$$1 = $state$$1$$20, | ||
xs$$8 = $xs$$8$$21; | ||
if (xs$$8.tail != null) { | ||
const t = xs$$8.tail; | ||
const h = xs$$8.head; | ||
$arg$$12 = f$$2; | ||
$arg$$13 = f$$2(state$$1, h); | ||
$arg$$14 = t; | ||
$f$$2$$19 = f$$2; | ||
$state$$1$$20 = f$$2(state$$1, xs$$8.head); | ||
$xs$$8$$21 = xs$$8.tail; | ||
continue fold; | ||
@@ -176,25 +167,27 @@ } else { | ||
export function ofSeq(xs$$12) { | ||
return reverse(fold$$1(function (acc$$3, x$$9) { | ||
const xs$$13 = fold$$1(function (acc$$3, x$$9) { | ||
return new List(x$$9, acc$$3); | ||
}, new List(), xs$$12)); | ||
}, new List(), xs$$12); | ||
return reverse(xs$$13); | ||
} | ||
export function concat(lists) { | ||
return reverse(fold$$1(function (state$$3, xs$$14) { | ||
const xs$$15 = fold$$1(function (state$$3, xs$$14) { | ||
return fold(function f$$4(acc$$4, x$$10) { | ||
return new List(x$$10, acc$$4); | ||
}, state$$3, xs$$14); | ||
}, new List(), lists)); | ||
}, new List(), lists); | ||
return reverse(xs$$15); | ||
} | ||
export function foldIndexed2Aux($arg$$18, $arg$$19, $arg$$20, $arg$$21, $arg$$22) { | ||
export function foldIndexed2Aux($f$$5$$31, $i$$1$$32, $acc$$5$$33, $bs$$34, $cs$$35) { | ||
foldIndexed2Aux: while (true) { | ||
const f$$5 = $arg$$18, | ||
i$$1 = $arg$$19, | ||
acc$$5 = $arg$$20, | ||
bs = $arg$$21, | ||
cs = $arg$$22; | ||
var $target$$23, x$$11, xs$$16, y$$1, ys$$3; | ||
const f$$5 = $f$$5$$31, | ||
i$$1 = $i$$1$$32, | ||
acc$$5 = $acc$$5$$33, | ||
bs = $bs$$34, | ||
cs = $cs$$35; | ||
var $target$$36, x$$11, xs$$16, y$$1, ys$$3; | ||
if (bs.tail != null) { | ||
if (cs.tail != null) { | ||
$target$$23 = 1; | ||
$target$$36 = 1; | ||
x$$11 = bs.head; | ||
@@ -205,11 +198,11 @@ xs$$16 = bs.tail; | ||
} else { | ||
$target$$23 = 2; | ||
$target$$36 = 2; | ||
} | ||
} else if (cs.tail == null) { | ||
$target$$23 = 0; | ||
$target$$36 = 0; | ||
} else { | ||
$target$$23 = 2; | ||
$target$$36 = 2; | ||
} | ||
switch ($target$$23) { | ||
switch ($target$$36) { | ||
case 0: | ||
@@ -222,7 +215,7 @@ { | ||
{ | ||
$arg$$18 = f$$5; | ||
$arg$$19 = i$$1 + 1; | ||
$arg$$20 = f$$5(i$$1, acc$$5, x$$11, y$$1); | ||
$arg$$21 = xs$$16; | ||
$arg$$22 = ys$$3; | ||
$f$$5$$31 = f$$5; | ||
$i$$1$$32 = i$$1 + 1; | ||
$acc$$5$$33 = f$$5(i$$1, acc$$5, x$$11, y$$1); | ||
$bs$$34 = xs$$16; | ||
$cs$$35 = ys$$3; | ||
continue foldIndexed2Aux; | ||
@@ -250,4 +243,6 @@ } | ||
export function unfold(f$$9, state$$7) { | ||
const unfoldInner = function unfoldInner(acc$$6, state$$8) { | ||
const unfoldInner = function unfoldInner($acc$$6$$51, $state$$8$$52) { | ||
unfoldInner: while (true) { | ||
const acc$$6 = $acc$$6$$51, | ||
state$$8 = $state$$8$$52; | ||
const matchValue$$3 = f$$9(state$$8); | ||
@@ -258,5 +253,4 @@ | ||
const state$$9 = matchValue$$3[1]; | ||
const $acc$$6$$38 = acc$$6; | ||
acc$$6 = new List(x$$12, $acc$$6$$38); | ||
state$$8 = state$$9; | ||
$acc$$6$$51 = new List(x$$12, acc$$6); | ||
$state$$8$$52 = state$$9; | ||
continue unfoldInner; | ||
@@ -273,11 +267,11 @@ } else { | ||
} | ||
export function foldIndexed3Aux($arg$$39, $arg$$40, $arg$$41, $arg$$42, $arg$$43, $arg$$44) { | ||
export function foldIndexed3Aux($f$$10$$53, $i$$2$$54, $acc$$7$$55, $bs$$1$$56, $cs$$1$$57, $ds$$58) { | ||
foldIndexed3Aux: while (true) { | ||
const f$$10 = $arg$$39, | ||
i$$2 = $arg$$40, | ||
acc$$7 = $arg$$41, | ||
bs$$1 = $arg$$42, | ||
cs$$1 = $arg$$43, | ||
ds = $arg$$44; | ||
var $target$$45, x$$13, xs$$20, y$$2, ys$$7, z, zs; | ||
const f$$10 = $f$$10$$53, | ||
i$$2 = $i$$2$$54, | ||
acc$$7 = $acc$$7$$55, | ||
bs$$1 = $bs$$1$$56, | ||
cs$$1 = $cs$$1$$57, | ||
ds = $ds$$58; | ||
var $target$$59, x$$13, xs$$20, y$$2, ys$$7, z, zs; | ||
@@ -287,3 +281,3 @@ if (bs$$1.tail != null) { | ||
if (ds.tail != null) { | ||
$target$$45 = 1; | ||
$target$$59 = 1; | ||
x$$13 = bs$$1.head; | ||
@@ -296,18 +290,18 @@ xs$$20 = bs$$1.tail; | ||
} else { | ||
$target$$45 = 2; | ||
$target$$59 = 2; | ||
} | ||
} else { | ||
$target$$45 = 2; | ||
$target$$59 = 2; | ||
} | ||
} else if (cs$$1.tail == null) { | ||
if (ds.tail == null) { | ||
$target$$45 = 0; | ||
$target$$59 = 0; | ||
} else { | ||
$target$$45 = 2; | ||
$target$$59 = 2; | ||
} | ||
} else { | ||
$target$$45 = 2; | ||
$target$$59 = 2; | ||
} | ||
switch ($target$$45) { | ||
switch ($target$$59) { | ||
case 0: | ||
@@ -320,8 +314,8 @@ { | ||
{ | ||
$arg$$39 = f$$10; | ||
$arg$$40 = i$$2 + 1; | ||
$arg$$41 = f$$10(i$$2, acc$$7, x$$13, y$$2, z); | ||
$arg$$42 = xs$$20; | ||
$arg$$43 = ys$$7; | ||
$arg$$44 = zs; | ||
$f$$10$$53 = f$$10; | ||
$i$$2$$54 = i$$2 + 1; | ||
$acc$$7$$55 = f$$10(i$$2, acc$$7, x$$13, y$$2, z); | ||
$bs$$1$$56 = xs$$20; | ||
$cs$$1$$57 = ys$$7; | ||
$ds$$58 = zs; | ||
continue foldIndexed3Aux; | ||
@@ -348,6 +342,8 @@ } | ||
export function scan(f$$13, state$$11, xs$$23) { | ||
return ofSeq(scan$$1(f$$13, state$$11, xs$$23)); | ||
const xs$$24 = scan$$1(f$$13, state$$11, xs$$23); | ||
return ofSeq(xs$$24); | ||
} | ||
export function scanBack(f$$14, xs$$25, state$$12) { | ||
return ofSeq(scanBack$$1(f$$14, xs$$25, state$$12)); | ||
const xs$$26 = scanBack$$1(f$$14, xs$$25, state$$12); | ||
return ofSeq(xs$$26); | ||
} | ||
@@ -365,13 +361,16 @@ export function length(xs$$27) { | ||
export function collect(f$$15, xs$$29) { | ||
return ofSeq(collect$$1(f$$15, xs$$29)); | ||
const xs$$30 = collect$$1(f$$15, xs$$29); | ||
return ofSeq(xs$$30); | ||
} | ||
export function map(f$$16, xs$$31) { | ||
return reverse(fold(function (acc$$11, x$$16) { | ||
const xs$$32 = fold(function (acc$$11, x$$16) { | ||
return new List(f$$16(x$$16), acc$$11); | ||
}, new List(), xs$$31)); | ||
}, new List(), xs$$31); | ||
return reverse(xs$$32); | ||
} | ||
export function mapIndexed(f$$17, xs$$33) { | ||
return reverse(foldIndexed(function (i$$3, acc$$12, x$$17) { | ||
const xs$$34 = foldIndexed(function (i$$3, acc$$12, x$$17) { | ||
return new List(f$$17(i$$3, x$$17), acc$$12); | ||
}, new List(), xs$$33)); | ||
}, new List(), xs$$33); | ||
return reverse(xs$$34); | ||
} | ||
@@ -384,37 +383,31 @@ export function indexed(xs$$35) { | ||
export function map2(f$$18, xs$$36, ys$$11) { | ||
return reverse(fold2(function (acc$$13, x$$19, y$$4) { | ||
const xs$$37 = fold2(function (acc$$13, x$$19, y$$4) { | ||
return new List(f$$18(x$$19, y$$4), acc$$13); | ||
}, new List(), xs$$36, ys$$11)); | ||
}, new List(), xs$$36, ys$$11); | ||
return reverse(xs$$37); | ||
} | ||
export function mapIndexed2(f$$19, xs$$38, ys$$12) { | ||
return reverse(foldIndexed2(function (i$$5, acc$$14, x$$20, y$$5) { | ||
const xs$$39 = foldIndexed2(function (i$$5, acc$$14, x$$20, y$$5) { | ||
return new List(f$$19(i$$5, x$$20, y$$5), acc$$14); | ||
}, new List(), xs$$38, ys$$12)); | ||
}, new List(), xs$$38, ys$$12); | ||
return reverse(xs$$39); | ||
} | ||
export function map3(f$$20, xs$$40, ys$$13, zs$$3) { | ||
return reverse(fold3(function (acc$$15, x$$21, y$$6, z$$2) { | ||
const xs$$41 = fold3(function (acc$$15, x$$21, y$$6, z$$2) { | ||
return new List(f$$20(x$$21, y$$6, z$$2), acc$$15); | ||
}, new List(), xs$$40, ys$$13, zs$$3)); | ||
}, new List(), xs$$40, ys$$13, zs$$3); | ||
return reverse(xs$$41); | ||
} | ||
export function mapIndexed3(f$$21, xs$$42, ys$$14, zs$$4) { | ||
return reverse(foldIndexed3(function (i$$6, acc$$16, x$$22, y$$7, z$$3) { | ||
const xs$$43 = foldIndexed3(function (i$$6, acc$$16, x$$22, y$$7, z$$3) { | ||
return new List(f$$21(i$$6, x$$22, y$$7, z$$3), acc$$16); | ||
}, new List(), xs$$42, ys$$14, zs$$4)); | ||
}, new List(), xs$$42, ys$$14, zs$$4); | ||
return reverse(xs$$43); | ||
} | ||
export function mapFold(f$$22, s, xs$$44) { | ||
const foldFn = function foldFn(tupledArg) { | ||
const nxs = tupledArg[0]; | ||
const fs = tupledArg[1]; | ||
return function (x$$23) { | ||
const patternInput = f$$22(fs, x$$23); | ||
const nx = patternInput[0]; | ||
const fs$$1 = patternInput[1]; | ||
return [new List(nx, nxs), fs$$1]; | ||
}; | ||
}; | ||
const patternInput$$1 = fold(uncurry(2, foldFn), [new List(), s], xs$$44); | ||
const s$$1 = patternInput$$1[1]; | ||
const nxs$$1 = patternInput$$1[0]; | ||
return [reverse(nxs$$1), s$$1]; | ||
const patternInput$$1 = fold(function foldFn(tupledArg, x$$23) { | ||
const patternInput = f$$22(tupledArg[1], x$$23); | ||
return [new List(patternInput[0], tupledArg[0]), patternInput[1]]; | ||
}, [new List(), s], xs$$44); | ||
return [reverse(patternInput$$1[0]), patternInput$$1[1]]; | ||
} | ||
@@ -465,17 +458,15 @@ export function mapFoldBack(f$$23, xs$$45, s$$2) { | ||
} | ||
export function tryPickIndexedAux($arg$$98, $arg$$99, $arg$$100) { | ||
export function tryPickIndexedAux($f$$28$$120, $i$$10$$121, $_arg1$$9$$122) { | ||
tryPickIndexedAux: while (true) { | ||
const f$$28 = $arg$$98, | ||
i$$10 = $arg$$99, | ||
_arg1$$9 = $arg$$100; | ||
const f$$28 = $f$$28$$120, | ||
i$$10 = $i$$10$$121, | ||
_arg1$$9 = $_arg1$$9$$122; | ||
if (_arg1$$9.tail != null) { | ||
const xs$$51 = _arg1$$9.tail; | ||
const x$$28 = _arg1$$9.head; | ||
const result = f$$28(i$$10, x$$28); | ||
const result = f$$28(i$$10, _arg1$$9.head); | ||
if (result == null) { | ||
$arg$$98 = f$$28; | ||
$arg$$99 = i$$10 + 1; | ||
$arg$$100 = xs$$51; | ||
$f$$28$$120 = f$$28; | ||
$i$$10$$121 = i$$10 + 1; | ||
$_arg1$$9$$122 = _arg1$$9.tail; | ||
continue tryPickIndexedAux; | ||
@@ -536,6 +527,10 @@ } else { | ||
export function findBack(f$$36, xs$$59) { | ||
return find(f$$36, reverse(xs$$59)); | ||
let xs$$61; | ||
xs$$61 = reverse(xs$$59); | ||
return find(f$$36, xs$$61); | ||
} | ||
export function tryFindBack(f$$37, xs$$62) { | ||
return tryFind(f$$37, reverse(xs$$62)); | ||
let xs$$64; | ||
xs$$64 = reverse(xs$$62); | ||
return tryFind(f$$37, xs$$64); | ||
} | ||
@@ -548,3 +543,4 @@ export function tryFindIndex(f$$38, xs$$65) { | ||
export function tryFindIndexBack(f$$39, xs$$66) { | ||
return tryFindIndexBack$$1(f$$39, ofList(xs$$66, Array)); | ||
const array = ofList(xs$$66, Array); | ||
return tryFindIndexBack$$1(f$$39, array); | ||
} | ||
@@ -562,3 +558,4 @@ export function findIndex(f$$40, xs$$67) { | ||
export function findIndexBack(f$$41, xs$$68) { | ||
return findIndexBack$$1(f$$41, ofList(xs$$68, Array)); | ||
const array$$1 = ofList(xs$$68, Array); | ||
return findIndexBack$$1(f$$41, array$$1) | 0; | ||
} | ||
@@ -576,17 +573,14 @@ export function item(n, xs$$69) { | ||
export function filter(f$$42, xs$$71) { | ||
return reverse(fold(function (acc$$17, x$$37) { | ||
const xs$$72 = fold(function (acc$$17, x$$37) { | ||
return f$$42(x$$37) ? new List(x$$37, acc$$17) : acc$$17; | ||
}, new List(), xs$$71)); | ||
}, new List(), xs$$71); | ||
return reverse(xs$$72); | ||
} | ||
export function partition(f$$43, xs$$73) { | ||
return fold(uncurry(2, function (tupledArg$$1) { | ||
const lacc = tupledArg$$1[0]; | ||
const racc = tupledArg$$1[1]; | ||
return function (x$$38) { | ||
return f$$43(x$$38) ? [new List(x$$38, lacc), racc] : [lacc, new List(x$$38, racc)]; | ||
}; | ||
}), [new List(), new List()], reverse(xs$$73)); | ||
return fold(function (tupledArg$$1, x$$38) { | ||
return f$$43(x$$38) ? [new List(x$$38, tupledArg$$1[0]), tupledArg$$1[1]] : [tupledArg$$1[0], new List(x$$38, tupledArg$$1[1])]; | ||
}, [new List(), new List()], reverse(xs$$73)); | ||
} | ||
export function choose(f$$44, xs$$74) { | ||
return reverse(fold(function (acc$$18, x$$39) { | ||
const xs$$75 = fold(function (acc$$18, x$$39) { | ||
const matchValue$$8 = f$$44(x$$39); | ||
@@ -600,15 +594,15 @@ | ||
} | ||
}, new List(), xs$$74)); | ||
}, new List(), xs$$74); | ||
return reverse(xs$$75); | ||
} | ||
export function contains(value, list, eq) { | ||
const loop$$1 = function loop$$1(xs$$76) { | ||
const loop$$1 = function loop$$1($xs$$76$$162) { | ||
loop$$1: while (true) { | ||
const xs$$76 = $xs$$76$$162; | ||
if (xs$$76.tail != null) { | ||
const v$$1 = xs$$76.head; | ||
const rest = xs$$76.tail; | ||
if (eq.Equals(value, v$$1)) { | ||
if (eq.Equals(value, xs$$76.head)) { | ||
return true; | ||
} else { | ||
xs$$76 = rest; | ||
$xs$$76$$162 = xs$$76.tail; | ||
continue loop$$1; | ||
@@ -652,5 +646,3 @@ } | ||
if (_arg1$$16.tail != null) { | ||
const t$$1 = _arg1$$16.tail; | ||
const h$$1 = _arg1$$16.head; | ||
return fold(f$$47, h$$1, t$$1); | ||
return fold(f$$47, _arg1$$16.head, _arg1$$16.tail); | ||
} else { | ||
@@ -662,5 +654,3 @@ throw new Error("List was empty"); | ||
if (_arg1$$17.tail != null) { | ||
const t$$2 = _arg1$$17.tail; | ||
const h$$2 = _arg1$$17.head; | ||
return foldBack(f$$48, t$$2, h$$2); | ||
return foldBack(f$$48, _arg1$$17.tail, _arg1$$17.head); | ||
} else { | ||
@@ -680,16 +670,13 @@ throw new Error("List was empty"); | ||
} | ||
export function exists($arg$$144, $arg$$145) { | ||
export function exists($f$$51$$180, $_arg1$$18$$181) { | ||
exists: while (true) { | ||
const f$$51 = $arg$$144, | ||
_arg1$$18 = $arg$$145; | ||
const f$$51 = $f$$51$$180, | ||
_arg1$$18 = $_arg1$$18$$181; | ||
if (_arg1$$18.tail != null) { | ||
const xs$$81 = _arg1$$18.tail; | ||
const x$$43 = _arg1$$18.head; | ||
if (f$$51(x$$43)) { | ||
if (f$$51(_arg1$$18.head)) { | ||
return true; | ||
} else { | ||
$arg$$144 = f$$51; | ||
$arg$$145 = xs$$81; | ||
$f$$51$$180 = f$$51; | ||
$_arg1$$18$$181 = _arg1$$18.tail; | ||
continue exists; | ||
@@ -704,12 +691,12 @@ } | ||
} | ||
export function exists2($arg$$146, $arg$$147, $arg$$148) { | ||
export function exists2($f$$52$$182, $bs$$2$$183, $cs$$2$$184) { | ||
exists2: while (true) { | ||
const f$$52 = $arg$$146, | ||
bs$$2 = $arg$$147, | ||
cs$$2 = $arg$$148; | ||
var $target$$149, x$$44, xs$$82, y$$12, ys$$18; | ||
const f$$52 = $f$$52$$182, | ||
bs$$2 = $bs$$2$$183, | ||
cs$$2 = $cs$$2$$184; | ||
var $target$$185, x$$44, xs$$82, y$$12, ys$$18; | ||
if (bs$$2.tail != null) { | ||
if (cs$$2.tail != null) { | ||
$target$$149 = 1; | ||
$target$$185 = 1; | ||
x$$44 = bs$$2.head; | ||
@@ -720,11 +707,11 @@ xs$$82 = bs$$2.tail; | ||
} else { | ||
$target$$149 = 2; | ||
$target$$185 = 2; | ||
} | ||
} else if (cs$$2.tail == null) { | ||
$target$$149 = 0; | ||
$target$$185 = 0; | ||
} else { | ||
$target$$149 = 2; | ||
$target$$185 = 2; | ||
} | ||
switch ($target$$149) { | ||
switch ($target$$185) { | ||
case 0: | ||
@@ -740,5 +727,5 @@ { | ||
} else { | ||
$arg$$146 = f$$52; | ||
$arg$$147 = xs$$82; | ||
$arg$$148 = ys$$18; | ||
$f$$52$$182 = f$$52; | ||
$bs$$2$$183 = xs$$82; | ||
$cs$$2$$184 = ys$$18; | ||
continue exists2; | ||
@@ -758,24 +745,10 @@ } | ||
export function unzip(xs$$83) { | ||
return foldBack(uncurry(2, function (tupledArg$$2) { | ||
const x$$45 = tupledArg$$2[0]; | ||
const y$$13 = tupledArg$$2[1]; | ||
return function (tupledArg$$3) { | ||
const lacc$$1 = tupledArg$$3[0]; | ||
const racc$$1 = tupledArg$$3[1]; | ||
return [new List(x$$45, lacc$$1), new List(y$$13, racc$$1)]; | ||
}; | ||
}), xs$$83, [new List(), new List()]); | ||
return foldBack(function (tupledArg$$2, tupledArg$$3) { | ||
return [new List(tupledArg$$2[0], tupledArg$$3[0]), new List(tupledArg$$2[1], tupledArg$$3[1])]; | ||
}, xs$$83, [new List(), new List()]); | ||
} | ||
export function unzip3(xs$$84) { | ||
return foldBack(uncurry(2, function (tupledArg$$4) { | ||
const x$$46 = tupledArg$$4[0]; | ||
const y$$14 = tupledArg$$4[1]; | ||
const z$$4 = tupledArg$$4[2]; | ||
return function (tupledArg$$5) { | ||
const lacc$$2 = tupledArg$$5[0]; | ||
const macc = tupledArg$$5[1]; | ||
const racc$$2 = tupledArg$$5[2]; | ||
return [new List(x$$46, lacc$$2), new List(y$$14, macc), new List(z$$4, racc$$2)]; | ||
}; | ||
}), xs$$84, [new List(), new List(), new List()]); | ||
return foldBack(function (tupledArg$$4, tupledArg$$5) { | ||
return [new List(tupledArg$$4[0], tupledArg$$5[0]), new List(tupledArg$$4[1], tupledArg$$5[1]), new List(tupledArg$$4[2], tupledArg$$5[2])]; | ||
}, xs$$84, [new List(), new List(), new List()]); | ||
} | ||
@@ -793,28 +766,43 @@ export function zip(xs$$85, ys$$19) { | ||
export function sort(xs$$87, comparer$$1) { | ||
var comparer$$2, xs$$88; | ||
return ofArray((comparer$$2 = function comparer$$2(x$$49, y$$17) { | ||
let xs$$89; | ||
const xs$$88 = ofList(xs$$87, Array); | ||
xs$$88.sort(function comparer$$2(x$$49, y$$17) { | ||
return comparer$$1.Compare(x$$49, y$$17); | ||
}, (xs$$88 = ofList(xs$$87, Array), (xs$$88.sort(comparer$$2), xs$$88)))); | ||
}); | ||
xs$$89 = xs$$88; | ||
return ofArray(xs$$89); | ||
} | ||
export function sortBy(projection, xs$$90, comparer$$3) { | ||
var comparer$$4, xs$$91; | ||
return ofArray((comparer$$4 = function comparer$$4(x$$50, y$$18) { | ||
let xs$$92; | ||
const xs$$91 = ofList(xs$$90, Array); | ||
xs$$91.sort(function comparer$$4(x$$50, y$$18) { | ||
return comparer$$3.Compare(projection(x$$50), projection(y$$18)); | ||
}, (xs$$91 = ofList(xs$$90, Array), (xs$$91.sort(comparer$$4), xs$$91)))); | ||
}); | ||
xs$$92 = xs$$91; | ||
return ofArray(xs$$92); | ||
} | ||
export function sortDescending(xs$$93, comparer$$5) { | ||
var comparer$$6, xs$$94; | ||
return ofArray((comparer$$6 = function comparer$$6(x$$51, y$$19) { | ||
let xs$$95; | ||
const xs$$94 = ofList(xs$$93, Array); | ||
xs$$94.sort(function comparer$$6(x$$51, y$$19) { | ||
return comparer$$5.Compare(x$$51, y$$19) * -1; | ||
}, (xs$$94 = ofList(xs$$93, Array), (xs$$94.sort(comparer$$6), xs$$94)))); | ||
}); | ||
xs$$95 = xs$$94; | ||
return ofArray(xs$$95); | ||
} | ||
export function sortByDescending(projection$$1, xs$$96, comparer$$7) { | ||
var comparer$$8, xs$$97; | ||
return ofArray((comparer$$8 = function comparer$$8(x$$52, y$$20) { | ||
let xs$$98; | ||
const xs$$97 = ofList(xs$$96, Array); | ||
xs$$97.sort(function comparer$$8(x$$52, y$$20) { | ||
return comparer$$7.Compare(projection$$1(x$$52), projection$$1(y$$20)) * -1; | ||
}, (xs$$97 = ofList(xs$$96, Array), (xs$$97.sort(comparer$$8), xs$$97)))); | ||
}); | ||
xs$$98 = xs$$97; | ||
return ofArray(xs$$98); | ||
} | ||
export function sortWith(comparer$$9, xs$$99) { | ||
var xs$$100; | ||
return ofArray((xs$$100 = ofList(xs$$99, Array), (xs$$100.sort(comparer$$9), xs$$100))); | ||
let xs$$101; | ||
const xs$$100 = ofList(xs$$99, Array); | ||
xs$$100.sort(comparer$$9); | ||
xs$$101 = xs$$100; | ||
return ofArray(xs$$101); | ||
} | ||
@@ -864,16 +852,19 @@ export function sum(xs$$102, adder) { | ||
export function permute(f$$55, xs$$109) { | ||
return ofArray(permute$$1(f$$55, ofList(xs$$109, Array))); | ||
let xs$$110; | ||
let array$$3; | ||
array$$3 = ofList(xs$$109, Array); | ||
xs$$110 = permute$$1(f$$55, array$$3); | ||
return ofArray(xs$$110); | ||
} | ||
export function skip(i$$16, xs$$111) { | ||
var i$$18; | ||
const skipInner = function skipInner($i$$17$$237, $xs$$112$$238) { | ||
skipInner: while (true) { | ||
const i$$17 = $i$$17$$237, | ||
xs$$112 = $xs$$112$$238; | ||
const skipInner = function skipInner(i$$17, xs$$112) { | ||
skipInner: while (true) { | ||
if (i$$17 === 0) { | ||
return xs$$112; | ||
} else if (xs$$112.tail != null) { | ||
const xs$$113 = xs$$112.tail; | ||
const $i$$17$$172 = i$$17; | ||
i$$17 = $i$$17$$172 - 1; | ||
xs$$112 = xs$$113; | ||
$i$$17$$237 = i$$17 - 1; | ||
$xs$$112$$238 = xs$$112.tail; | ||
continue skipInner; | ||
@@ -888,15 +879,14 @@ } else { | ||
if (i$$18 = i$$16 | 0, i$$18 < 0) { | ||
const i$$19 = i$$16 | 0; | ||
if (i$$16 < 0) { | ||
throw new Error("The input must be non-negative."); | ||
} else { | ||
var $target$$173, i$$20, xs$$115; | ||
var $target$$239, i$$20, xs$$115; | ||
if (i$$16 === 0) { | ||
$target$$173 = 0; | ||
$target$$239 = 0; | ||
} else if (i$$16 === 1) { | ||
if (xs$$111.tail != null) { | ||
$target$$173 = 1; | ||
$target$$239 = 1; | ||
} else { | ||
$target$$173 = 2; | ||
$target$$239 = 2; | ||
i$$20 = i$$16; | ||
@@ -906,3 +896,3 @@ xs$$115 = xs$$111; | ||
} else { | ||
$target$$173 = 2; | ||
$target$$239 = 2; | ||
i$$20 = i$$16; | ||
@@ -912,3 +902,3 @@ xs$$115 = xs$$111; | ||
switch ($target$$173) { | ||
switch ($target$$239) { | ||
case 0: | ||
@@ -921,4 +911,3 @@ { | ||
{ | ||
const xs$$114 = xs$$111.tail; | ||
return xs$$114; | ||
return xs$$111.tail; | ||
} | ||
@@ -933,27 +922,25 @@ | ||
} | ||
export function skipWhile($arg$$174, $arg$$175) { | ||
var t$$3, h$$3; | ||
export function skipWhile($predicate$$240, $xs$$116$$241) { | ||
skipWhile: while (true) { | ||
const predicate = $arg$$174, | ||
xs$$116 = $arg$$175; | ||
var $target$$176, h$$4, t$$4; | ||
const predicate = $predicate$$240, | ||
xs$$116 = $xs$$116$$241; | ||
var $target$$242, h$$4, t$$4; | ||
if (xs$$116.tail != null) { | ||
if (t$$3 = xs$$116.tail, (h$$3 = xs$$116.head, predicate(h$$3))) { | ||
$target$$176 = 0; | ||
if (predicate(xs$$116.head)) { | ||
$target$$242 = 0; | ||
h$$4 = xs$$116.head; | ||
t$$4 = xs$$116.tail; | ||
} else { | ||
$target$$176 = 1; | ||
$target$$242 = 1; | ||
} | ||
} else { | ||
$target$$176 = 1; | ||
$target$$242 = 1; | ||
} | ||
switch ($target$$176) { | ||
switch ($target$$242) { | ||
case 0: | ||
{ | ||
$arg$$174 = predicate; | ||
$arg$$175 = t$$4; | ||
$predicate$$240 = predicate; | ||
$xs$$116$$241 = t$$4; | ||
continue skipWhile; | ||
@@ -971,16 +958,16 @@ } | ||
} | ||
export function takeSplitAux(error, i$$21, acc$$25, xs$$117) { | ||
export function takeSplitAux($error$$243, $i$$21$$244, $acc$$25$$245, $xs$$117$$246) { | ||
takeSplitAux: while (true) { | ||
const error = $error$$243, | ||
i$$21 = $i$$21$$244, | ||
acc$$25 = $acc$$25$$245, | ||
xs$$117 = $xs$$117$$246; | ||
if (i$$21 === 0) { | ||
return [reverse(acc$$25), xs$$117]; | ||
} else if (xs$$117.tail != null) { | ||
const xs$$118 = xs$$117.tail; | ||
const x$$61 = xs$$117.head; | ||
const $acc$$25$$179 = acc$$25; | ||
const $error$$177 = error; | ||
const $i$$21$$178 = i$$21; | ||
error = $error$$177; | ||
i$$21 = $i$$21$$178 - 1; | ||
acc$$25 = new List(x$$61, $acc$$25$$179); | ||
xs$$117 = xs$$118; | ||
$error$$243 = error; | ||
$i$$21$$244 = i$$21 - 1; | ||
$acc$$25$$245 = new List(xs$$117.head, acc$$25); | ||
$xs$$117$$246 = xs$$117.tail; | ||
continue takeSplitAux; | ||
@@ -999,17 +986,14 @@ } else { | ||
export function take(i$$22, xs$$119) { | ||
var i$$23; | ||
if (i$$23 = i$$22 | 0, i$$23 < 0) { | ||
const i$$24 = i$$22 | 0; | ||
if (i$$22 < 0) { | ||
throw new Error("The input must be non-negative."); | ||
} else { | ||
var $target$$180, i$$25, xs$$120; | ||
var $target$$249, i$$25, xs$$120; | ||
if (i$$22 === 0) { | ||
$target$$180 = 0; | ||
$target$$249 = 0; | ||
} else if (i$$22 === 1) { | ||
if (xs$$119.tail != null) { | ||
$target$$180 = 1; | ||
$target$$249 = 1; | ||
} else { | ||
$target$$180 = 2; | ||
$target$$249 = 2; | ||
i$$25 = i$$22; | ||
@@ -1019,3 +1003,3 @@ xs$$120 = xs$$119; | ||
} else { | ||
$target$$180 = 2; | ||
$target$$249 = 2; | ||
i$$25 = i$$22; | ||
@@ -1025,3 +1009,3 @@ xs$$120 = xs$$119; | ||
switch ($target$$180) { | ||
switch ($target$$249) { | ||
case 0: | ||
@@ -1034,4 +1018,3 @@ { | ||
{ | ||
const x$$62 = xs$$119.head; | ||
return new List(x$$62, new List()); | ||
return new List(xs$$119.head, new List()); | ||
} | ||
@@ -1041,3 +1024,4 @@ | ||
{ | ||
return takeSplitAux(true, i$$25, new List(), xs$$120)[0]; | ||
const tuple = takeSplitAux(true, i$$25, new List(), xs$$120); | ||
return tuple[0]; | ||
} | ||
@@ -1050,18 +1034,12 @@ } | ||
if (xs$$121.tail.tail == null) { | ||
const nil = xs$$121.tail; | ||
const x$$63 = xs$$121.head; | ||
if (predicate$$1(x$$63)) { | ||
if (predicate$$1(xs$$121.head)) { | ||
return xs$$121; | ||
} else { | ||
return nil; | ||
return xs$$121.tail; | ||
} | ||
} else { | ||
const x$$64 = xs$$121.head; | ||
const xs$$122 = xs$$121.tail; | ||
if (!predicate$$1(x$$64)) { | ||
if (!predicate$$1(xs$$121.head)) { | ||
return new List(); | ||
} else { | ||
return new List(x$$64, takeWhile(predicate$$1, xs$$122)); | ||
return new List(xs$$121.head, takeWhile(predicate$$1, xs$$121.tail)); | ||
} | ||
@@ -1074,17 +1052,14 @@ } | ||
export function truncate(i$$26, xs$$123) { | ||
var i$$27; | ||
if (i$$27 = i$$26 | 0, i$$27 < 0) { | ||
const i$$28 = i$$26 | 0; | ||
if (i$$26 < 0) { | ||
throw new Error("The input must be non-negative."); | ||
} else { | ||
var $target$$183, i$$29, xs$$124; | ||
var $target$$254, i$$29, xs$$124; | ||
if (i$$26 === 0) { | ||
$target$$183 = 0; | ||
$target$$254 = 0; | ||
} else if (i$$26 === 1) { | ||
if (xs$$123.tail != null) { | ||
$target$$183 = 1; | ||
$target$$254 = 1; | ||
} else { | ||
$target$$183 = 2; | ||
$target$$254 = 2; | ||
i$$29 = i$$26; | ||
@@ -1094,3 +1069,3 @@ xs$$124 = xs$$123; | ||
} else { | ||
$target$$183 = 2; | ||
$target$$254 = 2; | ||
i$$29 = i$$26; | ||
@@ -1100,3 +1075,3 @@ xs$$124 = xs$$123; | ||
switch ($target$$183) { | ||
switch ($target$$254) { | ||
case 0: | ||
@@ -1109,4 +1084,3 @@ { | ||
{ | ||
const x$$65 = xs$$123.head; | ||
return new List(x$$65, new List()); | ||
return new List(xs$$123.head, new List()); | ||
} | ||
@@ -1116,3 +1090,4 @@ | ||
{ | ||
return takeSplitAux(false, i$$29, new List(), xs$$124)[0]; | ||
const tuple$$1 = takeSplitAux(false, i$$29, new List(), xs$$124); | ||
return tuple$$1[0]; | ||
} | ||
@@ -1123,17 +1098,14 @@ } | ||
export function splitAt(i$$30, xs$$125) { | ||
var i$$31; | ||
if (i$$31 = i$$30 | 0, i$$31 < 0) { | ||
const i$$32 = i$$30 | 0; | ||
if (i$$30 < 0) { | ||
throw new Error("The input must be non-negative."); | ||
} else { | ||
var $target$$184, i$$33, xs$$127; | ||
var $target$$257, i$$33, xs$$127; | ||
if (i$$30 === 0) { | ||
$target$$184 = 0; | ||
$target$$257 = 0; | ||
} else if (i$$30 === 1) { | ||
if (xs$$125.tail != null) { | ||
$target$$184 = 1; | ||
$target$$257 = 1; | ||
} else { | ||
$target$$184 = 2; | ||
$target$$257 = 2; | ||
i$$33 = i$$30; | ||
@@ -1143,3 +1115,3 @@ xs$$127 = xs$$125; | ||
} else { | ||
$target$$184 = 2; | ||
$target$$257 = 2; | ||
i$$33 = i$$30; | ||
@@ -1149,3 +1121,3 @@ xs$$127 = xs$$125; | ||
switch ($target$$184) { | ||
switch ($target$$257) { | ||
case 0: | ||
@@ -1158,5 +1130,3 @@ { | ||
{ | ||
const xs$$126 = xs$$125.tail; | ||
const x$$66 = xs$$125.head; | ||
return [new List(x$$66, new List()), xs$$126]; | ||
return [new List(xs$$125.head, new List()), xs$$125.tail]; | ||
} | ||
@@ -1184,3 +1154,5 @@ | ||
let lastIndex = -1 | 0; | ||
const res$$2 = foldIndexed(function f$$56(i$$34, acc$$26, x$$67) { | ||
let res$$2; | ||
const state$$13 = new List(); | ||
res$$2 = foldIndexed(function f$$56(i$$34, acc$$26, x$$67) { | ||
lastIndex = i$$34; | ||
@@ -1193,3 +1165,3 @@ | ||
} | ||
}, new List(), xs$$128); | ||
}, state$$13, xs$$128); | ||
@@ -1206,3 +1178,4 @@ if (lower$$1 > lastIndex + 1 ? true : hasUpper ? upper > lastIndex : false) { | ||
return filter(function f$$57($arg$$1) { | ||
return addToSet(projection$$4($arg$$1), hashSet); | ||
const arg00$$1 = projection$$4($arg$$1); | ||
return addToSet(arg00$$1, hashSet); | ||
}, xs$$130); | ||
@@ -1218,9 +1191,5 @@ } | ||
if (xs$$133.tail.tail != null) { | ||
const x1 = xs$$133.head; | ||
const x2 = xs$$133.tail.head; | ||
const xs$$134 = xs$$133.tail.tail; | ||
throw new Error("Input list too long\\nParameter name: list"); | ||
} else { | ||
const x$$69 = xs$$133.head; | ||
return x$$69; | ||
return xs$$133.head; | ||
} | ||
@@ -1239,4 +1208,3 @@ } else { | ||
if (matchValue$$16[0]) { | ||
const prev = matchValue$$16[1]; | ||
dict.set(key, new List(v$$2, prev)); | ||
dict.set(key, new List(v$$2, matchValue$$16[1])); | ||
} else { | ||
@@ -1248,5 +1216,6 @@ addToDict(dict, key, new List(v$$2, new List())); | ||
let result$$1 = new List(); | ||
const xs$$137 = keys; | ||
iterate(function f$$59(key$$1) { | ||
result$$1 = new List([key$$1, reverse(getItemFromDict(dict, key$$1))], result$$1); | ||
}, keys); | ||
}, xs$$137); | ||
return result$$1; | ||
@@ -1262,4 +1231,3 @@ } | ||
if (matchValue$$17[0]) { | ||
const prev$$1 = matchValue$$17[1] | 0; | ||
dict$$1.set(key$$2, prev$$1 + 1); | ||
dict$$1.set(key$$2, matchValue$$17[1] + 1); | ||
} else { | ||
@@ -1271,5 +1239,6 @@ dict$$1.set(key$$2, 1); | ||
let result$$2 = new List(); | ||
const xs$$140 = keys$$1; | ||
iterate(function f$$61(key$$3) { | ||
result$$2 = new List([key$$3, getItemFromDict(dict$$1, key$$3)], result$$2); | ||
}, keys$$1); | ||
}, xs$$140); | ||
return result$$2; | ||
@@ -1281,13 +1250,14 @@ } | ||
export function pairwise(xs$$142) { | ||
const inner = function inner(xs$$143, acc$$27, x1$$1) { | ||
const inner = function inner($xs$$143$$284, $acc$$27$$285, $x1$$1$$286) { | ||
inner: while (true) { | ||
const xs$$143 = $xs$$143$$284, | ||
acc$$27 = $acc$$27$$285, | ||
x1$$1 = $x1$$1$$286; | ||
if (xs$$143.tail != null) { | ||
const xs$$144 = xs$$143.tail; | ||
const x2$$1 = xs$$143.head; | ||
let copyOfStruct = acc$$27; | ||
copyOfStruct.push([x1$$1, x2$$1]); | ||
const $acc$$27$$196 = acc$$27; | ||
xs$$143 = xs$$144; | ||
acc$$27 = $acc$$27$$196; | ||
x1$$1 = x2$$1; | ||
copyOfStruct.push([x1$$1, xs$$143.head]); | ||
$xs$$143$$284 = xs$$143.tail; | ||
$acc$$27$$285 = acc$$27; | ||
$x1$$1$$286 = xs$$143.head; | ||
continue inner; | ||
@@ -1302,7 +1272,7 @@ } else { | ||
var $target$$197, x1$$2, x2$$2, xs$$145; | ||
var $target$$287, x1$$2, x2$$2, xs$$145; | ||
if (xs$$142.tail != null) { | ||
if (xs$$142.tail.tail != null) { | ||
$target$$197 = 1; | ||
$target$$287 = 1; | ||
x1$$2 = xs$$142.head; | ||
@@ -1312,9 +1282,9 @@ x2$$2 = xs$$142.tail.head; | ||
} else { | ||
$target$$197 = 0; | ||
$target$$287 = 0; | ||
} | ||
} else { | ||
$target$$197 = 0; | ||
$target$$287 = 0; | ||
} | ||
switch ($target$$197) { | ||
switch ($target$$287) { | ||
case 0: | ||
@@ -1329,11 +1299,5 @@ { | ||
acc$$28.push([x1$$2, x2$$2]); | ||
return function (arg00$$2) { | ||
const clo1 = partialApply(2, inner, [arg00$$2]); | ||
return function (arg10) { | ||
const clo2 = clo1(arg10); | ||
return function (arg20) { | ||
return clo2(arg20); | ||
}; | ||
}; | ||
}(xs$$145)(acc$$28)(x2$$2); | ||
const clo1 = partialApply(2, inner, [xs$$145]); | ||
const clo2 = clo1(acc$$28); | ||
return clo2(x2$$2); | ||
} | ||
@@ -1340,0 +1304,0 @@ } |
@@ -1,177 +0,70 @@ | ||
// Adapted from: https://github.com/dcodeIO/long.js/blob/f572e3a17d313730cf11eb838f6d2a5e31626f8a/src/long.js | ||
// Apache License 2.0: https://github.com/dcodeIO/long.js/blob/master/LICENSE | ||
/* tslint:disable */ | ||
import { isValid } from "./Int32.js"; | ||
import { combineHashCodes } from "./Util.js"; | ||
/** | ||
* wasm optimizations, to do native i64 multiplication and divide | ||
*/ | ||
var wasm = null; | ||
try { | ||
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ | ||
0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 | ||
])), {}).exports; | ||
} | ||
catch (e) { | ||
// no wasm support :( | ||
} | ||
/** | ||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. | ||
* See the from* functions below for more convenient ways of constructing Longs. | ||
* @exports Long | ||
* @class A Long class for representing a 64 bit two's-complement integer value. | ||
* @param {number} low The low (signed) 32 bits of the long | ||
* @param {number} high The high (signed) 32 bits of the long | ||
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed | ||
* @constructor | ||
*/ | ||
export default function Long(low, high, unsigned) { | ||
/** | ||
* The low 32 bits as a signed value. | ||
* @type {number} | ||
*/ | ||
this.low = low | 0; | ||
/** | ||
* The high 32 bits as a signed value. | ||
* @type {number} | ||
*/ | ||
this.high = high | 0; | ||
/** | ||
* Whether unsigned or not. | ||
* @type {boolean} | ||
*/ | ||
this.unsigned = !!unsigned; | ||
} | ||
Long.prototype.GetHashCode = function () { | ||
return combineHashCodes([this.unsigned ? 1 : 0, this.high, this.low]); | ||
}; | ||
Long.prototype.Equals = function (x) { return equals(this, x); }; | ||
Long.prototype.CompareTo = function (x) { return compare(this, x); }; | ||
Long.prototype.toString = function (radix) { return toString(this, radix); }; | ||
Long.prototype.toJSON = function () { return toString(this); }; | ||
export const neg = op_UnaryNegation; | ||
export const not = op_LogicalNot; | ||
export const add = op_Addition; | ||
export const sub = op_Subtraction; | ||
export const mul = op_Multiply; | ||
export const div = op_Division; | ||
export const mod = op_Modulus; | ||
export const shl = op_LeftShift; | ||
export const shr = op_RightShift; | ||
export const and = op_BitwiseAnd; | ||
export const or = op_BitwiseOr; | ||
export const xor = op_ExclusiveOr; | ||
// The internal representation of a long is the two given signed, 32-bit values. | ||
// We use 32-bit pieces because these are the size of integers on which | ||
// Javascript performs bit-operations. For operations like addition and | ||
// multiplication, we split each number into 16 bit pieces, which can easily be | ||
// multiplied within Javascript's floating-point representation without overflow | ||
// or change in sign. | ||
// | ||
// In the algorithms below, we frequently reduce the negative case to the | ||
// positive case by negating the input(s) and then post-processing the result. | ||
// Note that we must ALWAYS check specially whether those values are MIN_VALUE | ||
// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as | ||
// a positive number, it overflows back into a negative). Not handling this | ||
// case would often result in infinite recursion. | ||
// | ||
// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* | ||
// methods on which they depend. | ||
/** | ||
* An indicator used to reliably determine if an object is a Long or not. | ||
* @type {boolean} | ||
* @const | ||
* @private | ||
*/ | ||
Long.prototype.__isLong__; | ||
Object.defineProperty(Long.prototype, "__isLong__", { value: true }); | ||
/** | ||
* @function | ||
* @param {*} obj Object | ||
* @returns {boolean} | ||
* @inner | ||
*/ | ||
function isLong(obj) { | ||
return (obj && obj["__isLong__"]) === true; | ||
} | ||
/** | ||
* A cache of the Long representations of small integer values. | ||
* @type {!Object} | ||
* @inner | ||
*/ | ||
var INT_CACHE = {}; | ||
/** | ||
* A cache of the Long representations of small unsigned integer values. | ||
* @type {!Object} | ||
* @inner | ||
*/ | ||
var UINT_CACHE = {}; | ||
/** | ||
* @param {number} value | ||
* @param {boolean=} unsigned | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromInt(value, unsigned) { | ||
var obj, cachedObj, cache; | ||
if (unsigned) { | ||
value >>>= 0; | ||
if (cache = (0 <= value && value < 256)) { | ||
cachedObj = UINT_CACHE[value]; | ||
if (cachedObj) | ||
return cachedObj; | ||
} | ||
obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); | ||
if (cache) | ||
UINT_CACHE[value] = obj; | ||
return obj; | ||
import * as Long from "./lib/long.js"; | ||
export default Long.Long; | ||
export const get_Zero = Long.ZERO; | ||
export const get_One = Long.ONE; | ||
export const op_Addition = Long.add; | ||
export const op_Subtraction = Long.subtract; | ||
export const op_Multiply = Long.multiply; | ||
export const op_Division = Long.divide; | ||
export const op_Modulus = Long.modulo; | ||
export const op_UnaryNegation = Long.negate; | ||
export const op_LeftShift = Long.shiftLeft; | ||
export const op_RightShift = Long.shiftRight; | ||
export const op_RightShiftUnsigned = Long.shiftRightUnsigned; | ||
export const op_BitwiseAnd = Long.and; | ||
export const op_BitwiseOr = Long.or; | ||
export const op_ExclusiveOr = Long.xor; | ||
export const op_LogicalNot = Long.not; | ||
export const op_LessThan = Long.lessThan; | ||
export const op_LessThanOrEqual = Long.lessThanOrEqual; | ||
export const op_GreaterThan = Long.greaterThan; | ||
export const op_GreaterThanOrEqual = Long.greaterThanOrEqual; | ||
export const op_Equality = Long.equals; | ||
export const op_Inequality = Long.notEquals; | ||
export const equals = Long.equals; | ||
export const compare = Long.compare; | ||
export const fromInt = Long.fromInt; | ||
export const fromBits = Long.fromBits; | ||
export const fromBytes = Long.fromBytes; | ||
export const fromNumber = Long.fromNumber; | ||
export const fromString = Long.fromString; | ||
export const fromValue = Long.fromValue; | ||
export const toInt = Long.toInt; | ||
export const toBytes = Long.toBytes; | ||
export const toNumber = Long.toNumber; | ||
export const toString = Long.toString; | ||
export const getLowBits = Long.getLowBits; | ||
export const getHighBits = Long.getHighBits; | ||
export const getLowBitsUnsigned = Long.getLowBitsUnsigned; | ||
export const getHighBitsUnsigned = Long.getHighBitsUnsigned; | ||
function getMaxValue(unsigned, radix, isNegative) { | ||
switch (radix) { | ||
case 2: return unsigned ? | ||
"1111111111111111111111111111111111111111111111111111111111111111" : | ||
(isNegative ? "1000000000000000000000000000000000000000000000000000000000000000" | ||
: "111111111111111111111111111111111111111111111111111111111111111"); | ||
case 8: return unsigned ? | ||
"1777777777777777777777" : | ||
(isNegative ? "1000000000000000000000" : "777777777777777777777"); | ||
case 10: return unsigned ? | ||
"18446744073709551615" : | ||
(isNegative ? "9223372036854775808" : "9223372036854775807"); | ||
case 16: return unsigned ? | ||
"FFFFFFFFFFFFFFFF" : | ||
(isNegative ? "8000000000000000" : "7FFFFFFFFFFFFFFF"); | ||
default: throw new Error("Invalid radix."); | ||
} | ||
else { | ||
value |= 0; | ||
if (cache = (-128 <= value && value < 128)) { | ||
cachedObj = INT_CACHE[value]; | ||
if (cachedObj) | ||
return cachedObj; | ||
} | ||
obj = fromBits(value, value < 0 ? -1 : 0, false); | ||
if (cache) | ||
INT_CACHE[value] = obj; | ||
return obj; | ||
} | ||
} | ||
/** | ||
* @param {number} value | ||
* @param {boolean=} unsigned | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromNumber(value, unsigned) { | ||
if (isNaN(value)) | ||
return unsigned ? UZERO : ZERO; | ||
if (unsigned) { | ||
if (value < 0) | ||
return UZERO; | ||
if (value >= TWO_PWR_64_DBL) | ||
return MAX_UNSIGNED_VALUE; | ||
export function abs(x) { | ||
if (!x.unsigned && Long.isNegative(x)) { | ||
return op_UnaryNegation(x); | ||
} | ||
else { | ||
if (value <= -TWO_PWR_63_DBL) | ||
return MIN_VALUE; | ||
if (value + 1 >= TWO_PWR_63_DBL) | ||
return MAX_VALUE; | ||
return x; | ||
} | ||
if (value < 0) | ||
return op_UnaryNegation(fromNumber(-value, unsigned)); | ||
return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); | ||
} | ||
/** | ||
* @param {number} value | ||
* @param {boolean} unsigned | ||
* @param {number} kind | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromInteger(value, unsigned, kind) { | ||
var x; | ||
var xh = 0; | ||
let x = value; | ||
let xh = 0; | ||
switch (kind) { | ||
@@ -196,89 +89,8 @@ case 0: | ||
break; | ||
case 6: x = value >>> 0; | ||
case 6: | ||
x = value >>> 0; | ||
break; | ||
} | ||
return fromBits(x, xh >> 31, unsigned); | ||
return Long.fromBits(x, xh >> 31, unsigned); | ||
} | ||
/** | ||
* @param {number} lowBits | ||
* @param {number} highBits | ||
* @param {boolean=} unsigned | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromBits(lowBits, highBits, unsigned) { | ||
return new Long(lowBits, highBits, unsigned); | ||
} | ||
/** | ||
* @function | ||
* @param {number} base | ||
* @param {number} exponent | ||
* @returns {number} | ||
* @inner | ||
*/ | ||
var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) | ||
/** | ||
* @param {string} str | ||
* @param {(boolean|number)=} unsigned | ||
* @param {number=} radix | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromString(str, unsigned, radix) { | ||
if (str.length === 0) | ||
throw Error('empty string'); | ||
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") | ||
return ZERO; | ||
if (typeof unsigned === 'number') { | ||
// For goog.math.long compatibility | ||
radix = unsigned, | ||
unsigned = false; | ||
} | ||
else { | ||
unsigned = !!unsigned; | ||
} | ||
radix = radix || 10; | ||
if (radix < 2 || 36 < radix) | ||
throw RangeError('radix'); | ||
var p = str.indexOf('-'); | ||
if (p > 0) | ||
throw Error('interior hyphen'); | ||
else if (p === 0) { | ||
return op_UnaryNegation(fromString(str.substring(1), unsigned, radix)); | ||
} | ||
// Do several (8) digits each time through the loop, so as to | ||
// minimize the calls to the very expensive emulated div. | ||
var radixToPower = fromNumber(pow_dbl(radix, 8)); | ||
var result = ZERO; | ||
for (var i = 0; i < str.length; i += 8) { | ||
var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix); | ||
if (size < 8) { | ||
var power = fromNumber(pow_dbl(radix, size)); | ||
result = op_Addition(op_Multiply(result, power), fromNumber(value)); | ||
} | ||
else { | ||
result = op_Multiply(result, radixToPower); | ||
result = op_Addition(result, fromNumber(value)); | ||
} | ||
} | ||
result.unsigned = unsigned; | ||
return result; | ||
} | ||
function getMaxValue(unsigned, radix, isNegative) { | ||
switch (radix) { | ||
case 2: return unsigned ? | ||
"1111111111111111111111111111111111111111111111111111111111111111" : | ||
(isNegative ? "1000000000000000000000000000000000000000000000000000000000000000" | ||
: "111111111111111111111111111111111111111111111111111111111111111"); | ||
case 8: return unsigned ? | ||
"1777777777777777777777" : | ||
(isNegative ? "1000000000000000000000" : "777777777777777777777"); | ||
case 10: return unsigned ? | ||
"18446744073709551615" : | ||
(isNegative ? "9223372036854775808" : "9223372036854775807"); | ||
case 16: return unsigned ? | ||
"FFFFFFFFFFFFFFFF" : | ||
(isNegative ? "8000000000000000" : "7FFFFFFFFFFFFFFF"); | ||
default: throw new Error("Invalid radix."); | ||
} | ||
} | ||
export function parse(str, style, unsigned, bitsize, radix) { | ||
@@ -295,3 +107,3 @@ const res = isValid(str, style, radix); | ||
str = isNegative ? res.sign + res.digits : res.digits; | ||
return fromString(str, unsigned, res.radix); | ||
return Long.fromString(str, unsigned, res.radix); | ||
} | ||
@@ -309,782 +121,12 @@ } | ||
} | ||
return [false, ZERO]; | ||
return [false, Long.ZERO]; | ||
} | ||
/** | ||
* @function | ||
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val | ||
* @param {boolean=} unsigned | ||
* @returns {!Long} | ||
* @inner | ||
*/ | ||
export function fromValue(val, unsigned) { | ||
if (typeof val === 'number') | ||
return fromNumber(val, unsigned); | ||
if (typeof val === 'string') | ||
return fromString(val, unsigned); | ||
// Throws for non-objects, converts non-instanceof Long: | ||
return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned); | ||
} | ||
// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be | ||
// no runtime penalty for these. | ||
/** | ||
* @type {number} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_16_DBL = 1 << 16; | ||
/** | ||
* @type {number} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_24_DBL = 1 << 24; | ||
/** | ||
* @type {number} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; | ||
/** | ||
* @type {number} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; | ||
/** | ||
* @type {number} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; | ||
/** | ||
* @type {!Long} | ||
* @const | ||
* @inner | ||
*/ | ||
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var ZERO = fromInt(0); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var UZERO = fromInt(0, true); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var ONE = fromInt(1); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var UONE = fromInt(1, true); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var NEG_ONE = fromInt(-1); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true); | ||
/** | ||
* @type {!Long} | ||
* @inner | ||
*/ | ||
export var MIN_VALUE = fromBits(0, 0x80000000 | 0, false); | ||
/** | ||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. | ||
* @returns {number} | ||
*/ | ||
export function toInt($this) { | ||
return $this.unsigned ? $this.low >>> 0 : $this.low; | ||
} | ||
; | ||
/** | ||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). | ||
* @returns {number} | ||
*/ | ||
export function toNumber($this) { | ||
if ($this.unsigned) | ||
return (($this.high >>> 0) * TWO_PWR_32_DBL) + ($this.low >>> 0); | ||
return $this.high * TWO_PWR_32_DBL + ($this.low >>> 0); | ||
} | ||
; | ||
/** | ||
* Converts the Long to a string written in the specified radix. | ||
* @param {number=} radix Radix (2-36), defaults to 10 | ||
* @returns {string} | ||
* @override | ||
* @throws {RangeError} If `radix` is out of range | ||
*/ | ||
export function toString($this, radix) { | ||
radix = radix || 10; | ||
if (radix < 2 || 36 < radix) | ||
throw RangeError('radix'); | ||
if (isZero($this)) | ||
return '0'; | ||
if (isNegative($this)) { // Unsigned Longs are never negative | ||
if (equals($this, MIN_VALUE)) { | ||
// We need to change the Long value before it can be negated, so we remove | ||
// the bottom-most digit in this base and then recurse to do the rest. | ||
var radixLong = fromNumber(radix), div = op_Division($this, radixLong), rem1 = op_Subtraction(op_Multiply(div, radixLong), $this); | ||
return toString(div, radix) + toInt(rem1).toString(radix); | ||
} | ||
else | ||
return '-' + toString(op_UnaryNegation($this), radix); | ||
} | ||
// Do several (6) digits each time through the loop, so as to | ||
// minimize the calls to the very expensive emulated div. | ||
var radixToPower = fromNumber(pow_dbl(radix, 6), $this.unsigned), rem = $this; | ||
var result = ''; | ||
while (true) { | ||
var remDiv = op_Division(rem, radixToPower), intval = toInt(op_Subtraction(rem, op_Multiply(remDiv, radixToPower))) >>> 0, digits = intval.toString(radix); | ||
rem = remDiv; | ||
if (isZero(rem)) | ||
return digits + result; | ||
else { | ||
while (digits.length < 6) | ||
digits = '0' + digits; | ||
result = '' + digits + result; | ||
} | ||
} | ||
} | ||
; | ||
/** | ||
* Gets the high 32 bits as a signed integer. | ||
* @returns {number} Signed high bits | ||
*/ | ||
export function getHighBits($this) { | ||
return $this.high; | ||
} | ||
; | ||
/** | ||
* Gets the high 32 bits as an unsigned integer. | ||
* @returns {number} Unsigned high bits | ||
*/ | ||
export function getHighBitsUnsigned($this) { | ||
return $this.high >>> 0; | ||
} | ||
; | ||
/** | ||
* Gets the low 32 bits as a signed integer. | ||
* @returns {number} Signed low bits | ||
*/ | ||
export function getLowBits($this) { | ||
return $this.low; | ||
} | ||
; | ||
/** | ||
* Gets the low 32 bits as an unsigned integer. | ||
* @returns {number} Unsigned low bits | ||
*/ | ||
export function getLowBitsUnsigned($this) { | ||
return $this.low >>> 0; | ||
} | ||
; | ||
/** | ||
* Gets the number of bits needed to represent the absolute value of this Long. | ||
* @returns {number} | ||
*/ | ||
export function getNumBitsAbs($this) { | ||
if (isNegative($this)) // Unsigned Longs are never negative | ||
return equals($this, MIN_VALUE) ? 64 : getNumBitsAbs(op_UnaryNegation($this)); | ||
var val = $this.high != 0 ? $this.high : $this.low; | ||
for (var bit = 31; bit > 0; bit--) | ||
if ((val & (1 << bit)) != 0) | ||
break; | ||
return $this.high != 0 ? bit + 33 : bit + 1; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value equals zero. | ||
* @returns {boolean} | ||
*/ | ||
export function isZero($this) { | ||
return $this.high === 0 && $this.low === 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is negative. | ||
* @returns {boolean} | ||
*/ | ||
export function isNegative($this) { | ||
return !$this.unsigned && $this.high < 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is positive. | ||
* @returns {boolean} | ||
*/ | ||
export function isPositive($this) { | ||
return $this.unsigned || $this.high >= 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is odd. | ||
* @returns {boolean} | ||
*/ | ||
export function isOdd($this) { | ||
return ($this.low & 1) === 1; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is even. | ||
* @returns {boolean} | ||
*/ | ||
export function isEven($this) { | ||
return ($this.low & 1) === 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value equals the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function equals($this, other) { | ||
if (!isLong(other)) | ||
other = fromValue(other); | ||
if ($this.unsigned !== other.unsigned && ($this.high >>> 31) === 1 && (other.high >>> 31) === 1) | ||
return false; | ||
return $this.high === other.high && $this.low === other.low; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value differs from the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function notEquals($this, other) { | ||
return !equals($this, /* validates */ other); | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is less than the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function lessThan($this, other) { | ||
return compare($this, /* validates */ other) < 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is less than or equal the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function lessThanOrEqual($this, other) { | ||
return compare($this, /* validates */ other) <= 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is greater than the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function greaterThan($this, other) { | ||
return compare($this, /* validates */ other) > 0; | ||
} | ||
; | ||
/** | ||
* Tests if this Long's value is greater than or equal the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {boolean} | ||
*/ | ||
export function greaterThanOrEqual($this, other) { | ||
return compare($this, /* validates */ other) >= 0; | ||
} | ||
; | ||
/** | ||
* Compares this Long's value with the specified's. | ||
* @param {!Long|number|string} other Other value | ||
* @returns {number} 0 if they are the same, 1 if the this is greater and -1 | ||
* if the given one is greater | ||
*/ | ||
export function compare($this, other) { | ||
if (!isLong(other)) | ||
other = fromValue(other); | ||
if (equals($this, other)) | ||
return 0; | ||
var thisNeg = isNegative($this), otherNeg = isNegative(other); | ||
if (thisNeg && !otherNeg) | ||
return -1; | ||
if (!thisNeg && otherNeg) | ||
return 1; | ||
// At this point the sign bits are the same | ||
if (!$this.unsigned) | ||
return isNegative(op_Subtraction($this, other)) ? -1 : 1; | ||
// Both are positive if at least one is unsigned | ||
return (other.high >>> 0) > ($this.high >>> 0) || (other.high === $this.high && (other.low >>> 0) > ($this.low >>> 0)) ? -1 : 1; | ||
} | ||
; | ||
/** | ||
* Absolute value of the given number. | ||
*/ | ||
export function abs($this) { | ||
if (!$this.unsigned && isNegative($this)) | ||
return op_UnaryNegation($this); | ||
else | ||
return $this; | ||
} | ||
/** | ||
* Negates this Long's value. | ||
* @returns {!Long} Negated Long | ||
*/ | ||
export function op_UnaryNegation($this) { | ||
if (!$this.unsigned && equals($this, MIN_VALUE)) | ||
return MIN_VALUE; | ||
return op_Addition(op_LogicalNot($this), ONE); | ||
} | ||
; | ||
/** | ||
* Returns the sum of this and the specified Long. | ||
* @param {!Long|number|string} addend Addend | ||
* @returns {!Long} Sum | ||
*/ | ||
export function op_Addition($this, addend) { | ||
if (!isLong(addend)) | ||
addend = fromValue(addend); | ||
// Divide each number into 4 chunks of 16 bits, and then sum the chunks. | ||
var a48 = $this.high >>> 16; | ||
var a32 = $this.high & 0xFFFF; | ||
var a16 = $this.low >>> 16; | ||
var a00 = $this.low & 0xFFFF; | ||
var b48 = addend.high >>> 16; | ||
var b32 = addend.high & 0xFFFF; | ||
var b16 = addend.low >>> 16; | ||
var b00 = addend.low & 0xFFFF; | ||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0; | ||
c00 += a00 + b00; | ||
c16 += c00 >>> 16; | ||
c00 &= 0xFFFF; | ||
c16 += a16 + b16; | ||
c32 += c16 >>> 16; | ||
c16 &= 0xFFFF; | ||
c32 += a32 + b32; | ||
c48 += c32 >>> 16; | ||
c32 &= 0xFFFF; | ||
c48 += a48 + b48; | ||
c48 &= 0xFFFF; | ||
return fromBits((c16 << 16) | c00, (c48 << 16) | c32, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns the difference of this and the specified Long. | ||
* @param {!Long|number|string} subtrahend Subtrahend | ||
* @returns {!Long} Difference | ||
*/ | ||
export function op_Subtraction($this, subtrahend) { | ||
if (!isLong(subtrahend)) | ||
subtrahend = fromValue(subtrahend); | ||
return op_Addition($this, op_UnaryNegation(subtrahend)); | ||
} | ||
; | ||
/** | ||
* Returns the product of this and the specified Long. | ||
* @param {!Long|number|string} multiplier Multiplier | ||
* @returns {!Long} Product | ||
*/ | ||
export function op_Multiply($this, multiplier) { | ||
if (isZero($this)) | ||
return $this.unsigned ? UZERO : ZERO; | ||
if (!isLong(multiplier)) | ||
multiplier = fromValue(multiplier); | ||
// use wasm support if present | ||
if (wasm) { | ||
var low = wasm.mul($this.low, $this.high, multiplier.low, multiplier.high); | ||
return fromBits(low, wasm.get_high(), $this.unsigned); | ||
} | ||
if (isZero(multiplier)) | ||
return $this.unsigned ? UZERO : ZERO; | ||
if (equals($this, MIN_VALUE)) | ||
return isOdd(multiplier) ? MIN_VALUE : ZERO; | ||
if (equals(multiplier, MIN_VALUE)) | ||
return isOdd($this) ? MIN_VALUE : ZERO; | ||
if (isNegative($this)) { | ||
if (isNegative(multiplier)) | ||
return op_Multiply(op_UnaryNegation($this), op_UnaryNegation(multiplier)); | ||
else | ||
return op_UnaryNegation(op_Multiply(op_UnaryNegation($this), multiplier)); | ||
} | ||
else if (isNegative(multiplier)) | ||
return op_UnaryNegation(op_Multiply($this, op_UnaryNegation(multiplier))); | ||
// If both longs are small, use float multiplication | ||
if (lessThan($this, TWO_PWR_24) && lessThan(multiplier, TWO_PWR_24)) | ||
return fromNumber(toNumber($this) * toNumber(multiplier), $this.unsigned); | ||
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. | ||
// We can skip products that would overflow. | ||
var a48 = $this.high >>> 16; | ||
var a32 = $this.high & 0xFFFF; | ||
var a16 = $this.low >>> 16; | ||
var a00 = $this.low & 0xFFFF; | ||
var b48 = multiplier.high >>> 16; | ||
var b32 = multiplier.high & 0xFFFF; | ||
var b16 = multiplier.low >>> 16; | ||
var b00 = multiplier.low & 0xFFFF; | ||
var c48 = 0, c32 = 0, c16 = 0, c00 = 0; | ||
c00 += a00 * b00; | ||
c16 += c00 >>> 16; | ||
c00 &= 0xFFFF; | ||
c16 += a16 * b00; | ||
c32 += c16 >>> 16; | ||
c16 &= 0xFFFF; | ||
c16 += a00 * b16; | ||
c32 += c16 >>> 16; | ||
c16 &= 0xFFFF; | ||
c32 += a32 * b00; | ||
c48 += c32 >>> 16; | ||
c32 &= 0xFFFF; | ||
c32 += a16 * b16; | ||
c48 += c32 >>> 16; | ||
c32 &= 0xFFFF; | ||
c32 += a00 * b32; | ||
c48 += c32 >>> 16; | ||
c32 &= 0xFFFF; | ||
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; | ||
c48 &= 0xFFFF; | ||
return fromBits((c16 << 16) | c00, (c48 << 16) | c32, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns this Long divided by the specified. The result is signed if this Long is signed or | ||
* unsigned if this Long is unsigned. | ||
* @param {!Long|number|string} divisor Divisor | ||
* @returns {!Long} Quotient | ||
*/ | ||
export function op_Division($this, divisor) { | ||
if (!isLong(divisor)) | ||
divisor = fromValue(divisor); | ||
if (isZero(divisor)) | ||
throw Error('division by zero'); | ||
// use wasm support if present | ||
if (wasm) { | ||
// guard against signed division overflow: the largest | ||
// negative number / -1 would be 1 larger than the largest | ||
// positive number, due to two's complement. | ||
if (!$this.unsigned && | ||
$this.high === -0x80000000 && | ||
divisor.low === -1 && divisor.high === -1) { | ||
// be consistent with non-wasm code path | ||
return $this; | ||
} | ||
var low = ($this.unsigned ? wasm.div_u : wasm.div_s)($this.low, $this.high, divisor.low, divisor.high); | ||
return fromBits(low, wasm.get_high(), $this.unsigned); | ||
} | ||
if (isZero($this)) | ||
return $this.unsigned ? UZERO : ZERO; | ||
var approx, rem, res; | ||
if (!$this.unsigned) { | ||
// This section is only relevant for signed longs and is derived from the | ||
// closure library as a whole. | ||
if (equals($this, MIN_VALUE)) { | ||
if (equals(divisor, ONE) || equals(divisor, NEG_ONE)) | ||
return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE | ||
else if (equals(divisor, MIN_VALUE)) | ||
return ONE; | ||
else { | ||
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. | ||
var halfThis = op_RightShift($this, 1); | ||
approx = op_LeftShift(op_Division(halfThis, divisor), 1); | ||
if (equals(approx, ZERO)) { | ||
return isNegative(divisor) ? ONE : NEG_ONE; | ||
} | ||
else { | ||
rem = op_Subtraction($this, op_Multiply(divisor, approx)); | ||
res = op_Addition(approx, op_Division(rem, divisor)); | ||
return res; | ||
} | ||
} | ||
} | ||
else if (equals(divisor, MIN_VALUE)) | ||
return $this.unsigned ? UZERO : ZERO; | ||
if (isNegative($this)) { | ||
if (isNegative(divisor)) | ||
return op_Division(op_UnaryNegation($this), op_UnaryNegation(divisor)); | ||
return op_UnaryNegation(op_Division(op_UnaryNegation($this), divisor)); | ||
} | ||
else if (isNegative(divisor)) | ||
return op_UnaryNegation(op_Division($this, op_UnaryNegation(divisor))); | ||
res = ZERO; | ||
} | ||
else { | ||
// The algorithm below has not been made for unsigned longs. It's therefore | ||
// required to take special care of the MSB prior to running it. | ||
if (!divisor.unsigned) | ||
divisor = toUnsigned(divisor); | ||
if (greaterThan(divisor, $this)) | ||
return UZERO; | ||
if (greaterThan(divisor, op_RightShiftUnsigned($this, 1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true | ||
return UONE; | ||
res = UZERO; | ||
} | ||
// Repeat the following until the remainder is less than other: find a | ||
// floating-point that approximates remainder / other *from below*, add this | ||
// into the result, and subtract it from the remainder. It is critical that | ||
// the approximate value is less than or equal to the real value so that the | ||
// remainder never becomes negative. | ||
rem = $this; | ||
while (greaterThanOrEqual(rem, divisor)) { | ||
// Approximate the result of division. This may be a little greater or | ||
// smaller than the actual value. | ||
approx = Math.max(1, Math.floor(toNumber(rem) / toNumber(divisor))); | ||
// We will tweak the approximate result by changing it in the 48-th digit or | ||
// the smallest non-fractional digit, whichever is larger. | ||
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48), | ||
// Decrease the approximation until it is smaller than the remainder. Note | ||
// that if it is too large, the product overflows and is negative. | ||
approxRes = fromNumber(approx), approxRem = op_Multiply(approxRes, divisor); | ||
while (isNegative(approxRem) || greaterThan(approxRem, rem)) { | ||
approx -= delta; | ||
approxRes = fromNumber(approx, $this.unsigned); | ||
approxRem = op_Multiply(approxRes, divisor); | ||
} | ||
// We know the answer can't be zero... and actually, zero would cause | ||
// infinite recursion since we would make no progress. | ||
if (isZero(approxRes)) | ||
approxRes = ONE; | ||
res = op_Addition(res, approxRes); | ||
rem = op_Subtraction(rem, approxRem); | ||
} | ||
return res; | ||
} | ||
; | ||
/** | ||
* Returns this Long modulo the specified. | ||
* @param {!Long|number|string} divisor Divisor | ||
* @returns {!Long} Remainder | ||
*/ | ||
export function op_Modulus($this, divisor) { | ||
if (!isLong(divisor)) | ||
divisor = fromValue(divisor); | ||
// use wasm support if present | ||
if (wasm) { | ||
var low = ($this.unsigned ? wasm.rem_u : wasm.rem_s)($this.low, $this.high, divisor.low, divisor.high); | ||
return fromBits(low, wasm.get_high(), $this.unsigned); | ||
} | ||
return op_Subtraction($this, op_Multiply(op_Division($this, divisor), divisor)); | ||
} | ||
; | ||
/** | ||
* Returns the bitwise NOT of this Long. | ||
* @returns {!Long} | ||
*/ | ||
export function op_LogicalNot($this) { | ||
return fromBits(~$this.low, ~$this.high, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns the bitwise AND of this Long and the specified. | ||
* @param {!Long|number|string} other Other Long | ||
* @returns {!Long} | ||
*/ | ||
export function op_BitwiseAnd($this, other) { | ||
if (!isLong(other)) | ||
other = fromValue(other); | ||
return fromBits($this.low & other.low, $this.high & other.high, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns the bitwise OR of this Long and the specified. | ||
* @param {!Long|number|string} other Other Long | ||
* @returns {!Long} | ||
*/ | ||
export function op_BitwiseOr($this, other) { | ||
if (!isLong(other)) | ||
other = fromValue(other); | ||
return fromBits($this.low | other.low, $this.high | other.high, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns the bitwise XOR of this Long and the given one. | ||
* @param {!Long|number|string} other Other Long | ||
* @returns {!Long} | ||
*/ | ||
export function op_ExclusiveOr($this, other) { | ||
if (!isLong(other)) | ||
other = fromValue(other); | ||
return fromBits($this.low ^ other.low, $this.high ^ other.high, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns this Long with bits shifted to the left by the given amount. | ||
* @param {number|!Long} numBits Number of bits | ||
* @returns {!Long} Shifted Long | ||
*/ | ||
export function op_LeftShift($this, numBits) { | ||
if (isLong(numBits)) | ||
numBits = toInt(numBits); | ||
if ((numBits &= 63) === 0) | ||
return $this; | ||
else if (numBits < 32) | ||
return fromBits($this.low << numBits, ($this.high << numBits) | ($this.low >>> (32 - numBits)), $this.unsigned); | ||
else | ||
return fromBits(0, $this.low << (numBits - 32), $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns this Long with bits arithmetically shifted to the right by the given amount. | ||
* @param {number|!Long} numBits Number of bits | ||
* @returns {!Long} Shifted Long | ||
*/ | ||
export function op_RightShift($this, numBits) { | ||
if (isLong(numBits)) | ||
numBits = toInt(numBits); | ||
if ((numBits &= 63) === 0) | ||
return $this; | ||
else if (numBits < 32) | ||
return fromBits(($this.low >>> numBits) | ($this.high << (32 - numBits)), $this.high >> numBits, $this.unsigned); | ||
else | ||
return fromBits($this.high >> (numBits - 32), $this.high >= 0 ? 0 : -1, $this.unsigned); | ||
} | ||
; | ||
/** | ||
* Returns this Long with bits logically shifted to the right by the given amount. | ||
* @param {number|!Long} numBits Number of bits | ||
* @returns {!Long} Shifted Long | ||
*/ | ||
export function op_RightShiftUnsigned($this, numBits) { | ||
if (isLong(numBits)) | ||
numBits = toInt(numBits); | ||
numBits &= 63; | ||
if (numBits === 0) | ||
return $this; | ||
else { | ||
var high = $this.high; | ||
if (numBits < 32) { | ||
var low = $this.low; | ||
return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, $this.unsigned); | ||
} | ||
else if (numBits === 32) | ||
return fromBits(high, 0, $this.unsigned); | ||
else | ||
return fromBits(high >>> (numBits - 32), 0, $this.unsigned); | ||
} | ||
} | ||
; | ||
/** | ||
* Converts this Long to signed. | ||
* @returns {!Long} Signed long | ||
*/ | ||
export function toSigned($this) { | ||
if (!$this.unsigned) | ||
return $this; | ||
return fromBits($this.low, $this.high, false); | ||
} | ||
; | ||
/** | ||
* Converts this Long to unsigned. | ||
* @returns {!Long} Unsigned long | ||
*/ | ||
export function toUnsigned($this) { | ||
if ($this.unsigned) | ||
return $this; | ||
return fromBits($this.low, $this.high, true); | ||
} | ||
; | ||
/** | ||
* Converts this Long to its byte representation. | ||
* @param {boolean=} le Whether little or big endian, defaults to big endian | ||
* @returns {!Array.<number>} Byte representation | ||
*/ | ||
export function toBytes($this, le) { | ||
return le ? toBytesLE($this) : toBytesBE($this); | ||
} | ||
; | ||
/** | ||
* Converts this Long to its little endian byte representation. | ||
* @returns {!Array.<number>} Little endian byte representation | ||
*/ | ||
export function toBytesLE($this) { | ||
var hi = $this.high, lo = $this.low; | ||
return [ | ||
lo & 0xff, | ||
lo >>> 8 & 0xff, | ||
lo >>> 16 & 0xff, | ||
lo >>> 24, | ||
hi & 0xff, | ||
hi >>> 8 & 0xff, | ||
hi >>> 16 & 0xff, | ||
hi >>> 24 | ||
]; | ||
} | ||
; | ||
/** | ||
* Converts this Long to its big endian byte representation. | ||
* @returns {!Array.<number>} Big endian byte representation | ||
*/ | ||
export function toBytesBE($this) { | ||
var hi = $this.high, lo = $this.low; | ||
return [ | ||
hi >>> 24, | ||
hi >>> 16 & 0xff, | ||
hi >>> 8 & 0xff, | ||
hi & 0xff, | ||
lo >>> 24, | ||
lo >>> 16 & 0xff, | ||
lo >>> 8 & 0xff, | ||
lo & 0xff | ||
]; | ||
} | ||
; | ||
/** | ||
* Creates a Long from its byte representation. | ||
* @param {!Array.<number>} bytes Byte representation | ||
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed | ||
* @param {boolean=} le Whether little or big endian, defaults to big endian | ||
* @returns {Long} The corresponding Long value | ||
*/ | ||
export function fromBytes(bytes, unsigned, le) { | ||
return le ? fromBytesLE(bytes, unsigned) : fromBytesBE(bytes, unsigned); | ||
} | ||
; | ||
/** | ||
* Creates a Long from its little endian byte representation. | ||
* @param {!Array.<number>} bytes Little endian byte representation | ||
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed | ||
* @returns {Long} The corresponding Long value | ||
*/ | ||
export function fromBytesLE(bytes, unsigned) { | ||
return new Long(bytes[0] | | ||
bytes[1] << 8 | | ||
bytes[2] << 16 | | ||
bytes[3] << 24, bytes[4] | | ||
bytes[5] << 8 | | ||
bytes[6] << 16 | | ||
bytes[7] << 24, unsigned); | ||
} | ||
; | ||
/** | ||
* Creates a Long from its big endian byte representation. | ||
* @param {!Array.<number>} bytes Big endian byte representation | ||
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed | ||
* @returns {Long} The corresponding Long value | ||
*/ | ||
export function fromBytesBE(bytes, unsigned) { | ||
return new Long(bytes[4] << 24 | | ||
bytes[5] << 16 | | ||
bytes[6] << 8 | | ||
bytes[7], bytes[0] << 24 | | ||
bytes[1] << 16 | | ||
bytes[2] << 8 | | ||
bytes[3], unsigned); | ||
} | ||
; | ||
export function unixEpochMillisecondsToTicks(ms, offset) { | ||
return op_Multiply(op_Addition(op_Addition(fromNumber(ms), 62135596800000), offset), 10000); | ||
return op_Multiply(op_Addition(op_Addition(Long.fromNumber(ms), 62135596800000), offset), 10000); | ||
} | ||
export function ticksToUnixEpochMilliseconds(ticks) { | ||
return toNumber(op_Subtraction(op_Division(ticks, 10000), 62135596800000)); | ||
return Long.toNumber(op_Subtraction(op_Division(ticks, 10000), 62135596800000)); | ||
} | ||
export function makeRangeStepFunction(step, last, unsigned) { | ||
const stepComparedWithZero = compare(step, unsigned ? UZERO : ZERO); | ||
const stepComparedWithZero = Long.compare(step, unsigned ? Long.UZERO : Long.ZERO); | ||
if (stepComparedWithZero === 0) { | ||
@@ -1095,3 +137,3 @@ throw new Error("The step of a range cannot be zero"); | ||
return (x) => { | ||
const comparedWithLast = compare(x, last); | ||
const comparedWithLast = Long.compare(x, last); | ||
if ((stepGreaterThanZero && comparedWithLast <= 0) | ||
@@ -1098,0 +140,0 @@ || (!stepGreaterThanZero && comparedWithLast >= 0)) { |
import { Record, List, declare, Union } from "./Types.js"; | ||
import { type, record, bool, list, union, int32 } from "./Reflection.js"; | ||
import { value as value$$4, some } from "./Option.js"; | ||
import { empty as empty$$1, iterate as iterate$$1, toIterator, map as map$$2, unfold, getEnumerator, fold as fold$$1 } from "./Seq.js"; | ||
import { value as value$$3, some } from "./Option.js"; | ||
import { iterate as iterate$$1, empty as empty$$1, toIterator, map as map$$2, unfold, getEnumerator, fold as fold$$1 } from "./Seq.js"; | ||
import { compare, structuralHash, isDisposable } from "./Util.js"; | ||
import { join, toText, printf } from "./String.js"; | ||
import { MutableMap$00602$$Add$$5BDDA1 as MutableMap$002400602$0024$0024Add$0024$00245BDDA1, MutableMap$00602$$$$002Ector$$Z79760D57 as MutableMap$002400602$0024$0024$0024$0024002Ector$0024$0024Z79760D57 } from "./MutableMap.js"; | ||
import { MutableMap$00602$$$$002Ector$$6623D9B3 as MutableMap$002400602$0024$0024$0024$0024002Ector$0024$00246623D9B3 } from "./MutableMap.js"; | ||
export const MapTree$00602 = declare(function Map_MapTree(tag, name, ...fields) { | ||
@@ -14,4 +14,7 @@ Union.call(this, tag, name, ...fields); | ||
} | ||
export function MapTreeModule$$$sizeAux(acc, m) { | ||
export function MapTreeModule$$$sizeAux($acc$$5, $m$$6) { | ||
MapTreeModule$$$sizeAux: while (true) { | ||
const acc = $acc$$5, | ||
m = $m$$6; | ||
switch (m.tag) { | ||
@@ -25,7 +28,4 @@ case 1: | ||
{ | ||
const r = m.fields[3]; | ||
const l = m.fields[2]; | ||
const $acc$$5 = acc; | ||
acc = MapTreeModule$$$sizeAux($acc$$5 + 1, l); | ||
m = r; | ||
$acc$$5 = MapTreeModule$$$sizeAux(acc + 1, m.fields[2]); | ||
$m$$6 = m.fields[3]; | ||
continue MapTreeModule$$$sizeAux; | ||
@@ -58,4 +58,3 @@ } | ||
{ | ||
const h = _arg1.fields[4] | 0; | ||
return h | 0; | ||
return _arg1.fields[4] | 0; | ||
} | ||
@@ -77,15 +76,15 @@ | ||
export function MapTreeModule$$$mk(l$$1, k, v, r$$1) { | ||
var $target$$6; | ||
var $target$$14; | ||
if (l$$1.tag === 0) { | ||
if (r$$1.tag === 0) { | ||
$target$$6 = 0; | ||
$target$$14 = 0; | ||
} else { | ||
$target$$6 = 1; | ||
$target$$14 = 1; | ||
} | ||
} else { | ||
$target$$6 = 1; | ||
$target$$14 = 1; | ||
} | ||
switch ($target$$6) { | ||
switch ($target$$14) { | ||
case 0: | ||
@@ -111,14 +110,5 @@ { | ||
if (t2.tag === 2) { | ||
const t2v = t2.fields[1]; | ||
const t2r = t2.fields[3]; | ||
const t2l = t2.fields[2]; | ||
const t2k = t2.fields[0]; | ||
if (MapTreeModule$$$height(t2l) > t1h + 1) { | ||
if (t2l.tag === 2) { | ||
const t2lv = t2l.fields[1]; | ||
const t2lr = t2l.fields[3]; | ||
const t2ll = t2l.fields[2]; | ||
const t2lk = t2l.fields[0]; | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1, k$$1, v$$1, t2ll), t2lk, t2lv, MapTreeModule$$$mk(t2lr, t2k, t2v, t2r)); | ||
if (MapTreeModule$$$height(t2.fields[2]) > t1h + 1) { | ||
if (t2.fields[2].tag === 2) { | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1, k$$1, v$$1, t2.fields[2].fields[2]), t2.fields[2].fields[0], t2.fields[2].fields[1], MapTreeModule$$$mk(t2.fields[2].fields[3], t2.fields[0], t2.fields[1], t2.fields[3])); | ||
} else { | ||
@@ -128,3 +118,3 @@ throw new Error("rebalance"); | ||
} else { | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1, k$$1, v$$1, t2l), t2k, t2v, t2r); | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1, k$$1, v$$1, t2.fields[2]), t2.fields[0], t2.fields[1], t2.fields[3]); | ||
} | ||
@@ -136,14 +126,5 @@ } else { | ||
if (t1.tag === 2) { | ||
const t1v = t1.fields[1]; | ||
const t1r = t1.fields[3]; | ||
const t1l = t1.fields[2]; | ||
const t1k = t1.fields[0]; | ||
if (MapTreeModule$$$height(t1r) > t2h + 1) { | ||
if (t1r.tag === 2) { | ||
const t1rv = t1r.fields[1]; | ||
const t1rr = t1r.fields[3]; | ||
const t1rl = t1r.fields[2]; | ||
const t1rk = t1r.fields[0]; | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1l, t1k, t1v, t1rl), t1rk, t1rv, MapTreeModule$$$mk(t1rr, k$$1, v$$1, t2)); | ||
if (MapTreeModule$$$height(t1.fields[3]) > t2h + 1) { | ||
if (t1.fields[3].tag === 2) { | ||
return MapTreeModule$$$mk(MapTreeModule$$$mk(t1.fields[2], t1.fields[0], t1.fields[1], t1.fields[3].fields[2]), t1.fields[3].fields[0], t1.fields[3].fields[1], MapTreeModule$$$mk(t1.fields[3].fields[3], k$$1, v$$1, t2)); | ||
} else { | ||
@@ -153,3 +134,3 @@ throw new Error("re balance"); | ||
} else { | ||
return MapTreeModule$$$mk(t1l, t1k, t1v, MapTreeModule$$$mk(t1r, k$$1, v$$1, t2)); | ||
return MapTreeModule$$$mk(t1.fields[2], t1.fields[0], t1.fields[1], MapTreeModule$$$mk(t1.fields[3], k$$1, v$$1, t2)); | ||
} | ||
@@ -167,4 +148,3 @@ } else { | ||
{ | ||
const k2 = m$$3.fields[0]; | ||
const c = comparer.Compare(k$$2, k2) | 0; | ||
const c = comparer.Compare(k$$2, m$$3.fields[0]) | 0; | ||
@@ -182,15 +162,10 @@ if (c < 0) { | ||
{ | ||
const v2 = m$$3.fields[1]; | ||
const r$$2 = m$$3.fields[3]; | ||
const l$$2 = m$$3.fields[2]; | ||
const k2$$1 = m$$3.fields[0]; | ||
const h$$1 = m$$3.fields[4] | 0; | ||
const c$$1 = comparer.Compare(k$$2, k2$$1) | 0; | ||
const c$$1 = comparer.Compare(k$$2, m$$3.fields[0]) | 0; | ||
if (c$$1 < 0) { | ||
return MapTreeModule$$$rebalance(MapTreeModule$$$add(comparer, k$$2, v$$2, l$$2), k2$$1, v2, r$$2); | ||
return MapTreeModule$$$rebalance(MapTreeModule$$$add(comparer, k$$2, v$$2, m$$3.fields[2]), m$$3.fields[0], m$$3.fields[1], m$$3.fields[3]); | ||
} else if (c$$1 === 0) { | ||
return new MapTree$00602(2, "MapNode", k$$2, v$$2, l$$2, r$$2, h$$1); | ||
return new MapTree$00602(2, "MapNode", k$$2, v$$2, m$$3.fields[2], m$$3.fields[3], m$$3.fields[4]); | ||
} else { | ||
return MapTreeModule$$$rebalance(l$$2, k2$$1, v2, MapTreeModule$$$add(comparer, k$$2, v$$2, r$$2)); | ||
return MapTreeModule$$$rebalance(m$$3.fields[2], m$$3.fields[0], m$$3.fields[1], MapTreeModule$$$add(comparer, k$$2, v$$2, m$$3.fields[3])); | ||
} | ||
@@ -205,13 +180,15 @@ } | ||
} | ||
export function MapTreeModule$$$find(comparer$$1, k$$3, m$$4) { | ||
export function MapTreeModule$$$find($comparer$$1$$23, $k$$3$$24, $m$$4$$25) { | ||
MapTreeModule$$$find: while (true) { | ||
const comparer$$1 = $comparer$$1$$23, | ||
k$$3 = $k$$3$$24, | ||
m$$4 = $m$$4$$25; | ||
switch (m$$4.tag) { | ||
case 1: | ||
{ | ||
const v2$$1 = m$$4.fields[1]; | ||
const k2$$2 = m$$4.fields[0]; | ||
const c$$2 = comparer$$1.Compare(k$$3, k2$$2) | 0; | ||
const c$$2 = comparer$$1.Compare(k$$3, m$$4.fields[0]) | 0; | ||
if (c$$2 === 0) { | ||
return v2$$1; | ||
return m$$4.fields[1]; | ||
} else { | ||
@@ -224,23 +201,15 @@ throw new Error("key not found"); | ||
{ | ||
const v2$$2 = m$$4.fields[1]; | ||
const r$$3 = m$$4.fields[3]; | ||
const l$$3 = m$$4.fields[2]; | ||
const k2$$3 = m$$4.fields[0]; | ||
const c$$3 = comparer$$1.Compare(k$$3, k2$$3) | 0; | ||
const c$$3 = comparer$$1.Compare(k$$3, m$$4.fields[0]) | 0; | ||
if (c$$3 < 0) { | ||
const $comparer$$1$$7 = comparer$$1; | ||
const $k$$3$$8 = k$$3; | ||
comparer$$1 = $comparer$$1$$7; | ||
k$$3 = $k$$3$$8; | ||
m$$4 = l$$3; | ||
$comparer$$1$$23 = comparer$$1; | ||
$k$$3$$24 = k$$3; | ||
$m$$4$$25 = m$$4.fields[2]; | ||
continue MapTreeModule$$$find; | ||
} else if (c$$3 === 0) { | ||
return v2$$2; | ||
return m$$4.fields[1]; | ||
} else { | ||
const $comparer$$1$$9 = comparer$$1; | ||
const $k$$3$$10 = k$$3; | ||
comparer$$1 = $comparer$$1$$9; | ||
k$$3 = $k$$3$$10; | ||
m$$4 = r$$3; | ||
$comparer$$1$$23 = comparer$$1; | ||
$k$$3$$24 = k$$3; | ||
$m$$4$$25 = m$$4.fields[3]; | ||
continue MapTreeModule$$$find; | ||
@@ -259,13 +228,15 @@ } | ||
} | ||
export function MapTreeModule$$$tryFind(comparer$$2, k$$4, m$$5) { | ||
export function MapTreeModule$$$tryFind($comparer$$2$$26, $k$$4$$27, $m$$5$$28) { | ||
MapTreeModule$$$tryFind: while (true) { | ||
const comparer$$2 = $comparer$$2$$26, | ||
k$$4 = $k$$4$$27, | ||
m$$5 = $m$$5$$28; | ||
switch (m$$5.tag) { | ||
case 1: | ||
{ | ||
const v2$$3 = m$$5.fields[1]; | ||
const k2$$4 = m$$5.fields[0]; | ||
const c$$4 = comparer$$2.Compare(k$$4, k2$$4) | 0; | ||
const c$$4 = comparer$$2.Compare(k$$4, m$$5.fields[0]) | 0; | ||
if (c$$4 === 0) { | ||
return some(v2$$3); | ||
return some(m$$5.fields[1]); | ||
} else { | ||
@@ -278,23 +249,15 @@ return null; | ||
{ | ||
const v2$$4 = m$$5.fields[1]; | ||
const r$$4 = m$$5.fields[3]; | ||
const l$$4 = m$$5.fields[2]; | ||
const k2$$5 = m$$5.fields[0]; | ||
const c$$5 = comparer$$2.Compare(k$$4, k2$$5) | 0; | ||
const c$$5 = comparer$$2.Compare(k$$4, m$$5.fields[0]) | 0; | ||
if (c$$5 < 0) { | ||
const $comparer$$2$$11 = comparer$$2; | ||
const $k$$4$$12 = k$$4; | ||
comparer$$2 = $comparer$$2$$11; | ||
k$$4 = $k$$4$$12; | ||
m$$5 = l$$4; | ||
$comparer$$2$$26 = comparer$$2; | ||
$k$$4$$27 = k$$4; | ||
$m$$5$$28 = m$$5.fields[2]; | ||
continue MapTreeModule$$$tryFind; | ||
} else if (c$$5 === 0) { | ||
return some(v2$$4); | ||
return some(m$$5.fields[1]); | ||
} else { | ||
const $comparer$$2$$13 = comparer$$2; | ||
const $k$$4$$14 = k$$4; | ||
comparer$$2 = $comparer$$2$$13; | ||
k$$4 = $k$$4$$14; | ||
m$$5 = r$$4; | ||
$comparer$$2$$26 = comparer$$2; | ||
$k$$4$$27 = k$$4; | ||
$m$$5$$28 = m$$5.fields[3]; | ||
continue MapTreeModule$$$tryFind; | ||
@@ -320,10 +283,9 @@ } | ||
} | ||
export function MapTreeModule$$$partitionAux($arg$$21, $arg$$22, $arg$$23, $arg$$24, $arg$$25) { | ||
export function MapTreeModule$$$partitionAux($comparer$$4$$35, $f$$1$$36, $s$$37, $acc_0$$38, $acc_1$$39) { | ||
MapTreeModule$$$partitionAux: while (true) { | ||
const comparer$$4 = $arg$$21, | ||
f$$1 = $arg$$22, | ||
s = $arg$$23, | ||
acc_0 = $arg$$24, | ||
acc_1 = $arg$$25; | ||
const acc$$1 = [acc_0, acc_1]; | ||
const comparer$$4 = $comparer$$4$$35, | ||
f$$1 = $f$$1$$36, | ||
s = $s$$37, | ||
acc_0 = $acc_0$$38, | ||
acc_1 = $acc_1$$39; | ||
@@ -333,5 +295,3 @@ switch (s.tag) { | ||
{ | ||
const v$$4 = s.fields[1]; | ||
const k$$6 = s.fields[0]; | ||
return MapTreeModule$$$partition1(comparer$$4, f$$1, k$$6, v$$4, acc$$1[0], acc$$1[1]); | ||
return MapTreeModule$$$partition1(comparer$$4, f$$1, s.fields[0], s.fields[1], acc_0, acc_1); | ||
} | ||
@@ -341,13 +301,9 @@ | ||
{ | ||
const v$$5 = s.fields[1]; | ||
const r$$5 = s.fields[3]; | ||
const l$$5 = s.fields[2]; | ||
const k$$7 = s.fields[0]; | ||
const acc$$2 = MapTreeModule$$$partitionAux(comparer$$4, f$$1, r$$5, acc$$1[0], acc$$1[1]); | ||
const acc$$3 = MapTreeModule$$$partition1(comparer$$4, f$$1, k$$7, v$$5, acc$$2[0], acc$$2[1]); | ||
$arg$$21 = comparer$$4; | ||
$arg$$22 = f$$1; | ||
$arg$$23 = l$$5; | ||
$arg$$24 = acc$$3[0]; | ||
$arg$$25 = acc$$3[1]; | ||
const acc$$2 = MapTreeModule$$$partitionAux(comparer$$4, f$$1, s.fields[3], acc_0, acc_1); | ||
const acc$$3 = MapTreeModule$$$partition1(comparer$$4, f$$1, s.fields[0], s.fields[1], acc$$2[0], acc$$2[1]); | ||
$comparer$$4$$35 = comparer$$4; | ||
$f$$1$$36 = f$$1; | ||
$s$$37 = s.fields[2]; | ||
$acc_0$$38 = acc$$3[0]; | ||
$acc_1$$39 = acc$$3[1]; | ||
continue MapTreeModule$$$partitionAux; | ||
@@ -358,3 +314,3 @@ } | ||
{ | ||
return acc$$1; | ||
return [acc_0, acc_1]; | ||
} | ||
@@ -376,8 +332,8 @@ } | ||
} | ||
export function MapTreeModule$$$filterAux($arg$$34, $arg$$35, $arg$$36, $arg$$37) { | ||
export function MapTreeModule$$$filterAux($comparer$$7$$48, $f$$4$$49, $s$$2$$50, $acc$$5$$51) { | ||
MapTreeModule$$$filterAux: while (true) { | ||
const comparer$$7 = $arg$$34, | ||
f$$4 = $arg$$35, | ||
s$$2 = $arg$$36, | ||
acc$$5 = $arg$$37; | ||
const comparer$$7 = $comparer$$7$$48, | ||
f$$4 = $f$$4$$49, | ||
s$$2 = $s$$2$$50, | ||
acc$$5 = $acc$$5$$51; | ||
@@ -387,5 +343,3 @@ switch (s$$2.tag) { | ||
{ | ||
const v$$7 = s$$2.fields[1]; | ||
const k$$9 = s$$2.fields[0]; | ||
return MapTreeModule$$$filter1(comparer$$7, f$$4, k$$9, v$$7, acc$$5); | ||
return MapTreeModule$$$filter1(comparer$$7, f$$4, s$$2.fields[0], s$$2.fields[1], acc$$5); | ||
} | ||
@@ -395,12 +349,8 @@ | ||
{ | ||
const v$$8 = s$$2.fields[1]; | ||
const r$$6 = s$$2.fields[3]; | ||
const l$$6 = s$$2.fields[2]; | ||
const k$$10 = s$$2.fields[0]; | ||
const acc$$6 = MapTreeModule$$$filterAux(comparer$$7, f$$4, l$$6, acc$$5); | ||
const acc$$7 = MapTreeModule$$$filter1(comparer$$7, f$$4, k$$10, v$$8, acc$$6); | ||
$arg$$34 = comparer$$7; | ||
$arg$$35 = f$$4; | ||
$arg$$36 = r$$6; | ||
$arg$$37 = acc$$7; | ||
const acc$$6 = MapTreeModule$$$filterAux(comparer$$7, f$$4, s$$2.fields[2], acc$$5); | ||
const acc$$7 = MapTreeModule$$$filter1(comparer$$7, f$$4, s$$2.fields[0], s$$2.fields[1], acc$$6); | ||
$comparer$$7$$48 = comparer$$7; | ||
$f$$4$$49 = f$$4; | ||
$s$$2$$50 = s$$2.fields[3]; | ||
$acc$$5$$51 = acc$$7; | ||
continue MapTreeModule$$$filterAux; | ||
@@ -425,5 +375,3 @@ } | ||
{ | ||
const v2$$5 = m$$6.fields[1]; | ||
const k2$$6 = m$$6.fields[0]; | ||
return [k2$$6, v2$$5, new MapTree$00602(0, "MapEmpty")]; | ||
return [m$$6.fields[0], m$$6.fields[1], new MapTree$00602(0, "MapEmpty")]; | ||
} | ||
@@ -433,15 +381,7 @@ | ||
{ | ||
const v2$$6 = m$$6.fields[1]; | ||
const r$$7 = m$$6.fields[3]; | ||
const l$$7 = m$$6.fields[2]; | ||
const k2$$7 = m$$6.fields[0]; | ||
if (l$$7.tag === 0) { | ||
return [k2$$7, v2$$6, r$$7]; | ||
if (m$$6.fields[2].tag === 0) { | ||
return [m$$6.fields[0], m$$6.fields[1], m$$6.fields[3]]; | ||
} else { | ||
const patternInput = MapTreeModule$$$spliceOutSuccessor(l$$7); | ||
const v3 = patternInput[1]; | ||
const l$0027 = patternInput[2]; | ||
const k3 = patternInput[0]; | ||
return [k3, v3, MapTreeModule$$$mk(l$0027, k2$$7, v2$$6, r$$7)]; | ||
const patternInput = MapTreeModule$$$spliceOutSuccessor(m$$6.fields[2]); | ||
return [patternInput[0], patternInput[1], MapTreeModule$$$mk(patternInput[2], m$$6.fields[0], m$$6.fields[1], m$$6.fields[3])]; | ||
} | ||
@@ -460,4 +400,3 @@ } | ||
{ | ||
const k2$$8 = m$$7.fields[0]; | ||
const c$$6 = comparer$$9.Compare(k$$11, k2$$8) | 0; | ||
const c$$6 = comparer$$9.Compare(k$$11, m$$7.fields[0]) | 0; | ||
@@ -473,24 +412,17 @@ if (c$$6 === 0) { | ||
{ | ||
const v2$$7 = m$$7.fields[1]; | ||
const r$$8 = m$$7.fields[3]; | ||
const l$$8 = m$$7.fields[2]; | ||
const k2$$9 = m$$7.fields[0]; | ||
const c$$7 = comparer$$9.Compare(k$$11, k2$$9) | 0; | ||
const c$$7 = comparer$$9.Compare(k$$11, m$$7.fields[0]) | 0; | ||
if (c$$7 < 0) { | ||
return MapTreeModule$$$rebalance(MapTreeModule$$$remove(comparer$$9, k$$11, l$$8), k2$$9, v2$$7, r$$8); | ||
return MapTreeModule$$$rebalance(MapTreeModule$$$remove(comparer$$9, k$$11, m$$7.fields[2]), m$$7.fields[0], m$$7.fields[1], m$$7.fields[3]); | ||
} else if (c$$7 === 0) { | ||
if (l$$8.tag === 0) { | ||
return r$$8; | ||
} else if (r$$8.tag === 0) { | ||
return l$$8; | ||
if (m$$7.fields[2].tag === 0) { | ||
return m$$7.fields[3]; | ||
} else if (m$$7.fields[3].tag === 0) { | ||
return m$$7.fields[2]; | ||
} else { | ||
const patternInput$$1 = MapTreeModule$$$spliceOutSuccessor(r$$8); | ||
const sv = patternInput$$1[1]; | ||
const sk = patternInput$$1[0]; | ||
const r$0027 = patternInput$$1[2]; | ||
return MapTreeModule$$$mk(l$$8, sk, sv, r$0027); | ||
const patternInput$$1 = MapTreeModule$$$spliceOutSuccessor(m$$7.fields[3]); | ||
return MapTreeModule$$$mk(m$$7.fields[2], patternInput$$1[0], patternInput$$1[1], patternInput$$1[2]); | ||
} | ||
} else { | ||
return MapTreeModule$$$rebalance(l$$8, k2$$9, v2$$7, MapTreeModule$$$remove(comparer$$9, k$$11, r$$8)); | ||
return MapTreeModule$$$rebalance(m$$7.fields[2], m$$7.fields[0], m$$7.fields[1], MapTreeModule$$$remove(comparer$$9, k$$11, m$$7.fields[3])); | ||
} | ||
@@ -505,9 +437,12 @@ } | ||
} | ||
export function MapTreeModule$$$mem(comparer$$10, k$$12, m$$8) { | ||
export function MapTreeModule$$$mem($comparer$$10$$59, $k$$12$$60, $m$$8$$61) { | ||
MapTreeModule$$$mem: while (true) { | ||
const comparer$$10 = $comparer$$10$$59, | ||
k$$12 = $k$$12$$60, | ||
m$$8 = $m$$8$$61; | ||
switch (m$$8.tag) { | ||
case 1: | ||
{ | ||
const k2$$10 = m$$8.fields[0]; | ||
return comparer$$10.Compare(k$$12, k2$$10) === 0; | ||
return comparer$$10.Compare(k$$12, m$$8.fields[0]) === 0; | ||
} | ||
@@ -517,13 +452,8 @@ | ||
{ | ||
const r$$9 = m$$8.fields[3]; | ||
const l$$9 = m$$8.fields[2]; | ||
const k2$$11 = m$$8.fields[0]; | ||
const c$$8 = comparer$$10.Compare(k$$12, k2$$11) | 0; | ||
const c$$8 = comparer$$10.Compare(k$$12, m$$8.fields[0]) | 0; | ||
if (c$$8 < 0) { | ||
const $comparer$$10$$41 = comparer$$10; | ||
const $k$$12$$42 = k$$12; | ||
comparer$$10 = $comparer$$10$$41; | ||
k$$12 = $k$$12$$42; | ||
m$$8 = l$$9; | ||
$comparer$$10$$59 = comparer$$10; | ||
$k$$12$$60 = k$$12; | ||
$m$$8$$61 = m$$8.fields[2]; | ||
continue MapTreeModule$$$mem; | ||
@@ -533,7 +463,5 @@ } else if (c$$8 === 0) { | ||
} else { | ||
const $comparer$$10$$43 = comparer$$10; | ||
const $k$$12$$44 = k$$12; | ||
comparer$$10 = $comparer$$10$$43; | ||
k$$12 = $k$$12$$44; | ||
m$$8 = r$$9; | ||
$comparer$$10$$59 = comparer$$10; | ||
$k$$12$$60 = k$$12; | ||
$m$$8$$61 = m$$8.fields[3]; | ||
continue MapTreeModule$$$mem; | ||
@@ -552,6 +480,6 @@ } | ||
} | ||
export function MapTreeModule$$$iter($arg$$45, $arg$$46) { | ||
export function MapTreeModule$$$iter($f$$6$$62, $m$$9$$63) { | ||
MapTreeModule$$$iter: while (true) { | ||
const f$$6 = $arg$$45, | ||
m$$9 = $arg$$46; | ||
const f$$6 = $f$$6$$62, | ||
m$$9 = $m$$9$$63; | ||
@@ -561,5 +489,3 @@ switch (m$$9.tag) { | ||
{ | ||
const v2$$8 = m$$9.fields[1]; | ||
const k2$$12 = m$$9.fields[0]; | ||
f$$6(k2$$12, v2$$8); | ||
f$$6(m$$9.fields[0], m$$9.fields[1]); | ||
break; | ||
@@ -570,10 +496,6 @@ } | ||
{ | ||
const v2$$9 = m$$9.fields[1]; | ||
const r$$10 = m$$9.fields[3]; | ||
const l$$10 = m$$9.fields[2]; | ||
const k2$$13 = m$$9.fields[0]; | ||
MapTreeModule$$$iter(f$$6, l$$10); | ||
f$$6(k2$$13, v2$$9); | ||
$arg$$45 = f$$6; | ||
$arg$$46 = r$$10; | ||
MapTreeModule$$$iter(f$$6, m$$9.fields[2]); | ||
f$$6(m$$9.fields[0], m$$9.fields[1]); | ||
$f$$6$$62 = f$$6; | ||
$m$$9$$63 = m$$9.fields[3]; | ||
continue MapTreeModule$$$iter; | ||
@@ -590,6 +512,6 @@ break; | ||
} | ||
export function MapTreeModule$$$tryPick($arg$$47, $arg$$48) { | ||
export function MapTreeModule$$$tryPick($f$$7$$64, $m$$10$$65) { | ||
MapTreeModule$$$tryPick: while (true) { | ||
const f$$7 = $arg$$47, | ||
m$$10 = $arg$$48; | ||
const f$$7 = $f$$7$$64, | ||
m$$10 = $m$$10$$65; | ||
@@ -599,5 +521,3 @@ switch (m$$10.tag) { | ||
{ | ||
const v2$$10 = m$$10.fields[1]; | ||
const k2$$14 = m$$10.fields[0]; | ||
return f$$7(k2$$14, v2$$10); | ||
return f$$7(m$$10.fields[0], m$$10.fields[1]); | ||
} | ||
@@ -607,22 +527,16 @@ | ||
{ | ||
const v2$$11 = m$$10.fields[1]; | ||
const r$$11 = m$$10.fields[3]; | ||
const l$$11 = m$$10.fields[2]; | ||
const k2$$15 = m$$10.fields[0]; | ||
const matchValue$$2 = MapTreeModule$$$tryPick(f$$7, l$$11); | ||
const matchValue$$2 = MapTreeModule$$$tryPick(f$$7, m$$10.fields[2]); | ||
if (matchValue$$2 == null) { | ||
const matchValue$$3 = f$$7(k2$$15, v2$$11); | ||
const matchValue$$3 = f$$7(m$$10.fields[0], m$$10.fields[1]); | ||
if (matchValue$$3 == null) { | ||
$arg$$47 = f$$7; | ||
$arg$$48 = r$$11; | ||
$f$$7$$64 = f$$7; | ||
$m$$10$$65 = m$$10.fields[3]; | ||
continue MapTreeModule$$$tryPick; | ||
} else { | ||
const res$$1 = matchValue$$3; | ||
return res$$1; | ||
return matchValue$$3; | ||
} | ||
} else { | ||
const res = matchValue$$2; | ||
return res; | ||
return matchValue$$2; | ||
} | ||
@@ -640,6 +554,6 @@ } | ||
} | ||
export function MapTreeModule$$$exists($arg$$49, $arg$$50) { | ||
export function MapTreeModule$$$exists($f$$8$$66, $m$$11$$67) { | ||
MapTreeModule$$$exists: while (true) { | ||
const f$$8 = $arg$$49, | ||
m$$11 = $arg$$50; | ||
const f$$8 = $f$$8$$66, | ||
m$$11 = $m$$11$$67; | ||
@@ -649,5 +563,3 @@ switch (m$$11.tag) { | ||
{ | ||
const v2$$12 = m$$11.fields[1]; | ||
const k2$$16 = m$$11.fields[0]; | ||
return f$$8(k2$$16, v2$$12); | ||
return f$$8(m$$11.fields[0], m$$11.fields[1]); | ||
} | ||
@@ -657,12 +569,7 @@ | ||
{ | ||
const v2$$13 = m$$11.fields[1]; | ||
const r$$12 = m$$11.fields[3]; | ||
const l$$12 = m$$11.fields[2]; | ||
const k2$$17 = m$$11.fields[0]; | ||
if (MapTreeModule$$$exists(f$$8, l$$12) ? true : f$$8(k2$$17, v2$$13)) { | ||
if (MapTreeModule$$$exists(f$$8, m$$11.fields[2]) ? true : f$$8(m$$11.fields[0], m$$11.fields[1])) { | ||
return true; | ||
} else { | ||
$arg$$49 = f$$8; | ||
$arg$$50 = r$$12; | ||
$f$$8$$66 = f$$8; | ||
$m$$11$$67 = m$$11.fields[3]; | ||
continue MapTreeModule$$$exists; | ||
@@ -681,6 +588,6 @@ } | ||
} | ||
export function MapTreeModule$$$forall($arg$$51, $arg$$52) { | ||
export function MapTreeModule$$$forall($f$$9$$68, $m$$12$$69) { | ||
MapTreeModule$$$forall: while (true) { | ||
const f$$9 = $arg$$51, | ||
m$$12 = $arg$$52; | ||
const f$$9 = $f$$9$$68, | ||
m$$12 = $m$$12$$69; | ||
@@ -690,5 +597,3 @@ switch (m$$12.tag) { | ||
{ | ||
const v2$$14 = m$$12.fields[1]; | ||
const k2$$18 = m$$12.fields[0]; | ||
return f$$9(k2$$18, v2$$14); | ||
return f$$9(m$$12.fields[0], m$$12.fields[1]); | ||
} | ||
@@ -698,10 +603,5 @@ | ||
{ | ||
const v2$$15 = m$$12.fields[1]; | ||
const r$$13 = m$$12.fields[3]; | ||
const l$$13 = m$$12.fields[2]; | ||
const k2$$19 = m$$12.fields[0]; | ||
if (MapTreeModule$$$forall(f$$9, l$$13) ? f$$9(k2$$19, v2$$15) : false) { | ||
$arg$$51 = f$$9; | ||
$arg$$52 = r$$13; | ||
if (MapTreeModule$$$forall(f$$9, m$$12.fields[2]) ? f$$9(m$$12.fields[0], m$$12.fields[1]) : false) { | ||
$f$$9$$68 = f$$9; | ||
$m$$12$$69 = m$$12.fields[3]; | ||
continue MapTreeModule$$$forall; | ||
@@ -726,5 +626,3 @@ } else { | ||
{ | ||
const v$$9 = m$$13.fields[1]; | ||
const k$$13 = m$$13.fields[0]; | ||
return new MapTree$00602(1, "MapOne", k$$13, f$$10(v$$9)); | ||
return new MapTree$00602(1, "MapOne", m$$13.fields[0], f$$10(m$$13.fields[1])); | ||
} | ||
@@ -734,11 +632,6 @@ | ||
{ | ||
const v$$10 = m$$13.fields[1]; | ||
const r$$14 = m$$13.fields[3]; | ||
const l$$14 = m$$13.fields[2]; | ||
const k$$14 = m$$13.fields[0]; | ||
const h$$2 = m$$13.fields[4] | 0; | ||
const l2 = MapTreeModule$$$map(f$$10, l$$14); | ||
const v2$$16 = f$$10(v$$10); | ||
const r2 = MapTreeModule$$$map(f$$10, r$$14); | ||
return new MapTree$00602(2, "MapNode", k$$14, v2$$16, l2, r2, h$$2); | ||
const l2 = MapTreeModule$$$map(f$$10, m$$13.fields[2]); | ||
const v2$$16 = f$$10(m$$13.fields[1]); | ||
const r2 = MapTreeModule$$$map(f$$10, m$$13.fields[3]); | ||
return new MapTree$00602(2, "MapNode", m$$13.fields[0], v2$$16, l2, r2, m$$13.fields[4]); | ||
} | ||
@@ -756,5 +649,3 @@ | ||
{ | ||
const v$$11 = m$$14.fields[1]; | ||
const k$$15 = m$$14.fields[0]; | ||
return new MapTree$00602(1, "MapOne", k$$15, f$$11(k$$15, v$$11)); | ||
return new MapTree$00602(1, "MapOne", m$$14.fields[0], f$$11(m$$14.fields[0], m$$14.fields[1])); | ||
} | ||
@@ -764,11 +655,6 @@ | ||
{ | ||
const v$$12 = m$$14.fields[1]; | ||
const r$$15 = m$$14.fields[3]; | ||
const l$$15 = m$$14.fields[2]; | ||
const k$$16 = m$$14.fields[0]; | ||
const h$$3 = m$$14.fields[4] | 0; | ||
const l2$$1 = MapTreeModule$$$mapi(f$$11, l$$15); | ||
const v2$$17 = f$$11(k$$16, v$$12); | ||
const r2$$1 = MapTreeModule$$$mapi(f$$11, r$$15); | ||
return new MapTree$00602(2, "MapNode", k$$16, v2$$17, l2$$1, r2$$1, h$$3); | ||
const l2$$1 = MapTreeModule$$$mapi(f$$11, m$$14.fields[2]); | ||
const v2$$17 = f$$11(m$$14.fields[0], m$$14.fields[1]); | ||
const r2$$1 = MapTreeModule$$$mapi(f$$11, m$$14.fields[3]); | ||
return new MapTree$00602(2, "MapNode", m$$14.fields[0], v2$$17, l2$$1, r2$$1, m$$14.fields[4]); | ||
} | ||
@@ -782,7 +668,7 @@ | ||
} | ||
export function MapTreeModule$$$foldBack($arg$$57, $arg$$58, $arg$$59) { | ||
export function MapTreeModule$$$foldBack($f$$12$$74, $m$$15$$75, $x$$1$$76) { | ||
MapTreeModule$$$foldBack: while (true) { | ||
const f$$12 = $arg$$57, | ||
m$$15 = $arg$$58, | ||
x$$1 = $arg$$59; | ||
const f$$12 = $f$$12$$74, | ||
m$$15 = $m$$15$$75, | ||
x$$1 = $x$$1$$76; | ||
@@ -792,5 +678,3 @@ switch (m$$15.tag) { | ||
{ | ||
const v$$13 = m$$15.fields[1]; | ||
const k$$17 = m$$15.fields[0]; | ||
return f$$12(k$$17, v$$13, x$$1); | ||
return f$$12(m$$15.fields[0], m$$15.fields[1], x$$1); | ||
} | ||
@@ -800,11 +684,7 @@ | ||
{ | ||
const v$$14 = m$$15.fields[1]; | ||
const r$$16 = m$$15.fields[3]; | ||
const l$$16 = m$$15.fields[2]; | ||
const k$$18 = m$$15.fields[0]; | ||
const x$$2 = MapTreeModule$$$foldBack(f$$12, r$$16, x$$1); | ||
const x$$3 = f$$12(k$$18, v$$14, x$$2); | ||
$arg$$57 = f$$12; | ||
$arg$$58 = l$$16; | ||
$arg$$59 = x$$3; | ||
const x$$2 = MapTreeModule$$$foldBack(f$$12, m$$15.fields[3], x$$1); | ||
const x$$3 = f$$12(m$$15.fields[0], m$$15.fields[1], x$$2); | ||
$f$$12$$74 = f$$12; | ||
$m$$15$$75 = m$$15.fields[2]; | ||
$x$$1$$76 = x$$3; | ||
continue MapTreeModule$$$foldBack; | ||
@@ -822,7 +702,7 @@ } | ||
} | ||
export function MapTreeModule$$$fold($arg$$60, $arg$$61, $arg$$62) { | ||
export function MapTreeModule$$$fold($f$$13$$77, $x$$4$$78, $m$$16$$79) { | ||
MapTreeModule$$$fold: while (true) { | ||
const f$$13 = $arg$$60, | ||
x$$4 = $arg$$61, | ||
m$$16 = $arg$$62; | ||
const f$$13 = $f$$13$$77, | ||
x$$4 = $x$$4$$78, | ||
m$$16 = $m$$16$$79; | ||
@@ -832,5 +712,3 @@ switch (m$$16.tag) { | ||
{ | ||
const v$$15 = m$$16.fields[1]; | ||
const k$$19 = m$$16.fields[0]; | ||
return f$$13(x$$4, k$$19, v$$15); | ||
return f$$13(x$$4, m$$16.fields[0], m$$16.fields[1]); | ||
} | ||
@@ -840,11 +718,7 @@ | ||
{ | ||
const v$$16 = m$$16.fields[1]; | ||
const r$$17 = m$$16.fields[3]; | ||
const l$$17 = m$$16.fields[2]; | ||
const k$$20 = m$$16.fields[0]; | ||
const x$$5 = MapTreeModule$$$fold(f$$13, x$$4, l$$17); | ||
const x$$6 = f$$13(x$$5, k$$20, v$$16); | ||
$arg$$60 = f$$13; | ||
$arg$$61 = x$$6; | ||
$arg$$62 = r$$17; | ||
const x$$5 = MapTreeModule$$$fold(f$$13, x$$4, m$$16.fields[2]); | ||
const x$$6 = f$$13(x$$5, m$$16.fields[0], m$$16.fields[1]); | ||
$f$$13$$77 = f$$13; | ||
$x$$4$$78 = x$$6; | ||
$m$$16$$79 = m$$16.fields[3]; | ||
continue MapTreeModule$$$fold; | ||
@@ -866,7 +740,5 @@ } | ||
{ | ||
const v$$17 = m$$17.fields[1]; | ||
const k$$21 = m$$17.fields[0]; | ||
const cLoKey = comparer$$11.Compare(lo, k$$21) | 0; | ||
const cKeyHi = comparer$$11.Compare(k$$21, hi) | 0; | ||
const x$$8 = (cLoKey <= 0 ? cKeyHi <= 0 : false) ? f$$14(k$$21, v$$17, x$$7) : x$$7; | ||
const cLoKey = comparer$$11.Compare(lo, m$$17.fields[0]) | 0; | ||
const cKeyHi = comparer$$11.Compare(m$$17.fields[0], hi) | 0; | ||
const x$$8 = (cLoKey <= 0 ? cKeyHi <= 0 : false) ? f$$14(m$$17.fields[0], m$$17.fields[1], x$$7) : x$$7; | ||
return x$$8; | ||
@@ -877,11 +749,7 @@ } | ||
{ | ||
const v$$18 = m$$17.fields[1]; | ||
const r$$18 = m$$17.fields[3]; | ||
const l$$18 = m$$17.fields[2]; | ||
const k$$22 = m$$17.fields[0]; | ||
const cLoKey$$1 = comparer$$11.Compare(lo, k$$22) | 0; | ||
const cKeyHi$$1 = comparer$$11.Compare(k$$22, hi) | 0; | ||
const x$$9 = cLoKey$$1 < 0 ? MapTreeModule$$$foldFromTo(comparer$$11, lo, hi, f$$14, l$$18, x$$7) : x$$7; | ||
const x$$10 = (cLoKey$$1 <= 0 ? cKeyHi$$1 <= 0 : false) ? f$$14(k$$22, v$$18, x$$9) : x$$9; | ||
const x$$11 = cKeyHi$$1 < 0 ? MapTreeModule$$$foldFromTo(comparer$$11, lo, hi, f$$14, r$$18, x$$10) : x$$10; | ||
const cLoKey$$1 = comparer$$11.Compare(lo, m$$17.fields[0]) | 0; | ||
const cKeyHi$$1 = comparer$$11.Compare(m$$17.fields[0], hi) | 0; | ||
const x$$9 = cLoKey$$1 < 0 ? MapTreeModule$$$foldFromTo(comparer$$11, lo, hi, f$$14, m$$17.fields[2], x$$7) : x$$7; | ||
const x$$10 = (cLoKey$$1 <= 0 ? cKeyHi$$1 <= 0 : false) ? f$$14(m$$17.fields[0], m$$17.fields[1], x$$9) : x$$9; | ||
const x$$11 = cKeyHi$$1 < 0 ? MapTreeModule$$$foldFromTo(comparer$$11, lo, hi, f$$14, m$$17.fields[3], x$$10) : x$$10; | ||
return x$$11; | ||
@@ -903,10 +771,11 @@ } | ||
} | ||
export function MapTreeModule$$$loop(m$$19, acc$$8) { | ||
export function MapTreeModule$$$loop($m$$19$$92, $acc$$8$$93) { | ||
MapTreeModule$$$loop: while (true) { | ||
const m$$19 = $m$$19$$92, | ||
acc$$8 = $acc$$8$$93; | ||
switch (m$$19.tag) { | ||
case 1: | ||
{ | ||
const v$$19 = m$$19.fields[1]; | ||
const k$$23 = m$$19.fields[0]; | ||
return new List([k$$23, v$$19], acc$$8); | ||
return new List([m$$19.fields[0], m$$19.fields[1]], acc$$8); | ||
} | ||
@@ -916,9 +785,4 @@ | ||
{ | ||
const v$$20 = m$$19.fields[1]; | ||
const r$$19 = m$$19.fields[3]; | ||
const l$$19 = m$$19.fields[2]; | ||
const k$$24 = m$$19.fields[0]; | ||
const $acc$$8$$75 = acc$$8; | ||
m$$19 = l$$19; | ||
acc$$8 = new List([k$$24, v$$20], MapTreeModule$$$loop(r$$19, $acc$$8$$75)); | ||
$m$$19$$92 = m$$19.fields[2]; | ||
$acc$$8$$93 = new List([m$$19.fields[0], m$$19.fields[1]], MapTreeModule$$$loop(m$$19.fields[3], acc$$8)); | ||
continue MapTreeModule$$$loop; | ||
@@ -941,19 +805,16 @@ } | ||
return fold$$1(function (acc$$9, tupledArg) { | ||
const k$$25 = tupledArg[0]; | ||
const v$$21 = tupledArg[1]; | ||
return MapTreeModule$$$add(comparer$$13, k$$25, v$$21, acc$$9); | ||
return MapTreeModule$$$add(comparer$$13, tupledArg[0], tupledArg[1], acc$$9); | ||
}, MapTreeModule$$$empty(), l$$20); | ||
} | ||
export function MapTreeModule$$$mkFromEnumerator(comparer$$14, acc$$10, e) { | ||
export function MapTreeModule$$$mkFromEnumerator($comparer$$14$$97, $acc$$10$$98, $e$$99) { | ||
MapTreeModule$$$mkFromEnumerator: while (true) { | ||
const comparer$$14 = $comparer$$14$$97, | ||
acc$$10 = $acc$$10$$98, | ||
e = $e$$99; | ||
if (e.MoveNext()) { | ||
const patternInput$$2 = e.Current; | ||
const y = patternInput$$2[1]; | ||
const x$$13 = patternInput$$2[0]; | ||
const $acc$$10$$77 = acc$$10; | ||
const $comparer$$14$$76 = comparer$$14; | ||
const $e$$78 = e; | ||
comparer$$14 = $comparer$$14$$76; | ||
acc$$10 = MapTreeModule$$$add($comparer$$14$$76, x$$13, y, $acc$$10$$77); | ||
e = $e$$78; | ||
$comparer$$14$$97 = comparer$$14; | ||
$acc$$10$$98 = MapTreeModule$$$add(comparer$$14, patternInput$$2[0], patternInput$$2[1], acc$$10); | ||
$e$$99 = e; | ||
continue MapTreeModule$$$mkFromEnumerator; | ||
@@ -972,5 +833,3 @@ } else { | ||
const patternInput$$3 = arr[i]; | ||
const y$$1 = patternInput$$3[1]; | ||
const x$$14 = patternInput$$3[0]; | ||
res$$2 = MapTreeModule$$$add(comparer$$15, x$$14, y$$1, res$$2); | ||
res$$2 = MapTreeModule$$$add(comparer$$15, patternInput$$3[0], patternInput$$3[1], res$$2); | ||
} | ||
@@ -1002,7 +861,9 @@ | ||
}, Record); | ||
export function MapTreeModule$002EMapIterator$00602$reflection($gen$$79, $gen$$80) { | ||
return record("Map.MapTreeModule.MapIterator`2", [$gen$$79, $gen$$80], MapTreeModule$002EMapIterator$00602, () => [["stack", list(MapTree$00602$reflection($gen$$79, $gen$$80))], ["started", bool]]); | ||
export function MapTreeModule$002EMapIterator$00602$reflection($gen$$109, $gen$$110) { | ||
return record("Map.MapTreeModule.MapIterator`2", [$gen$$109, $gen$$110], MapTreeModule$002EMapIterator$00602, () => [["stack", list(MapTree$00602$reflection($gen$$109, $gen$$110))], ["started", bool]]); | ||
} | ||
export function MapTreeModule$$$collapseLHS(stack) { | ||
export function MapTreeModule$$$collapseLHS($stack$$111) { | ||
MapTreeModule$$$collapseLHS: while (true) { | ||
const stack = $stack$$111; | ||
if (stack.tail != null) { | ||
@@ -1012,12 +873,6 @@ if (stack.head.tag === 1) { | ||
} else if (stack.head.tag === 2) { | ||
const k$$26 = stack.head.fields[0]; | ||
const l$$21 = stack.head.fields[2]; | ||
const r$$20 = stack.head.fields[3]; | ||
const rest$$1 = stack.tail; | ||
const v$$22 = stack.head.fields[1]; | ||
stack = new List(l$$21, new List(new MapTree$00602(1, "MapOne", k$$26, v$$22), new List(r$$20, rest$$1))); | ||
$stack$$111 = new List(stack.head.fields[2], new List(new MapTree$00602(1, "MapOne", stack.head.fields[0], stack.head.fields[1]), new List(stack.head.fields[3], stack.tail))); | ||
continue MapTreeModule$$$collapseLHS; | ||
} else { | ||
const rest = stack.tail; | ||
stack = rest; | ||
$stack$$111 = stack.tail; | ||
continue MapTreeModule$$$collapseLHS; | ||
@@ -1048,5 +903,3 @@ } | ||
} else if (matchValue$$4.head.tag === 1) { | ||
const k$$27 = matchValue$$4.head.fields[0]; | ||
const v$$23 = matchValue$$4.head.fields[1]; | ||
return [k$$27, v$$23]; | ||
return [matchValue$$4.head.fields[0], matchValue$$4.head.fields[1]]; | ||
} else { | ||
@@ -1066,4 +919,3 @@ throw new Error("Please report error: Map iterator, unexpected stack for current"); | ||
} else if (matchValue$$5.head.tag === 1) { | ||
const rest$$2 = matchValue$$5.tail; | ||
i$$3.stack = MapTreeModule$$$collapseLHS(rest$$2); | ||
i$$3.stack = MapTreeModule$$$collapseLHS(matchValue$$5.tail); | ||
return !(i$$3.stack.tail == null); | ||
@@ -1083,4 +935,4 @@ } else { | ||
}); | ||
export function MapTreeModule$002EmkIEnumerator$0027$00602$reflection($gen$$81, $gen$$82) { | ||
return type("Map.MapTreeModule.mkIEnumerator'`2", [$gen$$81, $gen$$82]); | ||
export function MapTreeModule$002EmkIEnumerator$0027$00602$reflection($gen$$115, $gen$$116) { | ||
return type("Map.MapTreeModule.mkIEnumerator'`2", [$gen$$115, $gen$$116]); | ||
} | ||
@@ -1127,4 +979,4 @@ export function MapTreeModule$002EmkIEnumerator$0027$00602$$$$002Ector$$Z26BC498C(s$$6) { | ||
}); | ||
export function FSharpMap$reflection($gen$$83, $gen$$84) { | ||
return type("Map.FSharpMap", [$gen$$83, $gen$$84]); | ||
export function FSharpMap$reflection($gen$$120, $gen$$121) { | ||
return type("Map.FSharpMap", [$gen$$120, $gen$$121]); | ||
} | ||
@@ -1155,3 +1007,3 @@ export function FSharpMap$$$$002Ector$$58ADD115(comparer$$17, tree) { | ||
} else { | ||
const v$$25 = value$$4(matchValue$$6); | ||
const v$$25 = value$$3(matchValue$$6); | ||
return [true, v$$25]; | ||
@@ -1189,5 +1041,3 @@ } | ||
const patternInput$$4 = MapTreeModule$$$partition(__$$19.comparer, f$$26, __$$19.tree); | ||
const r2$$2 = patternInput$$4[1]; | ||
const r1 = patternInput$$4[0]; | ||
return [FSharpMap$$$$002Ector$$58ADD115(__$$19.comparer, r1), FSharpMap$$$$002Ector$$58ADD115(__$$19.comparer, r2$$2)]; | ||
return [FSharpMap$$$$002Ector$$58ADD115(__$$19.comparer, patternInput$$4[0]), FSharpMap$$$$002Ector$$58ADD115(__$$19.comparer, patternInput$$4[1])]; | ||
} | ||
@@ -1211,6 +1061,9 @@ export function FSharpMap$$get_Count(__$$20) { | ||
FSharpMap.prototype.toString = function () { | ||
var strings; | ||
const this$ = this; | ||
return "map [" + join("; ", ...map$$2(function mapping(kv) { | ||
return toText(printf("(%A, %A)"))(kv[0])(kv[1]); | ||
}, this$)) + "]"; | ||
return "map [" + (strings = (map$$2(function mapping(kv) { | ||
const clo1 = toText(printf("(%A, %A)")); | ||
const clo2 = clo1(kv[0]); | ||
return clo2(kv[1]); | ||
}, this$)), (join("; ", ...strings))) + "]"; | ||
}; | ||
@@ -1229,7 +1082,6 @@ | ||
while (e$$1.MoveNext()) { | ||
const activePatternResult3536 = e$$1.Current; | ||
const y$$4 = activePatternResult3536[1]; | ||
const x$$17 = activePatternResult3536[0]; | ||
res$$3 = combineHash(res$$3, structuralHash(x$$17)); | ||
res$$3 = combineHash(res$$3, structuralHash(y$$4)); | ||
const patternInput$$5 = e$$1.Current; | ||
const activePatternResult3676 = patternInput$$5; | ||
res$$3 = combineHash(res$$3, structuralHash(activePatternResult3676[0])); | ||
res$$3 = combineHash(res$$3, structuralHash(activePatternResult3676[1])); | ||
} | ||
@@ -1252,3 +1104,2 @@ | ||
const m$$22 = this; | ||
const m2 = obj; | ||
let res$$4 = 0; | ||
@@ -1259,3 +1110,3 @@ let finished = false; | ||
try { | ||
const e2 = MapTreeModule$$$mkIEnumerator(FSharpMap$$get_Tree(m2)); | ||
const e2 = MapTreeModule$$$mkIEnumerator(FSharpMap$$get_Tree(obj)); | ||
@@ -1327,5 +1178,6 @@ try { | ||
const this$$$7 = this; | ||
const source$$1 = MapTreeModule$$$toSeq(FSharpMap$$get_Tree(this$$$7)); | ||
return map$$2(function mapping$$1(kv$$1) { | ||
return kv$$1[0]; | ||
}, MapTreeModule$$$toSeq(FSharpMap$$get_Tree(this$$$7))); | ||
}, source$$1); | ||
}; | ||
@@ -1339,5 +1191,6 @@ | ||
const this$$$8 = this; | ||
const source$$2 = MapTreeModule$$$toSeq(FSharpMap$$get_Tree(this$$$8)); | ||
return map$$2(function mapping$$2(kv$$2) { | ||
return kv$$2[1]; | ||
}, MapTreeModule$$$toSeq(FSharpMap$$get_Tree(this$$$8))); | ||
}, source$$2); | ||
}; | ||
@@ -1373,3 +1226,3 @@ | ||
if (matchValue$$8 != null) { | ||
const res$$5 = value$$4(matchValue$$8); | ||
const res$$5 = value$$3(matchValue$$8); | ||
return res$$5; | ||
@@ -1408,3 +1261,6 @@ } else { | ||
export function findKey(f$$38, m$$41) { | ||
const _arg1$$2 = MapTreeModule$$$tryPick(function f$$39(k$$42, v$$28) { | ||
let _arg1$$2; | ||
const m$$42 = FSharpMap$$get_Tree(m$$41); | ||
_arg1$$2 = MapTreeModule$$$tryPick(function f$$39(k$$42, v$$28) { | ||
if (f$$38(k$$42, v$$28)) { | ||
@@ -1415,3 +1271,3 @@ return some(k$$42); | ||
} | ||
}, FSharpMap$$get_Tree(m$$41)); | ||
}, m$$42); | ||
@@ -1421,3 +1277,3 @@ if (_arg1$$2 == null) { | ||
} else { | ||
const k$$43 = value$$4(_arg1$$2); | ||
const k$$43 = value$$3(_arg1$$2); | ||
return k$$43; | ||
@@ -1427,2 +1283,3 @@ } | ||
export function tryFindKey(f$$40, m$$43) { | ||
const m$$44 = FSharpMap$$get_Tree(m$$43); | ||
return MapTreeModule$$$tryPick(function f$$41(k$$44, v$$29) { | ||
@@ -1434,3 +1291,3 @@ if (f$$40(k$$44, v$$29)) { | ||
} | ||
}, FSharpMap$$get_Tree(m$$43)); | ||
}, m$$44); | ||
} | ||
@@ -1450,3 +1307,5 @@ export function ofList(l$$22, comparer$$18) { | ||
export function toArray(m$$46) { | ||
const res$$6 = new Array(FSharpMap$$get_Count(m$$46)); | ||
let res$$6; | ||
const len = FSharpMap$$get_Count(m$$46) | 0; | ||
res$$6 = new Array(len); | ||
MapTreeModule$$$copyToArray(FSharpMap$$get_Tree(m$$46), res$$6, 0); | ||
@@ -1492,5 +1351,6 @@ return res$$6; | ||
keys() { | ||
const source$$3 = MapTreeModule$$$toSeq(tree$$1); | ||
return map$$2(function mapping$$3(kv$$3) { | ||
return kv$$3[0]; | ||
}, MapTreeModule$$$toSeq(tree$$1)); | ||
}, source$$3); | ||
}, | ||
@@ -1505,5 +1365,6 @@ | ||
values() { | ||
const source$$4 = MapTreeModule$$$toSeq(tree$$1); | ||
return map$$2(function mapping$$4(kv$$4) { | ||
return kv$$4[1]; | ||
}, MapTreeModule$$$toSeq(tree$$1)); | ||
}, source$$4); | ||
}, | ||
@@ -1523,8 +1384,3 @@ | ||
export function createMutable(source$$5, comparer$$23) { | ||
const map$$1 = MutableMap$002400602$0024$0024$0024$0024002Ector$0024$0024Z79760D57(comparer$$23); | ||
iterate$$1(function (forLoopVar) { | ||
const value = forLoopVar[1]; | ||
const key = forLoopVar[0]; | ||
MutableMap$002400602$0024$0024Add$0024$00245BDDA1(map$$1, key, value); | ||
}, source$$5); | ||
const map$$1 = MutableMap$002400602$0024$0024$0024$0024002Ector$0024$00246623D9B3(source$$5, comparer$$23); | ||
return map$$1; | ||
@@ -1535,8 +1391,9 @@ } | ||
iterate$$1(function (v$$31) { | ||
const key$$1 = projection(v$$31); | ||
const key = projection(v$$31); | ||
if (dict.has(key$$1)) { | ||
dict.get(key$$1).push(v$$31); | ||
if (dict.has(key)) { | ||
dict.get(key).push(v$$31); | ||
} else { | ||
dict.set(key$$1, [v$$31]), null; | ||
const value = dict.set(key, [v$$31]); | ||
value, null; | ||
} | ||
@@ -1550,5 +1407,6 @@ }, xs); | ||
const dict$$1 = createMutable(empty$$1(), comparer$$25); | ||
iterate$$1(function (value$$2) { | ||
const key$$2 = projection$$1(value$$2); | ||
dict$$1.has(key$$2) ? dict$$1.set(key$$2, dict$$1.get(key$$2) + 1) : dict$$1.set(key$$2, 1), null; | ||
iterate$$1(function (value$$1) { | ||
const key$$1 = projection$$1(value$$1); | ||
const value$$2 = dict$$1.has(key$$1) ? dict$$1.set(key$$1, dict$$1.get(key$$1) + 1) : dict$$1.set(key$$1, 1); | ||
value$$2, null; | ||
}, xs$$1); | ||
@@ -1555,0 +1413,0 @@ return map$$2(function mapping$$6(kv$$6) { |
@@ -1,11 +0,16 @@ | ||
import { declare } from "./Types.js"; | ||
import { declare, FSharpRef } from "./Types.js"; | ||
import { iterateIndexed, toIterator, getEnumerator, delay, collect, map, sumBy, iterate } from "./Seq.js"; | ||
import { type } from "./Reflection.js"; | ||
import { EqualityComparer$00601$$$get_Default as EqualityComparer$002400601$0024$0024$0024get_Default } from "./System.Collections.Generic.js"; | ||
import { equals, getItemFromDict, tryGetValue } from "./Util.js"; | ||
import { iterateIndexed, toIterator, getEnumerator, delay, collect, map, sumBy } from "./Seq.js"; | ||
import { toText, printf } from "./String.js"; | ||
export const MutableMap$00602 = declare(function Fable_Collections_MutableMap(comparer) { | ||
export const MutableMap$00602 = declare(function Fable_Collections_MutableMap(pairs, comparer) { | ||
const $this$$1 = this; | ||
const this$ = new FSharpRef(null); | ||
$this$$1.comparer = comparer; | ||
this$.contents = $this$$1; | ||
$this$$1["entries@23"] = new Map([]); | ||
$this$$1["init@20-1"] = 1; | ||
iterate(function (pair) { | ||
MutableMap$00602$$Add$$5BDDA1(this$.contents, pair[0], pair[1]); | ||
}, pairs); | ||
}); | ||
@@ -15,17 +20,13 @@ export function MutableMap$00602$reflection($gen$$4, $gen$$5) { | ||
} | ||
export function MutableMap$00602$$$$002Ector$$Z79760D57(comparer) { | ||
return this instanceof MutableMap$00602 ? MutableMap$00602.call(this, comparer) : new MutableMap$00602(comparer); | ||
export function MutableMap$00602$$$$002Ector$$6623D9B3(pairs, comparer) { | ||
return this instanceof MutableMap$00602 ? MutableMap$00602.call(this, pairs, comparer) : new MutableMap$00602(pairs, comparer); | ||
} | ||
export function MutableMap$00602$$$$002Ector() { | ||
return MutableMap$00602$$$$002Ector$$Z79760D57.call(this, EqualityComparer$002400601$0024$0024$0024get_Default()); | ||
} | ||
function MutableMap$00602$$TryFindIndex$$2B595(this$, k) { | ||
const h = this$.comparer.GetHashCode(k) | 0; | ||
const matchValue = tryGetValue(this$["entries@23"], h, null); | ||
function MutableMap$00602$$TryFindIndex$$2B595(this$$$1, k) { | ||
const h = this$$$1.comparer.GetHashCode(k) | 0; | ||
const matchValue = tryGetValue(this$$$1["entries@23"], h, null); | ||
if (matchValue[0]) { | ||
const pairs = matchValue[1]; | ||
return [true, h, pairs.findIndex(function (pair) { | ||
return this$.comparer.Equals(k, pair[0]); | ||
return [true, h, matchValue[1].findIndex(function (pair$$1) { | ||
return this$$$1.comparer.Equals(k, pair$$1[0]); | ||
})]; | ||
@@ -37,23 +38,20 @@ } else { | ||
export function MutableMap$00602$$TryFind$$2B595(this$$$1, k$$1) { | ||
var i, h$$1; | ||
const matchValue$$1 = MutableMap$00602$$TryFindIndex$$2B595(this$$$1, k$$1); | ||
var $target$$6; | ||
export function MutableMap$00602$$TryFind$$2B595(this$$$2, k$$1) { | ||
const matchValue$$1 = MutableMap$00602$$TryFindIndex$$2B595(this$$$2, k$$1); | ||
var $target$$10; | ||
if (matchValue$$1[0]) { | ||
if (i = matchValue$$1[2] | 0, (h$$1 = matchValue$$1[1] | 0, i > -1)) { | ||
$target$$6 = 0; | ||
if (matchValue$$1[2] > -1) { | ||
$target$$10 = 0; | ||
} else { | ||
$target$$6 = 1; | ||
$target$$10 = 1; | ||
} | ||
} else { | ||
$target$$6 = 1; | ||
$target$$10 = 1; | ||
} | ||
switch ($target$$6) { | ||
switch ($target$$10) { | ||
case 0: | ||
{ | ||
const i$$1 = matchValue$$1[2] | 0; | ||
const h$$2 = matchValue$$1[1] | 0; | ||
return getItemFromDict(this$$$1["entries@23"], h$$2)[i$$1]; | ||
return getItemFromDict(this$$$2["entries@23"], matchValue$$1[1])[matchValue$$1[2]]; | ||
} | ||
@@ -67,12 +65,13 @@ | ||
} | ||
export function MutableMap$00602$$get_Comparer(this$$$2) { | ||
return this$$$2.comparer; | ||
export function MutableMap$00602$$get_Comparer(this$$$3) { | ||
return this$$$3.comparer; | ||
} | ||
export function MutableMap$00602$$Clear(this$$$3) { | ||
this$$$3["entries@23"].clear(); | ||
export function MutableMap$00602$$Clear(this$$$4) { | ||
this$$$4["entries@23"].clear(); | ||
} | ||
export function MutableMap$00602$$get_Count(this$$$4) { | ||
return sumBy(function projection(pairs$$1) { | ||
return pairs$$1.length; | ||
}, this$$$4["entries@23"].values(), { | ||
export function MutableMap$00602$$get_Count(this$$$5) { | ||
const source = this$$$5["entries@23"].values(); | ||
return sumBy(function projection(pairs$$2) { | ||
return pairs$$2.length; | ||
}, source, { | ||
GetZero() { | ||
@@ -86,10 +85,10 @@ return 0; | ||
}); | ||
}) | 0; | ||
} | ||
export function MutableMap$00602$$get_Item$$2B595(this$$$5, k$$2) { | ||
const matchValue$$2 = MutableMap$00602$$TryFind$$2B595(this$$$5, k$$2); | ||
export function MutableMap$00602$$get_Item$$2B595(this$$$6, k$$2) { | ||
const matchValue$$2 = MutableMap$00602$$TryFind$$2B595(this$$$6, k$$2); | ||
if (matchValue$$2 != null) { | ||
const pair$$1 = matchValue$$2; | ||
return pair$$1[1]; | ||
const pair$$2 = matchValue$$2; | ||
return pair$$2[1]; | ||
} else { | ||
@@ -99,23 +98,20 @@ throw new Error("The item was not found in collection"); | ||
} | ||
export function MutableMap$00602$$set_Item$$5BDDA1(this$$$6, k$$3, v) { | ||
var i$$2, h$$3; | ||
const matchValue$$3 = MutableMap$00602$$TryFindIndex$$2B595(this$$$6, k$$3); | ||
var $target$$7; | ||
export function MutableMap$00602$$set_Item$$5BDDA1(this$$$7, k$$3, v) { | ||
const matchValue$$3 = MutableMap$00602$$TryFindIndex$$2B595(this$$$7, k$$3); | ||
var $target$$20; | ||
if (matchValue$$3[0]) { | ||
if (i$$2 = matchValue$$3[2] | 0, (h$$3 = matchValue$$3[1] | 0, i$$2 > -1)) { | ||
$target$$7 = 0; | ||
if (matchValue$$3[2] > -1) { | ||
$target$$20 = 0; | ||
} else { | ||
$target$$7 = 1; | ||
$target$$20 = 1; | ||
} | ||
} else { | ||
$target$$7 = 1; | ||
$target$$20 = 1; | ||
} | ||
switch ($target$$7) { | ||
switch ($target$$20) { | ||
case 0: | ||
{ | ||
const i$$3 = matchValue$$3[2] | 0; | ||
const h$$4 = matchValue$$3[1] | 0; | ||
getItemFromDict(this$$$6["entries@23"], h$$4)[i$$3] = [k$$3, v]; | ||
getItemFromDict(this$$$7["entries@23"], matchValue$$3[1])[matchValue$$3[2]] = [k$$3, v]; | ||
break; | ||
@@ -127,8 +123,6 @@ } | ||
if (matchValue$$3[0]) { | ||
const h$$5 = matchValue$$3[1] | 0; | ||
const value = getItemFromDict(this$$$6["entries@23"], h$$5).push([k$$3, v]); | ||
const value = getItemFromDict(this$$$7["entries@23"], matchValue$$3[1]).push([k$$3, v]); | ||
null, null; | ||
} else { | ||
const h$$6 = matchValue$$3[1] | 0; | ||
this$$$6["entries@23"].set(h$$6, [[k$$3, v]]); | ||
this$$$7["entries@23"].set(matchValue$$3[1], [[k$$3, v]]); | ||
} | ||
@@ -140,23 +134,22 @@ | ||
} | ||
export function MutableMap$00602$$Add$$5BDDA1(this$$$7, k$$4, v$$1) { | ||
var i$$4, h$$7; | ||
const matchValue$$4 = MutableMap$00602$$TryFindIndex$$2B595(this$$$7, k$$4); | ||
var $target$$8; | ||
export function MutableMap$00602$$Add$$5BDDA1(this$$$8, k$$4, v$$1) { | ||
const matchValue$$4 = MutableMap$00602$$TryFindIndex$$2B595(this$$$8, k$$4); | ||
var $target$$24; | ||
if (matchValue$$4[0]) { | ||
if (i$$4 = matchValue$$4[2] | 0, (h$$7 = matchValue$$4[1] | 0, i$$4 > -1)) { | ||
$target$$8 = 0; | ||
if (matchValue$$4[2] > -1) { | ||
$target$$24 = 0; | ||
} else { | ||
$target$$8 = 1; | ||
$target$$24 = 1; | ||
} | ||
} else { | ||
$target$$8 = 1; | ||
$target$$24 = 1; | ||
} | ||
switch ($target$$8) { | ||
switch ($target$$24) { | ||
case 0: | ||
{ | ||
const i$$5 = matchValue$$4[2] | 0; | ||
const h$$8 = matchValue$$4[1] | 0; | ||
const msg = toText(printf("An item with the same key has already been added. Key: %A"))(k$$4); | ||
let msg; | ||
const clo1 = toText(printf("An item with the same key has already been added. Key: %A")); | ||
msg = clo1(k$$4); | ||
throw new Error(msg); | ||
@@ -169,8 +162,6 @@ break; | ||
if (matchValue$$4[0]) { | ||
const h$$9 = matchValue$$4[1] | 0; | ||
const value$$1 = getItemFromDict(this$$$7["entries@23"], h$$9).push([k$$4, v$$1]); | ||
const value$$1 = getItemFromDict(this$$$8["entries@23"], matchValue$$4[1]).push([k$$4, v$$1]); | ||
null, null; | ||
} else { | ||
const h$$10 = matchValue$$4[1] | 0; | ||
this$$$7["entries@23"].set(h$$10, [[k$$4, v$$1]]); | ||
this$$$8["entries@23"].set(matchValue$$4[1], [[k$$4, v$$1]]); | ||
} | ||
@@ -182,22 +173,19 @@ | ||
} | ||
export function MutableMap$00602$$ContainsKey$$2B595(this$$$8, k$$5) { | ||
var i$$6, h$$11; | ||
const matchValue$$5 = MutableMap$00602$$TryFindIndex$$2B595(this$$$8, k$$5); | ||
var $target$$9; | ||
export function MutableMap$00602$$ContainsKey$$2B595(this$$$9, k$$5) { | ||
const matchValue$$5 = MutableMap$00602$$TryFindIndex$$2B595(this$$$9, k$$5); | ||
var $target$$27; | ||
if (matchValue$$5[0]) { | ||
if (i$$6 = matchValue$$5[2] | 0, (h$$11 = matchValue$$5[1] | 0, i$$6 > -1)) { | ||
$target$$9 = 0; | ||
if (matchValue$$5[2] > -1) { | ||
$target$$27 = 0; | ||
} else { | ||
$target$$9 = 1; | ||
$target$$27 = 1; | ||
} | ||
} else { | ||
$target$$9 = 1; | ||
$target$$27 = 1; | ||
} | ||
switch ($target$$9) { | ||
switch ($target$$27) { | ||
case 0: | ||
{ | ||
const i$$7 = matchValue$$5[2] | 0; | ||
const h$$12 = matchValue$$5[1] | 0; | ||
return true; | ||
@@ -212,23 +200,20 @@ } | ||
} | ||
export function MutableMap$00602$$Remove$$2B595(this$$$9, k$$6) { | ||
var i$$8, h$$13; | ||
const matchValue$$6 = MutableMap$00602$$TryFindIndex$$2B595(this$$$9, k$$6); | ||
var $target$$10; | ||
export function MutableMap$00602$$Remove$$2B595(this$$$10, k$$6) { | ||
const matchValue$$6 = MutableMap$00602$$TryFindIndex$$2B595(this$$$10, k$$6); | ||
var $target$$30; | ||
if (matchValue$$6[0]) { | ||
if (i$$8 = matchValue$$6[2] | 0, (h$$13 = matchValue$$6[1] | 0, i$$8 > -1)) { | ||
$target$$10 = 0; | ||
if (matchValue$$6[2] > -1) { | ||
$target$$30 = 0; | ||
} else { | ||
$target$$10 = 1; | ||
$target$$30 = 1; | ||
} | ||
} else { | ||
$target$$10 = 1; | ||
$target$$30 = 1; | ||
} | ||
switch ($target$$10) { | ||
switch ($target$$30) { | ||
case 0: | ||
{ | ||
const i$$9 = matchValue$$6[2] | 0; | ||
const h$$14 = matchValue$$6[1] | 0; | ||
getItemFromDict(this$$$9["entries@23"], h$$14).splice(i$$9, 1); | ||
getItemFromDict(this$$$10["entries@23"], matchValue$$6[1]).splice(matchValue$$6[2], 1); | ||
return true; | ||
@@ -246,9 +231,9 @@ } | ||
var elems; | ||
const this$$$10 = this; | ||
const this$$$11 = this; | ||
return toIterator((elems = delay(function () { | ||
return collect(function (pairs$$2) { | ||
return map(function (pair$$2) { | ||
return pair$$2; | ||
}, pairs$$2); | ||
}, this$$$10["entries@23"].values()); | ||
return collect(function (pairs$$3) { | ||
return map(function (pair$$3) { | ||
return pair$$3; | ||
}, pairs$$3); | ||
}, this$$$11["entries@23"].values()); | ||
}), getEnumerator(elems))); | ||
@@ -258,9 +243,9 @@ }; | ||
MutableMap$00602.prototype.Add = function (item) { | ||
const this$$$11 = this; | ||
MutableMap$00602$$Add$$5BDDA1(this$$$11, item[0], item[1]); | ||
const this$$$12 = this; | ||
MutableMap$00602$$Add$$5BDDA1(this$$$12, item[0], item[1]); | ||
}; | ||
MutableMap$00602.prototype.Clear = function () { | ||
const this$$$12 = this; | ||
MutableMap$00602$$Clear(this$$$12); | ||
const this$$$13 = this; | ||
MutableMap$00602$$Clear(this$$$13); | ||
}; | ||
@@ -270,17 +255,17 @@ | ||
var p; | ||
const this$$$13 = this; | ||
const matchValue$$7 = MutableMap$00602$$TryFind$$2B595(this$$$13, item$$1[0]); | ||
var $target$$11; | ||
const this$$$14 = this; | ||
const matchValue$$7 = MutableMap$00602$$TryFind$$2B595(this$$$14, item$$1[0]); | ||
var $target$$31; | ||
if (matchValue$$7 != null) { | ||
if (p = matchValue$$7, equals(p[1], item$$1[1])) { | ||
$target$$11 = 0; | ||
$target$$31 = 0; | ||
} else { | ||
$target$$11 = 1; | ||
$target$$31 = 1; | ||
} | ||
} else { | ||
$target$$11 = 1; | ||
$target$$31 = 1; | ||
} | ||
switch ($target$$11) { | ||
switch ($target$$31) { | ||
case 0: | ||
@@ -299,6 +284,6 @@ { | ||
MutableMap$00602.prototype.CopyTo = function (array, arrayIndex) { | ||
const this$$$14 = this; | ||
const this$$$15 = this; | ||
iterateIndexed(function action(i$$10, e) { | ||
array[arrayIndex + i$$10] = e; | ||
}, this$$$14); | ||
}, this$$$15); | ||
}; | ||
@@ -308,4 +293,4 @@ | ||
"get": function () { | ||
const this$$$15 = this; | ||
return MutableMap$00602$$get_Count(this$$$15) | 0; | ||
const this$$$16 = this; | ||
return MutableMap$00602$$get_Count(this$$$16) | 0; | ||
} | ||
@@ -320,10 +305,11 @@ }); | ||
MutableMap$00602.prototype.Remove = function (item$$2) { | ||
const this$$$17 = this; | ||
const matchValue$$8 = MutableMap$00602$$TryFind$$2B595(this$$$17, item$$2[0]); | ||
const this$$$18 = this; | ||
const matchValue$$8 = MutableMap$00602$$TryFind$$2B595(this$$$18, item$$2[0]); | ||
if (matchValue$$8 != null) { | ||
const pair$$3 = matchValue$$8; | ||
const pair$$4 = matchValue$$8; | ||
if (equals(pair$$3[1], item$$2[1])) { | ||
MutableMap$00602$$Remove$$2B595(this$$$17, item$$2[0]), null; | ||
if (equals(pair$$4[1], item$$2[1])) { | ||
const value$$2 = MutableMap$00602$$Remove$$2B595(this$$$18, item$$2[0]); | ||
value$$2, null; | ||
} | ||
@@ -339,4 +325,4 @@ | ||
"get": function () { | ||
const this$$$18 = this; | ||
return MutableMap$00602$$get_Count(this$$$18) | 0; | ||
const this$$$19 = this; | ||
return MutableMap$00602$$get_Count(this$$$19) | 0; | ||
} | ||
@@ -346,46 +332,46 @@ }); | ||
MutableMap$00602.prototype.clear = function () { | ||
const this$$$19 = this; | ||
MutableMap$00602$$Clear(this$$$19); | ||
const this$$$20 = this; | ||
MutableMap$00602$$Clear(this$$$20); | ||
}; | ||
MutableMap$00602.prototype.delete = function (k$$7) { | ||
const this$$$20 = this; | ||
return MutableMap$00602$$Remove$$2B595(this$$$20, k$$7); | ||
const this$$$21 = this; | ||
return MutableMap$00602$$Remove$$2B595(this$$$21, k$$7); | ||
}; | ||
MutableMap$00602.prototype.entries = function () { | ||
const this$$$21 = this; | ||
const this$$$22 = this; | ||
return map(function mapping(x) { | ||
return x; | ||
}, this$$$21); | ||
}, this$$$22); | ||
}; | ||
MutableMap$00602.prototype.get = function (k$$8) { | ||
const this$$$22 = this; | ||
return MutableMap$00602$$get_Item$$2B595(this$$$22, k$$8); | ||
const this$$$23 = this; | ||
return MutableMap$00602$$get_Item$$2B595(this$$$23, k$$8); | ||
}; | ||
MutableMap$00602.prototype.has = function (k$$9) { | ||
const this$$$23 = this; | ||
return MutableMap$00602$$ContainsKey$$2B595(this$$$23, k$$9); | ||
const this$$$24 = this; | ||
return MutableMap$00602$$ContainsKey$$2B595(this$$$24, k$$9); | ||
}; | ||
MutableMap$00602.prototype.keys = function () { | ||
const this$$$24 = this; | ||
return map(function mapping$$1(pair$$4) { | ||
return pair$$4[0]; | ||
}, this$$$24); | ||
const this$$$25 = this; | ||
return map(function mapping$$1(pair$$5) { | ||
return pair$$5[0]; | ||
}, this$$$25); | ||
}; | ||
MutableMap$00602.prototype.set = function (k$$10, v$$2) { | ||
const this$$$25 = this; | ||
MutableMap$00602$$set_Item$$5BDDA1(this$$$25, k$$10, v$$2); | ||
return this$$$25; | ||
const this$$$26 = this; | ||
MutableMap$00602$$set_Item$$5BDDA1(this$$$26, k$$10, v$$2); | ||
return this$$$26; | ||
}; | ||
MutableMap$00602.prototype.values = function () { | ||
const this$$$26 = this; | ||
return map(function mapping$$2(pair$$5) { | ||
return pair$$5[1]; | ||
}, this$$$26); | ||
const this$$$27 = this; | ||
return map(function mapping$$2(pair$$6) { | ||
return pair$$6[1]; | ||
}, this$$$27); | ||
}; |
@@ -1,11 +0,17 @@ | ||
import { declare } from "./Types.js"; | ||
import { declare, FSharpRef } from "./Types.js"; | ||
import { iterateIndexed, toIterator, getEnumerator, delay, collect, map, sumBy, iterate } from "./Seq.js"; | ||
import { type } from "./Reflection.js"; | ||
import { EqualityComparer$00601$$$get_Default as EqualityComparer$002400601$0024$0024$0024get_Default } from "./System.Collections.Generic.js"; | ||
import { getItemFromDict, tryGetValue } from "./Util.js"; | ||
import { some } from "./Option.js"; | ||
import { iterateIndexed, toIterator, getEnumerator, delay, collect, map, sumBy } from "./Seq.js"; | ||
export const MutableSet$00601 = declare(function Fable_Collections_MutableSet(comparer) { | ||
export const MutableSet$00601 = declare(function Fable_Collections_MutableSet(items, comparer) { | ||
const $this$$1 = this; | ||
const this$ = new FSharpRef(null); | ||
$this$$1.comparer = comparer; | ||
$this$$1.entries = new Map([]); | ||
this$.contents = $this$$1; | ||
$this$$1["entries@24"] = new Map([]); | ||
$this$$1["init@21-2"] = 1; | ||
iterate(function (item) { | ||
const value = MutableSet$00601$$Add$$2B595(this$.contents, item); | ||
value, null; | ||
}, items); | ||
}); | ||
@@ -15,17 +21,13 @@ export function MutableSet$00601$reflection($gen$$4) { | ||
} | ||
export function MutableSet$00601$$$$002Ector$$Z79760D57(comparer) { | ||
return this instanceof MutableSet$00601 ? MutableSet$00601.call(this, comparer) : new MutableSet$00601(comparer); | ||
export function MutableSet$00601$$$$002Ector$$Z6150332D(items, comparer) { | ||
return this instanceof MutableSet$00601 ? MutableSet$00601.call(this, items, comparer) : new MutableSet$00601(items, comparer); | ||
} | ||
export function MutableSet$00601$$$$002Ector() { | ||
return MutableSet$00601$$$$002Ector$$Z79760D57.call(this, EqualityComparer$002400601$0024$0024$0024get_Default()); | ||
} | ||
function MutableSet$00601$$TryFindIndex$$2B595(this$, k) { | ||
const h = this$.comparer.GetHashCode(k) | 0; | ||
const matchValue = tryGetValue(this$.entries, h, null); | ||
function MutableSet$00601$$TryFindIndex$$2B595(this$$$1, k) { | ||
const h = this$$$1.comparer.GetHashCode(k) | 0; | ||
const matchValue = tryGetValue(this$$$1["entries@24"], h, null); | ||
if (matchValue[0]) { | ||
const values = matchValue[1]; | ||
return [true, h, values.findIndex(function (v) { | ||
return this$.comparer.Equals(k, v); | ||
return [true, h, matchValue[1].findIndex(function (v) { | ||
return this$$$1.comparer.Equals(k, v); | ||
})]; | ||
@@ -37,23 +39,20 @@ } else { | ||
function MutableSet$00601$$TryFind$$2B595(this$$$1, k$$1) { | ||
var i, h$$1; | ||
const matchValue$$1 = MutableSet$00601$$TryFindIndex$$2B595(this$$$1, k$$1); | ||
var $target$$5; | ||
function MutableSet$00601$$TryFind$$2B595(this$$$2, k$$1) { | ||
const matchValue$$1 = MutableSet$00601$$TryFindIndex$$2B595(this$$$2, k$$1); | ||
var $target$$9; | ||
if (matchValue$$1[0]) { | ||
if (i = matchValue$$1[2] | 0, (h$$1 = matchValue$$1[1] | 0, i > -1)) { | ||
$target$$5 = 0; | ||
if (matchValue$$1[2] > -1) { | ||
$target$$9 = 0; | ||
} else { | ||
$target$$5 = 1; | ||
$target$$9 = 1; | ||
} | ||
} else { | ||
$target$$5 = 1; | ||
$target$$9 = 1; | ||
} | ||
switch ($target$$5) { | ||
switch ($target$$9) { | ||
case 0: | ||
{ | ||
const i$$1 = matchValue$$1[2] | 0; | ||
const h$$2 = matchValue$$1[1] | 0; | ||
return some(getItemFromDict(this$$$1.entries, h$$2)[i$$1]); | ||
return some(getItemFromDict(this$$$2["entries@24"], matchValue$$1[1])[matchValue$$1[2]]); | ||
} | ||
@@ -68,12 +67,13 @@ | ||
export function MutableSet$00601$$get_Comparer(this$$$2) { | ||
return this$$$2.comparer; | ||
export function MutableSet$00601$$get_Comparer(this$$$3) { | ||
return this$$$3.comparer; | ||
} | ||
export function MutableSet$00601$$Clear(this$$$3) { | ||
this$$$3.entries.clear(); | ||
export function MutableSet$00601$$Clear(this$$$4) { | ||
this$$$4["entries@24"].clear(); | ||
} | ||
export function MutableSet$00601$$get_Count(this$$$4) { | ||
export function MutableSet$00601$$get_Count(this$$$5) { | ||
const source = this$$$5["entries@24"].values(); | ||
return sumBy(function projection(pairs) { | ||
return pairs.length; | ||
}, this$$$4.entries.values(), { | ||
}, source, { | ||
GetZero() { | ||
@@ -87,24 +87,21 @@ return 0; | ||
}); | ||
}) | 0; | ||
} | ||
export function MutableSet$00601$$Add$$2B595(this$$$5, k$$2) { | ||
var i$$2, h$$3; | ||
const matchValue$$2 = MutableSet$00601$$TryFindIndex$$2B595(this$$$5, k$$2); | ||
var $target$$6; | ||
export function MutableSet$00601$$Add$$2B595(this$$$6, k$$2) { | ||
const matchValue$$2 = MutableSet$00601$$TryFindIndex$$2B595(this$$$6, k$$2); | ||
var $target$$16; | ||
if (matchValue$$2[0]) { | ||
if (i$$2 = matchValue$$2[2] | 0, (h$$3 = matchValue$$2[1] | 0, i$$2 > -1)) { | ||
$target$$6 = 0; | ||
if (matchValue$$2[2] > -1) { | ||
$target$$16 = 0; | ||
} else { | ||
$target$$6 = 1; | ||
$target$$16 = 1; | ||
} | ||
} else { | ||
$target$$6 = 1; | ||
$target$$16 = 1; | ||
} | ||
switch ($target$$6) { | ||
switch ($target$$16) { | ||
case 0: | ||
{ | ||
const i$$3 = matchValue$$2[2] | 0; | ||
const h$$4 = matchValue$$2[1] | 0; | ||
return false; | ||
@@ -116,9 +113,7 @@ } | ||
if (matchValue$$2[0]) { | ||
const h$$5 = matchValue$$2[1] | 0; | ||
const value = getItemFromDict(this$$$5.entries, h$$5).push(k$$2); | ||
const value$$1 = getItemFromDict(this$$$6["entries@24"], matchValue$$2[1]).push(k$$2); | ||
null, null; | ||
return true; | ||
} else { | ||
const h$$6 = matchValue$$2[1] | 0; | ||
this$$$5.entries.set(h$$6, [k$$2]); | ||
this$$$6["entries@24"].set(matchValue$$2[1], [k$$2]); | ||
return true; | ||
@@ -129,22 +124,19 @@ } | ||
} | ||
export function MutableSet$00601$$Contains$$2B595(this$$$6, k$$3) { | ||
var i$$4, h$$7; | ||
const matchValue$$3 = MutableSet$00601$$TryFindIndex$$2B595(this$$$6, k$$3); | ||
var $target$$7; | ||
export function MutableSet$00601$$Contains$$2B595(this$$$7, k$$3) { | ||
const matchValue$$3 = MutableSet$00601$$TryFindIndex$$2B595(this$$$7, k$$3); | ||
var $target$$19; | ||
if (matchValue$$3[0]) { | ||
if (i$$4 = matchValue$$3[2] | 0, (h$$7 = matchValue$$3[1] | 0, i$$4 > -1)) { | ||
$target$$7 = 0; | ||
if (matchValue$$3[2] > -1) { | ||
$target$$19 = 0; | ||
} else { | ||
$target$$7 = 1; | ||
$target$$19 = 1; | ||
} | ||
} else { | ||
$target$$7 = 1; | ||
$target$$19 = 1; | ||
} | ||
switch ($target$$7) { | ||
switch ($target$$19) { | ||
case 0: | ||
{ | ||
const i$$5 = matchValue$$3[2] | 0; | ||
const h$$8 = matchValue$$3[1] | 0; | ||
return true; | ||
@@ -159,23 +151,20 @@ } | ||
} | ||
export function MutableSet$00601$$Remove$$2B595(this$$$7, k$$4) { | ||
var i$$6, h$$9; | ||
const matchValue$$4 = MutableSet$00601$$TryFindIndex$$2B595(this$$$7, k$$4); | ||
var $target$$8; | ||
export function MutableSet$00601$$Remove$$2B595(this$$$8, k$$4) { | ||
const matchValue$$4 = MutableSet$00601$$TryFindIndex$$2B595(this$$$8, k$$4); | ||
var $target$$22; | ||
if (matchValue$$4[0]) { | ||
if (i$$6 = matchValue$$4[2] | 0, (h$$9 = matchValue$$4[1] | 0, i$$6 > -1)) { | ||
$target$$8 = 0; | ||
if (matchValue$$4[2] > -1) { | ||
$target$$22 = 0; | ||
} else { | ||
$target$$8 = 1; | ||
$target$$22 = 1; | ||
} | ||
} else { | ||
$target$$8 = 1; | ||
$target$$22 = 1; | ||
} | ||
switch ($target$$8) { | ||
switch ($target$$22) { | ||
case 0: | ||
{ | ||
const i$$7 = matchValue$$4[2] | 0; | ||
const h$$10 = matchValue$$4[1] | 0; | ||
getItemFromDict(this$$$7.entries, h$$10).splice(i$$7, 1); | ||
getItemFromDict(this$$$8["entries@24"], matchValue$$4[1]).splice(matchValue$$4[2], 1); | ||
return true; | ||
@@ -193,32 +182,33 @@ } | ||
var elems; | ||
const this$$$8 = this; | ||
const this$$$9 = this; | ||
return toIterator((elems = delay(function () { | ||
return collect(function (values$$1) { | ||
return map(function (value$$1) { | ||
return value$$1; | ||
return map(function (value$$2) { | ||
return value$$2; | ||
}, values$$1); | ||
}, this$$$8.entries.values()); | ||
}, this$$$9["entries@24"].values()); | ||
}), getEnumerator(elems))); | ||
}; | ||
MutableSet$00601.prototype.Add = function (item) { | ||
const this$$$9 = this; | ||
MutableSet$00601$$Add$$2B595(this$$$9, item), null; | ||
MutableSet$00601.prototype.Add = function (item$$1) { | ||
const this$$$10 = this; | ||
const value$$3 = MutableSet$00601$$Add$$2B595(this$$$10, item$$1); | ||
value$$3, null; | ||
}; | ||
MutableSet$00601.prototype.Clear = function () { | ||
const this$$$10 = this; | ||
MutableSet$00601$$Clear(this$$$10); | ||
const this$$$11 = this; | ||
MutableSet$00601$$Clear(this$$$11); | ||
}; | ||
MutableSet$00601.prototype.Contains = function (item$$1) { | ||
const this$$$11 = this; | ||
return MutableSet$00601$$Contains$$2B595(this$$$11, item$$1); | ||
MutableSet$00601.prototype.Contains = function (item$$2) { | ||
const this$$$12 = this; | ||
return MutableSet$00601$$Contains$$2B595(this$$$12, item$$2); | ||
}; | ||
MutableSet$00601.prototype.CopyTo = function (array, arrayIndex) { | ||
const this$$$12 = this; | ||
const this$$$13 = this; | ||
iterateIndexed(function action(i$$8, e) { | ||
array[arrayIndex + i$$8] = e; | ||
}, this$$$12); | ||
}, this$$$13); | ||
}; | ||
@@ -228,4 +218,4 @@ | ||
"get": function () { | ||
const this$$$13 = this; | ||
return MutableSet$00601$$get_Count(this$$$13) | 0; | ||
const this$$$14 = this; | ||
return MutableSet$00601$$get_Count(this$$$14) | 0; | ||
} | ||
@@ -239,5 +229,5 @@ }); | ||
MutableSet$00601.prototype.Remove = function (item$$2) { | ||
const this$$$15 = this; | ||
return MutableSet$00601$$Remove$$2B595(this$$$15, item$$2); | ||
MutableSet$00601.prototype.Remove = function (item$$3) { | ||
const this$$$16 = this; | ||
return MutableSet$00601$$Remove$$2B595(this$$$16, item$$3); | ||
}; | ||
@@ -247,4 +237,4 @@ | ||
"get": function () { | ||
const this$$$16 = this; | ||
return MutableSet$00601$$get_Count(this$$$16) | 0; | ||
const this$$$17 = this; | ||
return MutableSet$00601$$get_Count(this$$$17) | 0; | ||
} | ||
@@ -254,32 +244,47 @@ }); | ||
MutableSet$00601.prototype.add = function (k$$5) { | ||
const this$$$17 = this; | ||
MutableSet$00601$$Add$$2B595(this$$$17, k$$5), null; | ||
return this$$$17; | ||
const this$$$18 = this; | ||
const value$$4 = MutableSet$00601$$Add$$2B595(this$$$18, k$$5); | ||
value$$4, null; | ||
return this$$$18; | ||
}; | ||
MutableSet$00601.prototype.add_ = function (k$$6) { | ||
const this$$$18 = this; | ||
return MutableSet$00601$$Add$$2B595(this$$$18, k$$6); | ||
const this$$$19 = this; | ||
return MutableSet$00601$$Add$$2B595(this$$$19, k$$6); | ||
}; | ||
MutableSet$00601.prototype.clear = function () { | ||
const this$$$19 = this; | ||
MutableSet$00601$$Clear(this$$$19); | ||
const this$$$20 = this; | ||
MutableSet$00601$$Clear(this$$$20); | ||
}; | ||
MutableSet$00601.prototype.delete = function (k$$7) { | ||
const this$$$20 = this; | ||
return MutableSet$00601$$Remove$$2B595(this$$$20, k$$7); | ||
const this$$$21 = this; | ||
return MutableSet$00601$$Remove$$2B595(this$$$21, k$$7); | ||
}; | ||
MutableSet$00601.prototype.has = function (k$$8) { | ||
const this$$$21 = this; | ||
return MutableSet$00601$$Contains$$2B595(this$$$21, k$$8); | ||
const this$$$22 = this; | ||
return MutableSet$00601$$Contains$$2B595(this$$$22, k$$8); | ||
}; | ||
MutableSet$00601.prototype.values = function () { | ||
const this$$$22 = this; | ||
MutableSet$00601.prototype.keys = function () { | ||
const this$$$23 = this; | ||
return map(function mapping(x) { | ||
return x; | ||
}, this$$$22); | ||
}, this$$$23); | ||
}; | ||
MutableSet$00601.prototype.values = function () { | ||
const this$$$24 = this; | ||
return map(function mapping$$1(x$$1) { | ||
return x$$1; | ||
}, this$$$24); | ||
}; | ||
MutableSet$00601.prototype.entries = function () { | ||
const this$$$25 = this; | ||
return map(function mapping$$2(v$$1) { | ||
return [v$$1, v$$1]; | ||
}, this$$$25); | ||
}; |
import { declare, Union } from "./Types.js"; | ||
import { compare, equals, structuralHash } from "./Util.js"; | ||
// Options are erased in runtime by Fable, but we have | ||
// the `Some` type below to wrap values that would evaluate | ||
// to null in runtime. These two rules must be followed: | ||
// 1- None is always null in runtime, a non-strict null check | ||
// (`x == null`) is enough to check the case of an option. | ||
// 2- To get the value of an option the `getValue` helper | ||
// below must **always** be used. | ||
// export type Option<T> = T | Some<T>; | ||
// Using a class here for better compatibility with TS files importing Some | ||
@@ -27,13 +19,20 @@ export class Some { | ||
Equals(other) { | ||
return other == null | ||
? false | ||
: equals(this.value, other instanceof Some ? other.value : other); | ||
if (other == null) { | ||
return false; | ||
} | ||
else { | ||
return equals(this.value, other instanceof Some ? other.value : other); | ||
} | ||
} | ||
CompareTo(other) { | ||
return other == null | ||
? 1 | ||
: compare(this.value, other instanceof Some ? other.value : other); | ||
if (other == null) { | ||
return 1; | ||
} | ||
else { | ||
return compare(this.value, other instanceof Some ? other.value : other); | ||
} | ||
} | ||
} | ||
export function some(x) { | ||
x = (x === undefined) ? null : x; | ||
return x == null || x instanceof Some ? new Some(x) : x; | ||
@@ -62,3 +61,3 @@ } | ||
export function map(predicate, ...args) { | ||
return args.every(x => x != null) ? predicate.apply(null, args) : null; | ||
return args.every((x) => x != null) ? predicate.apply(null, args) : null; | ||
} | ||
@@ -65,0 +64,0 @@ // CHOICE |
@@ -1,2 +0,2 @@ | ||
import { Record, Union, anonRecord as makeAnonRecord } from "./Types.js"; | ||
import { anonRecord as makeAnonRecord, Record, Union } from "./Types.js"; | ||
import { compareArraysWith, equalArraysWith } from "./Util.js"; | ||
@@ -223,3 +223,3 @@ export class CaseInfo { | ||
? new t.constructor(...values) | ||
: makeAnonRecord(fields.reduce((obj, [key,], i) => { | ||
: makeAnonRecord(fields.reduce((obj, [key, _t], i) => { | ||
obj[key] = values[i]; | ||
@@ -226,0 +226,0 @@ return obj; |
@@ -0,3 +1,3 @@ | ||
import { makeRangeStepFunction as makeDecimalRangeStepFunction } from "./Decimal.js"; | ||
import { makeRangeStepFunction as makeLongRangeStepFunction } from "./Long.js"; | ||
import { makeRangeStepFunction as makeDecimalRangeStepFunction } from "./Decimal.js"; | ||
import { some, value } from "./Option.js"; | ||
@@ -64,3 +64,3 @@ import { compare, equals } from "./Util.js"; | ||
else { | ||
return ysCache.map(y => [x, y]); | ||
return ysCache.map((y) => [x, y]); | ||
// return map(function (i) { | ||
@@ -67,0 +67,0 @@ // return [x, ysCache[i]]; |
import { List, Record, declare, Union } from "./Types.js"; | ||
import { type, record, bool, list, union as union$$1, int32 } from "./Reflection.js"; | ||
import { value as value$$3, some, Choice } from "./Option.js"; | ||
import { empty as empty$$1, iterate as iterate$$1, fold as fold$$1, toIterator, map as map$$1, reduce, getEnumerator, unfold } from "./Seq.js"; | ||
import { value as value$$2, some, Choice } from "./Option.js"; | ||
import { iterate as iterate$$1, delay, collect, singleton as singleton$$1, empty as empty$$1, fold as fold$$1, toIterator, map as map$$1, reduce, getEnumerator, unfold } from "./Seq.js"; | ||
import { structuralHash, isDisposable } from "./Util.js"; | ||
import { join } from "./String.js"; | ||
import { MutableSet$00601$$Add$$2B595 as MutableSet$002400601$0024$0024Add$0024$00242B595, MutableSet$00601$$$$002Ector$$Z79760D57 as MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z79760D57 } from "./MutableSet.js"; | ||
import { MutableSet$00601$$Add$$2B595 as MutableSet$002400601$0024$0024Add$0024$00242B595, MutableSet$00601$$$$002Ector$$Z6150332D as MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z6150332D } from "./MutableSet.js"; | ||
export const SetTree$00601 = declare(function Set_SetTree(tag, name, ...fields) { | ||
@@ -14,4 +14,7 @@ Union.call(this, tag, name, ...fields); | ||
} | ||
export function SetTreeModule$$$countAux(s, acc) { | ||
export function SetTreeModule$$$countAux($s$$4, $acc$$5) { | ||
SetTreeModule$$$countAux: while (true) { | ||
const s = $s$$4, | ||
acc = $acc$$5; | ||
switch (s.tag) { | ||
@@ -30,7 +33,4 @@ case 2: | ||
{ | ||
const r = s.fields[2]; | ||
const l = s.fields[1]; | ||
const $acc$$4 = acc; | ||
s = l; | ||
acc = SetTreeModule$$$countAux(r, $acc$$4 + 1); | ||
$s$$4 = s.fields[1]; | ||
$acc$$5 = SetTreeModule$$$countAux(s.fields[2], acc + 1); | ||
continue SetTreeModule$$$countAux; | ||
@@ -61,4 +61,3 @@ } | ||
{ | ||
const h$$1 = t.fields[3] | 0; | ||
return h$$1 | 0; | ||
return t.fields[3] | 0; | ||
} | ||
@@ -74,15 +73,15 @@ | ||
export function SetTreeModule$$$mk(l$$2, k, r$$2) { | ||
var $target$$5; | ||
var $target$$16; | ||
if (l$$2.tag === 0) { | ||
if (r$$2.tag === 0) { | ||
$target$$5 = 0; | ||
$target$$16 = 0; | ||
} else { | ||
$target$$5 = 1; | ||
$target$$16 = 1; | ||
} | ||
} else { | ||
$target$$5 = 1; | ||
$target$$16 = 1; | ||
} | ||
switch ($target$$5) { | ||
switch ($target$$16) { | ||
case 0: | ||
@@ -108,12 +107,5 @@ { | ||
if (t2.tag === 1) { | ||
const t2r = t2.fields[2]; | ||
const t2l = t2.fields[1]; | ||
const t2k = t2.fields[0]; | ||
if (SetTreeModule$$$height(t2l) > t1h + 1) { | ||
if (t2l.tag === 1) { | ||
const t2lr = t2l.fields[2]; | ||
const t2ll = t2l.fields[1]; | ||
const t2lk = t2l.fields[0]; | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1, k$$1, t2ll), t2lk, SetTreeModule$$$mk(t2lr, t2k, t2r)); | ||
if (SetTreeModule$$$height(t2.fields[1]) > t1h + 1) { | ||
if (t2.fields[1].tag === 1) { | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1, k$$1, t2.fields[1].fields[1]), t2.fields[1].fields[0], SetTreeModule$$$mk(t2.fields[1].fields[2], t2.fields[0], t2.fields[2])); | ||
} else { | ||
@@ -123,3 +115,3 @@ throw new Error("rebalance"); | ||
} else { | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1, k$$1, t2l), t2k, t2r); | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1, k$$1, t2.fields[1]), t2.fields[0], t2.fields[2]); | ||
} | ||
@@ -131,12 +123,5 @@ } else { | ||
if (t1.tag === 1) { | ||
const t1r = t1.fields[2]; | ||
const t1l = t1.fields[1]; | ||
const t1k = t1.fields[0]; | ||
if (SetTreeModule$$$height(t1r) > t2h + 1) { | ||
if (t1r.tag === 1) { | ||
const t1rr = t1r.fields[2]; | ||
const t1rl = t1r.fields[1]; | ||
const t1rk = t1r.fields[0]; | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1l, t1k, t1rl), t1rk, SetTreeModule$$$mk(t1rr, k$$1, t2)); | ||
if (SetTreeModule$$$height(t1.fields[2]) > t2h + 1) { | ||
if (t1.fields[2].tag === 1) { | ||
return SetTreeModule$$$mk(SetTreeModule$$$mk(t1.fields[1], t1.fields[0], t1.fields[2].fields[1]), t1.fields[2].fields[0], SetTreeModule$$$mk(t1.fields[2].fields[2], k$$1, t2)); | ||
} else { | ||
@@ -146,3 +131,3 @@ throw new Error("rebalance"); | ||
} else { | ||
return SetTreeModule$$$mk(t1l, t1k, SetTreeModule$$$mk(t1r, k$$1, t2)); | ||
return SetTreeModule$$$mk(t1.fields[1], t1.fields[0], SetTreeModule$$$mk(t1.fields[2], k$$1, t2)); | ||
} | ||
@@ -160,4 +145,3 @@ } else { | ||
{ | ||
const k2$$1 = t$$1.fields[0]; | ||
const c$$1 = comparer.Compare(k$$2, k2$$1) | 0; | ||
const c$$1 = comparer.Compare(k$$2, t$$1.fields[0]) | 0; | ||
@@ -180,13 +164,10 @@ if (c$$1 < 0) { | ||
{ | ||
const r$$3 = t$$1.fields[2]; | ||
const l$$3 = t$$1.fields[1]; | ||
const k2 = t$$1.fields[0]; | ||
const c = comparer.Compare(k$$2, k2) | 0; | ||
const c = comparer.Compare(k$$2, t$$1.fields[0]) | 0; | ||
if (c < 0) { | ||
return SetTreeModule$$$rebalance(SetTreeModule$$$add(comparer, k$$2, l$$3), k2, r$$3); | ||
return SetTreeModule$$$rebalance(SetTreeModule$$$add(comparer, k$$2, t$$1.fields[1]), t$$1.fields[0], t$$1.fields[2]); | ||
} else if (c === 0) { | ||
return t$$1; | ||
} else { | ||
return SetTreeModule$$$rebalance(l$$3, k2, SetTreeModule$$$add(comparer, k$$2, r$$3)); | ||
return SetTreeModule$$$rebalance(t$$1.fields[1], t$$1.fields[0], SetTreeModule$$$add(comparer, k$$2, t$$1.fields[2])); | ||
} | ||
@@ -197,14 +178,14 @@ } | ||
export function SetTreeModule$$$balance(comparer$$1, t1$$1, k$$3, t2$$1) { | ||
var $target$$6, t2$$2, t1$$2, k1, t2$$3, k2$$2, t1$$3, h1, h2, k1$$1, k2$$3, t11, t12, t21, t22; | ||
var $target$$27, t2$$2, t1$$2, k1, t2$$3, k2$$2, t1$$3, h1, h2, k1$$1, k2$$3, t11, t12, t21, t22; | ||
if (t1$$1.tag === 2) { | ||
if (t2$$1.tag === 0) { | ||
$target$$6 = 1; | ||
$target$$27 = 1; | ||
t1$$2 = t1$$1; | ||
} else if (t2$$1.tag === 2) { | ||
$target$$6 = 2; | ||
$target$$27 = 2; | ||
k1 = t1$$1.fields[0]; | ||
t2$$3 = t2$$1; | ||
} else { | ||
$target$$6 = 2; | ||
$target$$27 = 2; | ||
k1 = t1$$1.fields[0]; | ||
@@ -215,7 +196,7 @@ t2$$3 = t2$$1; | ||
if (t2$$1.tag === 2) { | ||
$target$$6 = 3; | ||
$target$$27 = 3; | ||
k2$$2 = t2$$1.fields[0]; | ||
t1$$3 = t1$$1; | ||
} else if (t2$$1.tag === 1) { | ||
$target$$6 = 4; | ||
$target$$27 = 4; | ||
h1 = t1$$1.fields[3]; | ||
@@ -230,11 +211,11 @@ h2 = t2$$1.fields[3]; | ||
} else { | ||
$target$$6 = 1; | ||
$target$$27 = 1; | ||
t1$$2 = t1$$1; | ||
} | ||
} else { | ||
$target$$6 = 0; | ||
$target$$27 = 0; | ||
t2$$2 = t2$$1; | ||
} | ||
switch ($target$$6) { | ||
switch ($target$$27) { | ||
case 0: | ||
@@ -276,4 +257,3 @@ { | ||
{ | ||
const k1$$3 = t$$2.fields[0]; | ||
const c$$3 = comparer$$2.Compare(k1$$3, pivot) | 0; | ||
const c$$3 = comparer$$2.Compare(t$$2.fields[0], pivot) | 0; | ||
@@ -296,21 +276,12 @@ if (c$$3 < 0) { | ||
{ | ||
const t12$$1 = t$$2.fields[2]; | ||
const t11$$1 = t$$2.fields[1]; | ||
const k1$$2 = t$$2.fields[0]; | ||
const c$$2 = comparer$$2.Compare(pivot, k1$$2) | 0; | ||
const c$$2 = comparer$$2.Compare(pivot, t$$2.fields[0]) | 0; | ||
if (c$$2 < 0) { | ||
const patternInput = SetTreeModule$$$split(comparer$$2, pivot, t11$$1); | ||
const t11Lo = patternInput[0]; | ||
const t11Hi = patternInput[2]; | ||
const havePivot = patternInput[1]; | ||
return [t11Lo, havePivot, SetTreeModule$$$balance(comparer$$2, t11Hi, k1$$2, t12$$1)]; | ||
const patternInput = SetTreeModule$$$split(comparer$$2, pivot, t$$2.fields[1]); | ||
return [patternInput[0], patternInput[1], SetTreeModule$$$balance(comparer$$2, patternInput[2], t$$2.fields[0], t$$2.fields[2])]; | ||
} else if (c$$2 === 0) { | ||
return [t11$$1, true, t12$$1]; | ||
return [t$$2.fields[1], true, t$$2.fields[2]]; | ||
} else { | ||
const patternInput$$1 = SetTreeModule$$$split(comparer$$2, pivot, t12$$1); | ||
const t12Lo = patternInput$$1[0]; | ||
const t12Hi = patternInput$$1[2]; | ||
const havePivot$$1 = patternInput$$1[1]; | ||
return [SetTreeModule$$$balance(comparer$$2, t11$$1, k1$$2, t12Lo), havePivot$$1, t12Hi]; | ||
const patternInput$$1 = SetTreeModule$$$split(comparer$$2, pivot, t$$2.fields[2]); | ||
return [SetTreeModule$$$balance(comparer$$2, t$$2.fields[1], t$$2.fields[0], patternInput$$1[0]), patternInput$$1[1], patternInput$$1[2]]; | ||
} | ||
@@ -324,4 +295,3 @@ } | ||
{ | ||
const k2$$4 = t$$3.fields[0]; | ||
return [k2$$4, new SetTree$00601(0, "SetEmpty")]; | ||
return [t$$3.fields[0], new SetTree$00601(0, "SetEmpty")]; | ||
} | ||
@@ -331,13 +301,7 @@ | ||
{ | ||
const r$$4 = t$$3.fields[2]; | ||
const l$$4 = t$$3.fields[1]; | ||
const k2$$5 = t$$3.fields[0]; | ||
if (l$$4.tag === 0) { | ||
return [k2$$5, r$$4]; | ||
if (t$$3.fields[1].tag === 0) { | ||
return [t$$3.fields[0], t$$3.fields[2]]; | ||
} else { | ||
const patternInput$$2 = SetTreeModule$$$spliceOutSuccessor(l$$4); | ||
const l$0027 = patternInput$$2[1]; | ||
const k3 = patternInput$$2[0]; | ||
return [k3, SetTreeModule$$$mk(l$0027, k2$$5, r$$4)]; | ||
const patternInput$$2 = SetTreeModule$$$spliceOutSuccessor(t$$3.fields[1]); | ||
return [patternInput$$2[0], SetTreeModule$$$mk(patternInput$$2[1], t$$3.fields[0], t$$3.fields[2])]; | ||
} | ||
@@ -356,4 +320,3 @@ } | ||
{ | ||
const k2$$6 = t$$4.fields[0]; | ||
const c$$4 = comparer$$3.Compare(k$$4, k2$$6) | 0; | ||
const c$$4 = comparer$$3.Compare(k$$4, t$$4.fields[0]) | 0; | ||
@@ -369,22 +332,17 @@ if (c$$4 === 0) { | ||
{ | ||
const r$$5 = t$$4.fields[2]; | ||
const l$$5 = t$$4.fields[1]; | ||
const k2$$7 = t$$4.fields[0]; | ||
const c$$5 = comparer$$3.Compare(k$$4, k2$$7) | 0; | ||
const c$$5 = comparer$$3.Compare(k$$4, t$$4.fields[0]) | 0; | ||
if (c$$5 < 0) { | ||
return SetTreeModule$$$rebalance(SetTreeModule$$$remove(comparer$$3, k$$4, l$$5), k2$$7, r$$5); | ||
return SetTreeModule$$$rebalance(SetTreeModule$$$remove(comparer$$3, k$$4, t$$4.fields[1]), t$$4.fields[0], t$$4.fields[2]); | ||
} else if (c$$5 === 0) { | ||
if (l$$5.tag === 0) { | ||
return r$$5; | ||
} else if (r$$5.tag === 0) { | ||
return l$$5; | ||
if (t$$4.fields[1].tag === 0) { | ||
return t$$4.fields[2]; | ||
} else if (t$$4.fields[2].tag === 0) { | ||
return t$$4.fields[1]; | ||
} else { | ||
const patternInput$$3 = SetTreeModule$$$spliceOutSuccessor(r$$5); | ||
const sk = patternInput$$3[0]; | ||
const r$0027 = patternInput$$3[1]; | ||
return SetTreeModule$$$mk(l$$5, sk, r$0027); | ||
const patternInput$$3 = SetTreeModule$$$spliceOutSuccessor(t$$4.fields[2]); | ||
return SetTreeModule$$$mk(t$$4.fields[1], patternInput$$3[0], patternInput$$3[1]); | ||
} | ||
} else { | ||
return SetTreeModule$$$rebalance(l$$5, k2$$7, SetTreeModule$$$remove(comparer$$3, k$$4, r$$5)); | ||
return SetTreeModule$$$rebalance(t$$4.fields[1], t$$4.fields[0], SetTreeModule$$$remove(comparer$$3, k$$4, t$$4.fields[2])); | ||
} | ||
@@ -399,9 +357,12 @@ } | ||
} | ||
export function SetTreeModule$$$mem(comparer$$4, k$$5, t$$5) { | ||
export function SetTreeModule$$$mem($comparer$$4$$35, $k$$5$$36, $t$$5$$37) { | ||
SetTreeModule$$$mem: while (true) { | ||
const comparer$$4 = $comparer$$4$$35, | ||
k$$5 = $k$$5$$36, | ||
t$$5 = $t$$5$$37; | ||
switch (t$$5.tag) { | ||
case 2: | ||
{ | ||
const k2$$9 = t$$5.fields[0]; | ||
return comparer$$4.Compare(k$$5, k2$$9) === 0; | ||
return comparer$$4.Compare(k$$5, t$$5.fields[0]) === 0; | ||
} | ||
@@ -416,13 +377,8 @@ | ||
{ | ||
const r$$6 = t$$5.fields[2]; | ||
const l$$6 = t$$5.fields[1]; | ||
const k2$$8 = t$$5.fields[0]; | ||
const c$$6 = comparer$$4.Compare(k$$5, k2$$8) | 0; | ||
const c$$6 = comparer$$4.Compare(k$$5, t$$5.fields[0]) | 0; | ||
if (c$$6 < 0) { | ||
const $comparer$$4$$7 = comparer$$4; | ||
const $k$$5$$8 = k$$5; | ||
comparer$$4 = $comparer$$4$$7; | ||
k$$5 = $k$$5$$8; | ||
t$$5 = l$$6; | ||
$comparer$$4$$35 = comparer$$4; | ||
$k$$5$$36 = k$$5; | ||
$t$$5$$37 = t$$5.fields[1]; | ||
continue SetTreeModule$$$mem; | ||
@@ -432,7 +388,5 @@ } else if (c$$6 === 0) { | ||
} else { | ||
const $comparer$$4$$9 = comparer$$4; | ||
const $k$$5$$10 = k$$5; | ||
comparer$$4 = $comparer$$4$$9; | ||
k$$5 = $k$$5$$10; | ||
t$$5 = r$$6; | ||
$comparer$$4$$35 = comparer$$4; | ||
$k$$5$$36 = k$$5; | ||
$t$$5$$37 = t$$5.fields[2]; | ||
continue SetTreeModule$$$mem; | ||
@@ -446,6 +400,6 @@ } | ||
} | ||
export function SetTreeModule$$$iter($arg$$11, $arg$$12) { | ||
export function SetTreeModule$$$iter($f$$38, $t$$6$$39) { | ||
SetTreeModule$$$iter: while (true) { | ||
const f = $arg$$11, | ||
t$$6 = $arg$$12; | ||
const f = $f$$38, | ||
t$$6 = $t$$6$$39; | ||
@@ -455,4 +409,3 @@ switch (t$$6.tag) { | ||
{ | ||
const k2$$11 = t$$6.fields[0]; | ||
f(k2$$11); | ||
f(t$$6.fields[0]); | ||
break; | ||
@@ -468,9 +421,6 @@ } | ||
{ | ||
const r$$7 = t$$6.fields[2]; | ||
const l$$7 = t$$6.fields[1]; | ||
const k2$$10 = t$$6.fields[0]; | ||
SetTreeModule$$$iter(f, l$$7); | ||
f(k2$$10); | ||
$arg$$11 = f; | ||
$arg$$12 = r$$7; | ||
SetTreeModule$$$iter(f, t$$6.fields[1]); | ||
f(t$$6.fields[0]); | ||
$f$$38 = f; | ||
$t$$6$$39 = t$$6.fields[2]; | ||
continue SetTreeModule$$$iter; | ||
@@ -483,7 +433,7 @@ } | ||
} | ||
export function SetTreeModule$$$foldBack($arg$$13, $arg$$14, $arg$$15) { | ||
export function SetTreeModule$$$foldBack($f$$1$$40, $m$$1$$41, $x$$1$$42) { | ||
SetTreeModule$$$foldBack: while (true) { | ||
const f$$1 = $arg$$13, | ||
m$$1 = $arg$$14, | ||
x$$1 = $arg$$15; | ||
const f$$1 = $f$$1$$40, | ||
m$$1 = $m$$1$$41, | ||
x$$1 = $x$$1$$42; | ||
@@ -493,4 +443,3 @@ switch (m$$1.tag) { | ||
{ | ||
const k$$7 = m$$1.fields[0]; | ||
return f$$1(k$$7, x$$1); | ||
return f$$1(m$$1.fields[0], x$$1); | ||
} | ||
@@ -505,8 +454,5 @@ | ||
{ | ||
const r$$8 = m$$1.fields[2]; | ||
const l$$8 = m$$1.fields[1]; | ||
const k$$6 = m$$1.fields[0]; | ||
$arg$$13 = f$$1; | ||
$arg$$14 = l$$8; | ||
$arg$$15 = f$$1(k$$6, SetTreeModule$$$foldBack(f$$1, r$$8, x$$1)); | ||
$f$$1$$40 = f$$1; | ||
$m$$1$$41 = m$$1.fields[1]; | ||
$x$$1$$42 = f$$1(m$$1.fields[0], SetTreeModule$$$foldBack(f$$1, m$$1.fields[2], x$$1)); | ||
continue SetTreeModule$$$foldBack; | ||
@@ -519,7 +465,7 @@ } | ||
} | ||
export function SetTreeModule$$$fold($arg$$16, $arg$$17, $arg$$18) { | ||
export function SetTreeModule$$$fold($f$$2$$43, $x$$2$$44, $m$$2$$45) { | ||
SetTreeModule$$$fold: while (true) { | ||
const f$$2 = $arg$$16, | ||
x$$2 = $arg$$17, | ||
m$$2 = $arg$$18; | ||
const f$$2 = $f$$2$$43, | ||
x$$2 = $x$$2$$44, | ||
m$$2 = $m$$2$$45; | ||
@@ -529,4 +475,3 @@ switch (m$$2.tag) { | ||
{ | ||
const k$$9 = m$$2.fields[0]; | ||
return f$$2(x$$2, k$$9); | ||
return f$$2(x$$2, m$$2.fields[0]); | ||
} | ||
@@ -541,10 +486,7 @@ | ||
{ | ||
const r$$9 = m$$2.fields[2]; | ||
const l$$9 = m$$2.fields[1]; | ||
const k$$8 = m$$2.fields[0]; | ||
const x$$3 = SetTreeModule$$$fold(f$$2, x$$2, l$$9); | ||
const x$$4 = f$$2(x$$3, k$$8); | ||
$arg$$16 = f$$2; | ||
$arg$$17 = x$$4; | ||
$arg$$18 = r$$9; | ||
const x$$3 = SetTreeModule$$$fold(f$$2, x$$2, m$$2.fields[1]); | ||
const x$$4 = f$$2(x$$3, m$$2.fields[0]); | ||
$f$$2$$43 = f$$2; | ||
$x$$2$$44 = x$$4; | ||
$m$$2$$45 = m$$2.fields[2]; | ||
continue SetTreeModule$$$fold; | ||
@@ -557,6 +499,6 @@ } | ||
} | ||
export function SetTreeModule$$$forall($arg$$19, $arg$$20) { | ||
export function SetTreeModule$$$forall($f$$3$$46, $m$$3$$47) { | ||
SetTreeModule$$$forall: while (true) { | ||
const f$$3 = $arg$$19, | ||
m$$3 = $arg$$20; | ||
const f$$3 = $f$$3$$46, | ||
m$$3 = $m$$3$$47; | ||
@@ -566,4 +508,3 @@ switch (m$$3.tag) { | ||
{ | ||
const k2$$13 = m$$3.fields[0]; | ||
return f$$3(k2$$13); | ||
return f$$3(m$$3.fields[0]); | ||
} | ||
@@ -578,9 +519,5 @@ | ||
{ | ||
const r$$10 = m$$3.fields[2]; | ||
const l$$10 = m$$3.fields[1]; | ||
const k2$$12 = m$$3.fields[0]; | ||
if (f$$3(k2$$12) ? SetTreeModule$$$forall(f$$3, l$$10) : false) { | ||
$arg$$19 = f$$3; | ||
$arg$$20 = r$$10; | ||
if (f$$3(m$$3.fields[0]) ? SetTreeModule$$$forall(f$$3, m$$3.fields[1]) : false) { | ||
$f$$3$$46 = f$$3; | ||
$m$$3$$47 = m$$3.fields[2]; | ||
continue SetTreeModule$$$forall; | ||
@@ -596,6 +533,6 @@ } else { | ||
} | ||
export function SetTreeModule$$$exists($arg$$21, $arg$$22) { | ||
export function SetTreeModule$$$exists($f$$4$$48, $m$$4$$49) { | ||
SetTreeModule$$$exists: while (true) { | ||
const f$$4 = $arg$$21, | ||
m$$4 = $arg$$22; | ||
const f$$4 = $f$$4$$48, | ||
m$$4 = $m$$4$$49; | ||
@@ -605,4 +542,3 @@ switch (m$$4.tag) { | ||
{ | ||
const k2$$15 = m$$4.fields[0]; | ||
return f$$4(k2$$15); | ||
return f$$4(m$$4.fields[0]); | ||
} | ||
@@ -617,11 +553,7 @@ | ||
{ | ||
const r$$11 = m$$4.fields[2]; | ||
const l$$11 = m$$4.fields[1]; | ||
const k2$$14 = m$$4.fields[0]; | ||
if (f$$4(k2$$14) ? true : SetTreeModule$$$exists(f$$4, l$$11)) { | ||
if (f$$4(m$$4.fields[0]) ? true : SetTreeModule$$$exists(f$$4, m$$4.fields[1])) { | ||
return true; | ||
} else { | ||
$arg$$21 = f$$4; | ||
$arg$$22 = r$$11; | ||
$f$$4$$48 = f$$4; | ||
$m$$4$$49 = m$$4.fields[2]; | ||
continue SetTreeModule$$$exists; | ||
@@ -658,8 +590,8 @@ } | ||
} | ||
export function SetTreeModule$$$filterAux($arg$$23, $arg$$24, $arg$$25, $arg$$26) { | ||
export function SetTreeModule$$$filterAux($comparer$$7$$57, $f$$5$$58, $s$$2$$59, $acc$$1$$60) { | ||
SetTreeModule$$$filterAux: while (true) { | ||
const comparer$$7 = $arg$$23, | ||
f$$5 = $arg$$24, | ||
s$$2 = $arg$$25, | ||
acc$$1 = $arg$$26; | ||
const comparer$$7 = $comparer$$7$$57, | ||
f$$5 = $f$$5$$58, | ||
s$$2 = $s$$2$$59, | ||
acc$$1 = $acc$$1$$60; | ||
@@ -669,6 +601,4 @@ switch (s$$2.tag) { | ||
{ | ||
const k$$11 = s$$2.fields[0]; | ||
if (f$$5(k$$11)) { | ||
return SetTreeModule$$$add(comparer$$7, k$$11, acc$$1); | ||
if (f$$5(s$$2.fields[0])) { | ||
return SetTreeModule$$$add(comparer$$7, s$$2.fields[0], acc$$1); | ||
} else { | ||
@@ -686,10 +616,7 @@ return acc$$1; | ||
{ | ||
const r$$12 = s$$2.fields[2]; | ||
const l$$12 = s$$2.fields[1]; | ||
const k$$10 = s$$2.fields[0]; | ||
const acc$$2 = f$$5(k$$10) ? SetTreeModule$$$add(comparer$$7, k$$10, acc$$1) : acc$$1; | ||
$arg$$23 = comparer$$7; | ||
$arg$$24 = f$$5; | ||
$arg$$25 = l$$12; | ||
$arg$$26 = SetTreeModule$$$filterAux(comparer$$7, f$$5, r$$12, acc$$2); | ||
const acc$$2 = f$$5(s$$2.fields[0]) ? SetTreeModule$$$add(comparer$$7, s$$2.fields[0], acc$$1) : acc$$1; | ||
$comparer$$7$$57 = comparer$$7; | ||
$f$$5$$58 = f$$5; | ||
$s$$2$$59 = s$$2.fields[1]; | ||
$acc$$1$$60 = SetTreeModule$$$filterAux(comparer$$7, f$$5, s$$2.fields[2], acc$$2); | ||
continue SetTreeModule$$$filterAux; | ||
@@ -705,9 +632,12 @@ } | ||
} | ||
export function SetTreeModule$$$diffAux(comparer$$9, m$$6, acc$$3) { | ||
export function SetTreeModule$$$diffAux($comparer$$9$$64, $m$$6$$65, $acc$$3$$66) { | ||
SetTreeModule$$$diffAux: while (true) { | ||
const comparer$$9 = $comparer$$9$$64, | ||
m$$6 = $m$$6$$65, | ||
acc$$3 = $acc$$3$$66; | ||
switch (m$$6.tag) { | ||
case 2: | ||
{ | ||
const k$$13 = m$$6.fields[0]; | ||
return SetTreeModule$$$remove(comparer$$9, k$$13, acc$$3); | ||
return SetTreeModule$$$remove(comparer$$9, m$$6.fields[0], acc$$3); | ||
} | ||
@@ -722,10 +652,5 @@ | ||
{ | ||
const r$$13 = m$$6.fields[2]; | ||
const l$$13 = m$$6.fields[1]; | ||
const k$$12 = m$$6.fields[0]; | ||
const $acc$$3$$31 = acc$$3; | ||
const $comparer$$9$$30 = comparer$$9; | ||
comparer$$9 = $comparer$$9$$30; | ||
m$$6 = l$$13; | ||
acc$$3 = SetTreeModule$$$diffAux($comparer$$9$$30, r$$13, SetTreeModule$$$remove($comparer$$9$$30, k$$12, $acc$$3$$31)); | ||
$comparer$$9$$64 = comparer$$9; | ||
$m$$6$$65 = m$$6.fields[1]; | ||
$acc$$3$$66 = SetTreeModule$$$diffAux(comparer$$9, m$$6.fields[2], SetTreeModule$$$remove(comparer$$9, m$$6.fields[0], acc$$3)); | ||
continue SetTreeModule$$$diffAux; | ||
@@ -742,17 +667,17 @@ } | ||
export function SetTreeModule$$$union(comparer$$11, t1$$4, t2$$4) { | ||
var $target$$32, h1$$1, h2$$1, k1$$4, k2$$16, t11$$2, t12$$2, t21$$1, t22$$1, t$$7, t$$8, k1$$5, t2$$5, k2$$17, t1$$5; | ||
var $target$$73, h1$$1, h2$$1, k1$$4, k2$$16, t11$$2, t12$$2, t21$$1, t22$$1, t$$7, t$$8, k1$$5, t2$$5, k2$$17, t1$$5; | ||
if (t1$$4.tag === 0) { | ||
$target$$32 = 1; | ||
$target$$73 = 1; | ||
t$$7 = t2$$4; | ||
} else if (t1$$4.tag === 2) { | ||
if (t2$$4.tag === 0) { | ||
$target$$32 = 2; | ||
$target$$73 = 2; | ||
t$$8 = t1$$4; | ||
} else if (t2$$4.tag === 2) { | ||
$target$$32 = 3; | ||
$target$$73 = 3; | ||
k1$$5 = t1$$4.fields[0]; | ||
t2$$5 = t2$$4; | ||
} else { | ||
$target$$32 = 3; | ||
$target$$73 = 3; | ||
k1$$5 = t1$$4.fields[0]; | ||
@@ -762,10 +687,10 @@ t2$$5 = t2$$4; | ||
} else if (t2$$4.tag === 0) { | ||
$target$$32 = 2; | ||
$target$$73 = 2; | ||
t$$8 = t1$$4; | ||
} else if (t2$$4.tag === 2) { | ||
$target$$32 = 4; | ||
$target$$73 = 4; | ||
k2$$17 = t2$$4.fields[0]; | ||
t1$$5 = t1$$4; | ||
} else { | ||
$target$$32 = 0; | ||
$target$$73 = 0; | ||
h1$$1 = t1$$4.fields[3]; | ||
@@ -781,3 +706,3 @@ h2$$1 = t2$$4.fields[3]; | ||
switch ($target$$32) { | ||
switch ($target$$73) { | ||
case 0: | ||
@@ -787,10 +712,6 @@ { | ||
const patternInput$$4 = SetTreeModule$$$split(comparer$$11, k1$$4, t2$$4); | ||
const lo = patternInput$$4[0]; | ||
const hi = patternInput$$4[2]; | ||
return SetTreeModule$$$balance(comparer$$11, SetTreeModule$$$union(comparer$$11, t11$$2, lo), k1$$4, SetTreeModule$$$union(comparer$$11, t12$$2, hi)); | ||
return SetTreeModule$$$balance(comparer$$11, SetTreeModule$$$union(comparer$$11, t11$$2, patternInput$$4[0]), k1$$4, SetTreeModule$$$union(comparer$$11, t12$$2, patternInput$$4[2])); | ||
} else { | ||
const patternInput$$5 = SetTreeModule$$$split(comparer$$11, k2$$16, t1$$4); | ||
const lo$$1 = patternInput$$5[0]; | ||
const hi$$1 = patternInput$$5[2]; | ||
return SetTreeModule$$$balance(comparer$$11, SetTreeModule$$$union(comparer$$11, t21$$1, lo$$1), k2$$16, SetTreeModule$$$union(comparer$$11, t22$$1, hi$$1)); | ||
return SetTreeModule$$$balance(comparer$$11, SetTreeModule$$$union(comparer$$11, t21$$1, patternInput$$5[0]), k2$$16, SetTreeModule$$$union(comparer$$11, t22$$1, patternInput$$5[2])); | ||
} | ||
@@ -820,11 +741,14 @@ } | ||
} | ||
export function SetTreeModule$$$intersectionAux(comparer$$12, b$$3, m$$7, acc$$4) { | ||
export function SetTreeModule$$$intersectionAux($comparer$$12$$74, $b$$3$$75, $m$$7$$76, $acc$$4$$77) { | ||
SetTreeModule$$$intersectionAux: while (true) { | ||
const comparer$$12 = $comparer$$12$$74, | ||
b$$3 = $b$$3$$75, | ||
m$$7 = $m$$7$$76, | ||
acc$$4 = $acc$$4$$77; | ||
switch (m$$7.tag) { | ||
case 2: | ||
{ | ||
const k$$15 = m$$7.fields[0]; | ||
if (SetTreeModule$$$mem(comparer$$12, k$$15, b$$3)) { | ||
return SetTreeModule$$$add(comparer$$12, k$$15, acc$$4); | ||
if (SetTreeModule$$$mem(comparer$$12, m$$7.fields[0], b$$3)) { | ||
return SetTreeModule$$$add(comparer$$12, m$$7.fields[0], acc$$4); | ||
} else { | ||
@@ -842,13 +766,8 @@ return acc$$4; | ||
{ | ||
const r$$14 = m$$7.fields[2]; | ||
const l$$14 = m$$7.fields[1]; | ||
const k$$14 = m$$7.fields[0]; | ||
const acc$$5 = SetTreeModule$$$intersectionAux(comparer$$12, b$$3, r$$14, acc$$4); | ||
const acc$$6 = SetTreeModule$$$mem(comparer$$12, k$$14, b$$3) ? SetTreeModule$$$add(comparer$$12, k$$14, acc$$5) : acc$$5; | ||
const $b$$3$$34 = b$$3; | ||
const $comparer$$12$$33 = comparer$$12; | ||
comparer$$12 = $comparer$$12$$33; | ||
b$$3 = $b$$3$$34; | ||
m$$7 = l$$14; | ||
acc$$4 = acc$$6; | ||
const acc$$5 = SetTreeModule$$$intersectionAux(comparer$$12, b$$3, m$$7.fields[2], acc$$4); | ||
const acc$$6 = SetTreeModule$$$mem(comparer$$12, m$$7.fields[0], b$$3) ? SetTreeModule$$$add(comparer$$12, m$$7.fields[0], acc$$5) : acc$$5; | ||
$comparer$$12$$74 = comparer$$12; | ||
$b$$3$$75 = b$$3; | ||
$m$$7$$76 = m$$7.fields[1]; | ||
$acc$$4$$77 = acc$$6; | ||
continue SetTreeModule$$$intersectionAux; | ||
@@ -871,10 +790,9 @@ } | ||
} | ||
export function SetTreeModule$$$partitionAux($arg$$40, $arg$$41, $arg$$42, $arg$$43, $arg$$44) { | ||
export function SetTreeModule$$$partitionAux($comparer$$15$$86, $f$$8$$87, $s$$4$$88, $acc_0$$89, $acc_1$$90) { | ||
SetTreeModule$$$partitionAux: while (true) { | ||
const comparer$$15 = $arg$$40, | ||
f$$8 = $arg$$41, | ||
s$$4 = $arg$$42, | ||
acc_0 = $arg$$43, | ||
acc_1 = $arg$$44; | ||
const acc$$7 = [acc_0, acc_1]; | ||
const comparer$$15 = $comparer$$15$$86, | ||
f$$8 = $f$$8$$87, | ||
s$$4 = $s$$4$$88, | ||
acc_0 = $acc_0$$89, | ||
acc_1 = $acc_1$$90; | ||
@@ -884,4 +802,3 @@ switch (s$$4.tag) { | ||
{ | ||
const k$$18 = s$$4.fields[0]; | ||
return SetTreeModule$$$partition1(comparer$$15, f$$8, k$$18, acc$$7[0], acc$$7[1]); | ||
return SetTreeModule$$$partition1(comparer$$15, f$$8, s$$4.fields[0], acc_0, acc_1); | ||
} | ||
@@ -891,3 +808,3 @@ | ||
{ | ||
return acc$$7; | ||
return [acc_0, acc_1]; | ||
} | ||
@@ -897,12 +814,9 @@ | ||
{ | ||
const r$$15 = s$$4.fields[2]; | ||
const l$$15 = s$$4.fields[1]; | ||
const k$$17 = s$$4.fields[0]; | ||
const acc$$8 = SetTreeModule$$$partitionAux(comparer$$15, f$$8, r$$15, acc$$7[0], acc$$7[1]); | ||
const acc$$9 = SetTreeModule$$$partition1(comparer$$15, f$$8, k$$17, acc$$8[0], acc$$8[1]); | ||
$arg$$40 = comparer$$15; | ||
$arg$$41 = f$$8; | ||
$arg$$42 = l$$15; | ||
$arg$$43 = acc$$9[0]; | ||
$arg$$44 = acc$$9[1]; | ||
const acc$$8 = SetTreeModule$$$partitionAux(comparer$$15, f$$8, s$$4.fields[2], acc_0, acc_1); | ||
const acc$$9 = SetTreeModule$$$partition1(comparer$$15, f$$8, s$$4.fields[0], acc$$8[0], acc$$8[1]); | ||
$comparer$$15$$86 = comparer$$15; | ||
$f$$8$$87 = f$$8; | ||
$s$$4$$88 = s$$4.fields[1]; | ||
$acc_0$$89 = acc$$9[0]; | ||
$acc_1$$90 = acc$$9[1]; | ||
continue SetTreeModule$$$partitionAux; | ||
@@ -923,4 +837,3 @@ } | ||
{ | ||
const k2$$19 = s$$6.fields[0]; | ||
return new Choice(0, "Choice1Of2", [k2$$19, new SetTree$00601(0, "SetEmpty"), new SetTree$00601(0, "SetEmpty")]); | ||
return new Choice(0, "Choice1Of2", [s$$6.fields[0], new SetTree$00601(0, "SetEmpty"), new SetTree$00601(0, "SetEmpty")]); | ||
} | ||
@@ -935,16 +848,15 @@ | ||
{ | ||
const r$$16 = s$$6.fields[2]; | ||
const l$$16 = s$$6.fields[1]; | ||
const k2$$18 = s$$6.fields[0]; | ||
return new Choice(0, "Choice1Of2", [k2$$18, l$$16, r$$16]); | ||
return new Choice(0, "Choice1Of2", [s$$6.fields[0], s$$6.fields[1], s$$6.fields[2]]); | ||
} | ||
} | ||
} | ||
export function SetTreeModule$$$minimumElementAux(s$$7, n$$1) { | ||
export function SetTreeModule$$$minimumElementAux($s$$7$$95, $n$$1$$96) { | ||
SetTreeModule$$$minimumElementAux: while (true) { | ||
const s$$7 = $s$$7$$95, | ||
n$$1 = $n$$1$$96; | ||
switch (s$$7.tag) { | ||
case 2: | ||
{ | ||
const k$$20 = s$$7.fields[0]; | ||
return k$$20; | ||
return s$$7.fields[0]; | ||
} | ||
@@ -959,6 +871,4 @@ | ||
{ | ||
const l$$17 = s$$7.fields[1]; | ||
const k$$19 = s$$7.fields[0]; | ||
s$$7 = l$$17; | ||
n$$1 = k$$19; | ||
$s$$7$$95 = s$$7.fields[1]; | ||
$n$$1$$96 = s$$7.fields[0]; | ||
continue SetTreeModule$$$minimumElementAux; | ||
@@ -975,4 +885,3 @@ } | ||
{ | ||
const k$$22 = s$$8.fields[0]; | ||
return some(k$$22); | ||
return some(s$$8.fields[0]); | ||
} | ||
@@ -987,15 +896,15 @@ | ||
{ | ||
const l$$18 = s$$8.fields[1]; | ||
const k$$21 = s$$8.fields[0]; | ||
return some(SetTreeModule$$$minimumElementAux(l$$18, k$$21)); | ||
return some(SetTreeModule$$$minimumElementAux(s$$8.fields[1], s$$8.fields[0])); | ||
} | ||
} | ||
} | ||
export function SetTreeModule$$$maximumElementAux(s$$9, n$$2) { | ||
export function SetTreeModule$$$maximumElementAux($s$$9$$98, $n$$2$$99) { | ||
SetTreeModule$$$maximumElementAux: while (true) { | ||
const s$$9 = $s$$9$$98, | ||
n$$2 = $n$$2$$99; | ||
switch (s$$9.tag) { | ||
case 2: | ||
{ | ||
const k$$24 = s$$9.fields[0]; | ||
return k$$24; | ||
return s$$9.fields[0]; | ||
} | ||
@@ -1010,6 +919,4 @@ | ||
{ | ||
const r$$17 = s$$9.fields[2]; | ||
const k$$23 = s$$9.fields[0]; | ||
s$$9 = r$$17; | ||
n$$2 = k$$23; | ||
$s$$9$$98 = s$$9.fields[2]; | ||
$n$$2$$99 = s$$9.fields[0]; | ||
continue SetTreeModule$$$maximumElementAux; | ||
@@ -1026,4 +933,3 @@ } | ||
{ | ||
const k$$26 = s$$10.fields[0]; | ||
return some(k$$26); | ||
return some(s$$10.fields[0]); | ||
} | ||
@@ -1038,5 +944,3 @@ | ||
{ | ||
const r$$18 = s$$10.fields[2]; | ||
const k$$25 = s$$10.fields[0]; | ||
return some(SetTreeModule$$$maximumElementAux(r$$18, k$$25)); | ||
return some(SetTreeModule$$$maximumElementAux(s$$10.fields[2], s$$10.fields[0])); | ||
} | ||
@@ -1051,3 +955,3 @@ } | ||
} else { | ||
const k$$27 = value$$3(matchValue$$4); | ||
const k$$27 = value$$2(matchValue$$4); | ||
return k$$27; | ||
@@ -1062,3 +966,3 @@ } | ||
} else { | ||
const k$$28 = value$$3(matchValue$$5); | ||
const k$$28 = value$$2(matchValue$$5); | ||
return k$$28; | ||
@@ -1071,7 +975,9 @@ } | ||
}, Record); | ||
export function SetTreeModule$002ESetIterator$00601$reflection($gen$$48) { | ||
return record("Set.SetTreeModule.SetIterator`1", [$gen$$48], SetTreeModule$002ESetIterator$00601, () => [["stack", list(SetTree$00601$reflection($gen$$48))], ["started", bool]]); | ||
export function SetTreeModule$002ESetIterator$00601$reflection($gen$$103) { | ||
return record("Set.SetTreeModule.SetIterator`1", [$gen$$103], SetTreeModule$002ESetIterator$00601, () => [["stack", list(SetTree$00601$reflection($gen$$103))], ["started", bool]]); | ||
} | ||
export function SetTreeModule$$$collapseLHS(stack) { | ||
export function SetTreeModule$$$collapseLHS($stack$$104) { | ||
SetTreeModule$$$collapseLHS: while (true) { | ||
const stack = $stack$$104; | ||
if (stack.tail != null) { | ||
@@ -1081,11 +987,6 @@ if (stack.head.tag === 2) { | ||
} else if (stack.head.tag === 1) { | ||
const k$$29 = stack.head.fields[0]; | ||
const l$$19 = stack.head.fields[1]; | ||
const r$$19 = stack.head.fields[2]; | ||
const rest$$1 = stack.tail; | ||
stack = new List(l$$19, new List(SetTreeModule$$$SetOne(k$$29), new List(r$$19, rest$$1))); | ||
$stack$$104 = new List(stack.head.fields[1], new List(SetTreeModule$$$SetOne(stack.head.fields[0]), new List(stack.head.fields[2], stack.tail))); | ||
continue SetTreeModule$$$collapseLHS; | ||
} else { | ||
const rest = stack.tail; | ||
stack = rest; | ||
$stack$$104 = stack.tail; | ||
continue SetTreeModule$$$collapseLHS; | ||
@@ -1116,4 +1017,3 @@ } | ||
} else if (matchValue$$6.head.tag === 2) { | ||
const k$$30 = matchValue$$6.head.fields[0]; | ||
return k$$30; | ||
return matchValue$$6.head.fields[0]; | ||
} else { | ||
@@ -1133,4 +1033,3 @@ throw new Error("Please report error: Set iterator, unexpected stack for current"); | ||
} else if (matchValue$$7.head.tag === 2) { | ||
const rest$$2 = matchValue$$7.tail; | ||
i$$1.stack = SetTreeModule$$$collapseLHS(rest$$2); | ||
i$$1.stack = SetTreeModule$$$collapseLHS(matchValue$$7.tail); | ||
return !(i$$1.stack.tail == null); | ||
@@ -1150,4 +1049,4 @@ } else { | ||
}); | ||
export function SetTreeModule$002EmkIEnumerator$00601$reflection($gen$$49) { | ||
return type("Set.SetTreeModule.mkIEnumerator`1", [$gen$$49]); | ||
export function SetTreeModule$002EmkIEnumerator$00601$reflection($gen$$108) { | ||
return type("Set.SetTreeModule.mkIEnumerator`1", [$gen$$108]); | ||
} | ||
@@ -1189,5 +1088,8 @@ export function SetTreeModule$002EmkIEnumerator$00601$$$$002Ector$$Z5B395D56(s$$14) { | ||
} | ||
export function SetTreeModule$$$compareStacks(comparer$$17, l1, l2) { | ||
export function SetTreeModule$$$compareStacks($comparer$$17$$112, $l1$$113, $l2$$114) { | ||
SetTreeModule$$$compareStacks: while (true) { | ||
var $target$$50, t1$$6, t2$$6, n1k, n2k, t1$$7, t2$$7, n1k$$1, n2k$$1, n2r, t1$$8, t2$$8, emp, n1k$$2, n1r, n2k$$2, t1$$9, t2$$9, n1k$$3, n1r$$1, n2k$$3, n2r$$1, t1$$10, t2$$10, n1k$$4, t1$$11, n1k$$5, n1l, n1r$$2, t1$$12, n2k$$4, t2$$11, n2k$$5, n2l, n2r$$2, t2$$12; | ||
const comparer$$17 = $comparer$$17$$112, | ||
l1 = $l1$$113, | ||
l2 = $l2$$114; | ||
var $target$$115, t1$$6, t2$$6, n1k, n2k, t1$$7, t2$$7, n1k$$1, n2k$$1, n2r, t1$$8, t2$$8, emp, n1k$$2, n1r, n2k$$2, t1$$9, t2$$9, n1k$$3, n1r$$1, n2k$$3, n2r$$1, t1$$10, t2$$10, n1k$$4, t1$$11, n1k$$5, n1l, n1r$$2, t1$$12, n2k$$4, t2$$11, n2k$$5, n2l, n2r$$2, t2$$12; | ||
@@ -1198,3 +1100,3 @@ if (l1.tail != null) { | ||
if (l1.head.tag === 2) { | ||
$target$$50 = 4; | ||
$target$$115 = 4; | ||
n1k = l1.head.fields[0]; | ||
@@ -1206,3 +1108,3 @@ n2k = l2.head.fields[0]; | ||
if (l1.head.fields[1].tag === 0) { | ||
$target$$50 = 6; | ||
$target$$115 = 6; | ||
emp = l1.head.fields[1]; | ||
@@ -1215,3 +1117,3 @@ n1k$$2 = l1.head.fields[0]; | ||
} else { | ||
$target$$50 = 9; | ||
$target$$115 = 9; | ||
n1k$$5 = l1.head.fields[0]; | ||
@@ -1223,3 +1125,3 @@ n1l = l1.head.fields[1]; | ||
} else { | ||
$target$$50 = 10; | ||
$target$$115 = 10; | ||
n2k$$4 = l2.head.fields[0]; | ||
@@ -1231,3 +1133,3 @@ t2$$11 = l2.tail; | ||
if (l1.head.tag === 2) { | ||
$target$$50 = 5; | ||
$target$$115 = 5; | ||
n1k$$1 = l1.head.fields[0]; | ||
@@ -1240,3 +1142,3 @@ n2k$$1 = l2.head.fields[0]; | ||
if (l1.head.fields[1].tag === 0) { | ||
$target$$50 = 7; | ||
$target$$115 = 7; | ||
n1k$$3 = l1.head.fields[0]; | ||
@@ -1249,3 +1151,3 @@ n1r$$1 = l1.head.fields[2]; | ||
} else { | ||
$target$$50 = 9; | ||
$target$$115 = 9; | ||
n1k$$5 = l1.head.fields[0]; | ||
@@ -1257,3 +1159,3 @@ n1l = l1.head.fields[1]; | ||
} else { | ||
$target$$50 = 11; | ||
$target$$115 = 11; | ||
n2k$$5 = l2.head.fields[0]; | ||
@@ -1265,7 +1167,7 @@ n2l = l2.head.fields[1]; | ||
} else if (l1.head.tag === 2) { | ||
$target$$50 = 8; | ||
$target$$115 = 8; | ||
n1k$$4 = l1.head.fields[0]; | ||
t1$$11 = l1.tail; | ||
} else if (l1.head.tag === 1) { | ||
$target$$50 = 9; | ||
$target$$115 = 9; | ||
n1k$$5 = l1.head.fields[0]; | ||
@@ -1276,3 +1178,3 @@ n1l = l1.head.fields[1]; | ||
} else { | ||
$target$$50 = 11; | ||
$target$$115 = 11; | ||
n2k$$5 = l2.head.fields[0]; | ||
@@ -1284,7 +1186,7 @@ n2l = l2.head.fields[1]; | ||
} else if (l1.head.tag === 2) { | ||
$target$$50 = 8; | ||
$target$$115 = 8; | ||
n1k$$4 = l1.head.fields[0]; | ||
t1$$11 = l1.tail; | ||
} else if (l1.head.tag === 1) { | ||
$target$$50 = 9; | ||
$target$$115 = 9; | ||
n1k$$5 = l1.head.fields[0]; | ||
@@ -1295,3 +1197,3 @@ n1l = l1.head.fields[1]; | ||
} else { | ||
$target$$50 = 3; | ||
$target$$115 = 3; | ||
t1$$6 = l1.tail; | ||
@@ -1301,11 +1203,11 @@ t2$$6 = l2.tail; | ||
} else { | ||
$target$$50 = 2; | ||
$target$$115 = 2; | ||
} | ||
} else if (l2.tail != null) { | ||
$target$$50 = 1; | ||
$target$$115 = 1; | ||
} else { | ||
$target$$50 = 0; | ||
$target$$115 = 0; | ||
} | ||
switch ($target$$50) { | ||
switch ($target$$115) { | ||
case 0: | ||
@@ -1328,6 +1230,5 @@ { | ||
{ | ||
const $comparer$$17$$51 = comparer$$17; | ||
comparer$$17 = $comparer$$17$$51; | ||
l1 = t1$$6; | ||
l2 = t2$$6; | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = t1$$6; | ||
$l2$$114 = t2$$6; | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1343,6 +1244,5 @@ } | ||
} else { | ||
const $comparer$$17$$52 = comparer$$17; | ||
comparer$$17 = $comparer$$17$$52; | ||
l1 = t1$$7; | ||
l2 = t2$$7; | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = t1$$7; | ||
$l2$$114 = t2$$7; | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1359,6 +1259,5 @@ } | ||
} else { | ||
const $comparer$$17$$53 = comparer$$17; | ||
comparer$$17 = $comparer$$17$$53; | ||
l1 = new List(new SetTree$00601(0, "SetEmpty"), t1$$8); | ||
l2 = new List(n2r, t2$$8); | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = new List(new SetTree$00601(0, "SetEmpty"), t1$$8); | ||
$l2$$114 = new List(n2r, t2$$8); | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1375,6 +1274,5 @@ } | ||
} else { | ||
const $comparer$$17$$54 = comparer$$17; | ||
comparer$$17 = $comparer$$17$$54; | ||
l1 = new List(n1r, t1$$9); | ||
l2 = new List(emp, t2$$9); | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = new List(n1r, t1$$9); | ||
$l2$$114 = new List(emp, t2$$9); | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1391,6 +1289,5 @@ } | ||
} else { | ||
const $comparer$$17$$55 = comparer$$17; | ||
comparer$$17 = $comparer$$17$$55; | ||
l1 = new List(n1r$$1, t1$$10); | ||
l2 = new List(n2r$$1, t2$$10); | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = new List(n1r$$1, t1$$10); | ||
$l2$$114 = new List(n2r$$1, t2$$10); | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1402,7 +1299,5 @@ } | ||
{ | ||
const $comparer$$17$$56 = comparer$$17; | ||
const $l2$$57 = l2; | ||
comparer$$17 = $comparer$$17$$56; | ||
l1 = new List(new SetTree$00601(0, "SetEmpty"), new List(SetTreeModule$$$SetOne(n1k$$4), t1$$11)); | ||
l2 = $l2$$57; | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = new List(new SetTree$00601(0, "SetEmpty"), new List(SetTreeModule$$$SetOne(n1k$$4), t1$$11)); | ||
$l2$$114 = l2; | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1413,7 +1308,5 @@ } | ||
{ | ||
const $comparer$$17$$58 = comparer$$17; | ||
const $l2$$59 = l2; | ||
comparer$$17 = $comparer$$17$$58; | ||
l1 = new List(n1l, new List(SetTreeModule$$$SetNode(n1k$$5, new SetTree$00601(0, "SetEmpty"), n1r$$2, 0), t1$$12)); | ||
l2 = $l2$$59; | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = new List(n1l, new List(SetTreeModule$$$SetNode(n1k$$5, new SetTree$00601(0, "SetEmpty"), n1r$$2, 0), t1$$12)); | ||
$l2$$114 = l2; | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1424,7 +1317,5 @@ } | ||
{ | ||
const $comparer$$17$$60 = comparer$$17; | ||
const $l1$$61 = l1; | ||
comparer$$17 = $comparer$$17$$60; | ||
l1 = $l1$$61; | ||
l2 = new List(new SetTree$00601(0, "SetEmpty"), new List(SetTreeModule$$$SetOne(n2k$$4), t2$$11)); | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = l1; | ||
$l2$$114 = new List(new SetTree$00601(0, "SetEmpty"), new List(SetTreeModule$$$SetOne(n2k$$4), t2$$11)); | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1435,7 +1326,5 @@ } | ||
{ | ||
const $comparer$$17$$62 = comparer$$17; | ||
const $l1$$63 = l1; | ||
comparer$$17 = $comparer$$17$$62; | ||
l1 = $l1$$63; | ||
l2 = new List(n2l, new List(SetTreeModule$$$SetNode(n2k$$5, new SetTree$00601(0, "SetEmpty"), n2r$$2, 0), t2$$12)); | ||
$comparer$$17$$112 = comparer$$17; | ||
$l1$$113 = l1; | ||
$l2$$114 = new List(n2l, new List(SetTreeModule$$$SetNode(n2k$$5, new SetTree$00601(0, "SetEmpty"), n2r$$2, 0), t2$$12)); | ||
continue SetTreeModule$$$compareStacks; | ||
@@ -1464,9 +1353,11 @@ } | ||
} | ||
export function SetTreeModule$$$loop(m$$8, acc$$10) { | ||
export function SetTreeModule$$$loop($m$$8$$120, $acc$$10$$121) { | ||
SetTreeModule$$$loop: while (true) { | ||
const m$$8 = $m$$8$$120, | ||
acc$$10 = $acc$$10$$121; | ||
switch (m$$8.tag) { | ||
case 2: | ||
{ | ||
const k$$32 = m$$8.fields[0]; | ||
return new List(k$$32, acc$$10); | ||
return new List(m$$8.fields[0], acc$$10); | ||
} | ||
@@ -1481,8 +1372,4 @@ | ||
{ | ||
const r$$20 = m$$8.fields[2]; | ||
const l$$20 = m$$8.fields[1]; | ||
const k$$31 = m$$8.fields[0]; | ||
const $acc$$10$$64 = acc$$10; | ||
m$$8 = l$$20; | ||
acc$$10 = new List(k$$31, SetTreeModule$$$loop(r$$20, $acc$$10$$64)); | ||
$m$$8$$120 = m$$8.fields[1]; | ||
$acc$$10$$121 = new List(m$$8.fields[0], SetTreeModule$$$loop(m$$8.fields[2], acc$$10)); | ||
continue SetTreeModule$$$loop; | ||
@@ -1505,11 +1392,12 @@ } | ||
} | ||
export function SetTreeModule$$$mkFromEnumerator(comparer$$19, acc$$11, e) { | ||
export function SetTreeModule$$$mkFromEnumerator($comparer$$19$$126, $acc$$11$$127, $e$$128) { | ||
SetTreeModule$$$mkFromEnumerator: while (true) { | ||
const comparer$$19 = $comparer$$19$$126, | ||
acc$$11 = $acc$$11$$127, | ||
e = $e$$128; | ||
if (e.MoveNext()) { | ||
const $acc$$11$$66 = acc$$11; | ||
const $comparer$$19$$65 = comparer$$19; | ||
const $e$$67 = e; | ||
comparer$$19 = $comparer$$19$$65; | ||
acc$$11 = SetTreeModule$$$add($comparer$$19$$65, $e$$67.Current, $acc$$11$$66); | ||
e = $e$$67; | ||
$comparer$$19$$126 = comparer$$19; | ||
$acc$$11$$127 = SetTreeModule$$$add(comparer$$19, e.Current, acc$$11); | ||
$e$$128 = e; | ||
continue SetTreeModule$$$mkFromEnumerator; | ||
@@ -1548,4 +1436,4 @@ } else { | ||
}); | ||
export function FSharpSet$reflection($gen$$68) { | ||
return type("Set.FSharpSet", [$gen$$68]); | ||
export function FSharpSet$reflection($gen$$133) { | ||
return type("Set.FSharpSet", [$gen$$133]); | ||
} | ||
@@ -1585,13 +1473,15 @@ export function FSharpSet$$$$002Ector$$2528C5CB(comparer$$22, tree) { | ||
export function FSharpSet$$Partition$$Z1D55A0D7(s$$27, f$$11) { | ||
if (FSharpSet$$get_Tree(s$$27).tag === 0) { | ||
const matchValue$$10 = FSharpSet$$get_Tree(s$$27); | ||
if (matchValue$$10.tag === 0) { | ||
return [s$$27, s$$27]; | ||
} else { | ||
const patternInput$$6 = SetTreeModule$$$partition(FSharpSet$$get_Comparer(s$$27), f$$11, FSharpSet$$get_Tree(s$$27)); | ||
const t2$$13 = patternInput$$6[1]; | ||
const t1$$13 = patternInput$$6[0]; | ||
return [FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(s$$27), t1$$13), FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(s$$27), t2$$13)]; | ||
return [FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(s$$27), patternInput$$6[0]), FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(s$$27), patternInput$$6[1])]; | ||
} | ||
} | ||
export function FSharpSet$$Filter$$Z1D55A0D7(s$$28, f$$12) { | ||
if (FSharpSet$$get_Tree(s$$28).tag === 0) { | ||
const matchValue$$11 = FSharpSet$$get_Tree(s$$28); | ||
if (matchValue$$11.tag === 0) { | ||
return s$$28; | ||
@@ -1614,26 +1504,44 @@ } else { | ||
export function FSharpSet$$$op_Subtraction(a$$4, b$$5) { | ||
if (FSharpSet$$get_Tree(a$$4).tag === 0) { | ||
const matchValue$$12 = FSharpSet$$get_Tree(a$$4); | ||
if (matchValue$$12.tag === 0) { | ||
return a$$4; | ||
} else if (FSharpSet$$get_Tree(b$$5).tag === 0) { | ||
return a$$4; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$4), SetTreeModule$$$diff(FSharpSet$$get_Comparer(a$$4), FSharpSet$$get_Tree(a$$4), FSharpSet$$get_Tree(b$$5))); | ||
const matchValue$$13 = FSharpSet$$get_Tree(b$$5); | ||
if (matchValue$$13.tag === 0) { | ||
return a$$4; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$4), SetTreeModule$$$diff(FSharpSet$$get_Comparer(a$$4), FSharpSet$$get_Tree(a$$4), FSharpSet$$get_Tree(b$$5))); | ||
} | ||
} | ||
} | ||
export function FSharpSet$$$op_Addition(a$$5, b$$6) { | ||
if (FSharpSet$$get_Tree(b$$6).tag === 0) { | ||
const matchValue$$14 = FSharpSet$$get_Tree(b$$6); | ||
if (matchValue$$14.tag === 0) { | ||
return a$$5; | ||
} else if (FSharpSet$$get_Tree(a$$5).tag === 0) { | ||
return b$$6; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$5), SetTreeModule$$$union(FSharpSet$$get_Comparer(a$$5), FSharpSet$$get_Tree(a$$5), FSharpSet$$get_Tree(b$$6))); | ||
const matchValue$$15 = FSharpSet$$get_Tree(a$$5); | ||
if (matchValue$$15.tag === 0) { | ||
return b$$6; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$5), SetTreeModule$$$union(FSharpSet$$get_Comparer(a$$5), FSharpSet$$get_Tree(a$$5), FSharpSet$$get_Tree(b$$6))); | ||
} | ||
} | ||
} | ||
export function FSharpSet$$$Intersection$$Z3BE9BFE0(a$$6, b$$7) { | ||
if (FSharpSet$$get_Tree(b$$7).tag === 0) { | ||
const matchValue$$16 = FSharpSet$$get_Tree(b$$7); | ||
if (matchValue$$16.tag === 0) { | ||
return b$$7; | ||
} else if (FSharpSet$$get_Tree(a$$6).tag === 0) { | ||
return a$$6; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$6), SetTreeModule$$$intersection(FSharpSet$$get_Comparer(a$$6), FSharpSet$$get_Tree(a$$6), FSharpSet$$get_Tree(b$$7))); | ||
const matchValue$$17 = FSharpSet$$get_Tree(a$$6); | ||
if (matchValue$$17.tag === 0) { | ||
return a$$6; | ||
} else { | ||
return FSharpSet$$$$002Ector$$2528C5CB(FSharpSet$$get_Comparer(a$$6), SetTreeModule$$$intersection(FSharpSet$$get_Comparer(a$$6), FSharpSet$$get_Tree(a$$6), FSharpSet$$get_Tree(b$$7))); | ||
} | ||
} | ||
@@ -1673,7 +1581,8 @@ } | ||
FSharpSet.prototype.toString = function () { | ||
var strings; | ||
const this$ = this; | ||
return "set [" + join("; ", ...map$$1(function (x$$21) { | ||
return "set [" + (strings = map$$1(function (x$$21) { | ||
let copyOfStruct = x$$21; | ||
return String(copyOfStruct); | ||
}, this$)) + "]"; | ||
}, this$), (join("; ", ...strings))) + "]"; | ||
}; | ||
@@ -1683,7 +1592,2 @@ | ||
const this$$$1 = this; | ||
const combineHash = function combineHash(x$$22, y$$4) { | ||
return (x$$22 << 1) + y$$4 + 631; | ||
}; | ||
let res = 0; | ||
@@ -1693,3 +1597,5 @@ const e$$1 = SetTreeModule$$$mkIEnumerator(FSharpSet$$get_Tree(this$$$1)); | ||
while (e$$1.MoveNext()) { | ||
res = combineHash(res, structuralHash(e$$1.Current)); | ||
const x$$22 = res | 0; | ||
const y$$4 = structuralHash(e$$1.Current) | 0; | ||
res = (x$$22 << 1) + y$$4 + 631; | ||
} | ||
@@ -1860,2 +1766,6 @@ | ||
keys() { | ||
return SetTreeModule$$$toSeq(tree$$1); | ||
}, | ||
values() { | ||
@@ -1865,2 +1775,9 @@ return SetTreeModule$$$toSeq(tree$$1); | ||
entries() { | ||
const source = SetTreeModule$$$toSeq(tree$$1); | ||
return map$$1(function mapping(v) { | ||
return [v, v]; | ||
}, source); | ||
}, | ||
[Symbol.iterator]() { | ||
@@ -1877,25 +1794,25 @@ return toIterator(SetTreeModule$$$mkIEnumerator(tree$$1)); | ||
export function createMutable(source, comparer$$32) { | ||
const set = MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z79760D57(comparer$$32); | ||
iterate$$1(function (item) { | ||
MutableSet$002400601$0024$0024Add$0024$00242B595(set, item), null; | ||
}, source); | ||
export function createMutable(source$$1, comparer$$32) { | ||
const set = MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z6150332D(source$$1, comparer$$32); | ||
return set; | ||
} | ||
export function distinct(xs, comparer$$33) { | ||
return createMutable(xs, comparer$$33); | ||
return delay(function () { | ||
const set$$1 = MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z6150332D(empty$$1(), comparer$$33); | ||
return collect(function (x$$37) { | ||
return MutableSet$002400601$0024$0024Add$0024$00242B595(set$$1, x$$37) ? singleton$$1(x$$37) : empty$$1(); | ||
}, xs); | ||
}); | ||
} | ||
export function distinctBy(projection, xs$$1, comparer$$34) { | ||
const li$$1 = []; | ||
const hashSet = createMutable(empty$$1(), comparer$$34); | ||
iterate$$1(function (x$$37) { | ||
if (hashSet.add_(projection(x$$37))) { | ||
li$$1.push(x$$37); | ||
} | ||
}, xs$$1); | ||
return li$$1; | ||
return delay(function () { | ||
const set$$2 = MutableSet$002400601$0024$0024$0024$0024002Ector$0024$0024Z6150332D(empty$$1(), comparer$$34); | ||
return collect(function (x$$38) { | ||
return MutableSet$002400601$0024$0024Add$0024$00242B595(set$$2, projection(x$$38)) ? singleton$$1(x$$38) : empty$$1(); | ||
}, xs$$1); | ||
}); | ||
} | ||
export function unionWith(s1$$4, s2$$4) { | ||
return fold$$1(function folder(acc$$14, x$$38) { | ||
return acc$$14.add(x$$38); | ||
return fold$$1(function folder(acc$$14, x$$39) { | ||
return acc$$14.add(x$$39); | ||
}, s1$$4, s2$$4); | ||
@@ -1905,5 +1822,6 @@ } | ||
const s2$$6 = ofSeq(s2$$5, comparer$$35); | ||
iterate$$1(function (x$$39) { | ||
if (!FSharpSet$$Contains$$2B595(s2$$6, x$$39)) { | ||
s1$$5.delete(x$$39), null; | ||
iterate$$1(function (x$$40) { | ||
if (!FSharpSet$$Contains$$2B595(s2$$6, x$$40)) { | ||
const value = s1$$5.delete(x$$40); | ||
value, null; | ||
} | ||
@@ -1913,4 +1831,5 @@ }, s1$$5); | ||
export function exceptWith(s1$$6, s2$$7) { | ||
iterate$$1(function (x$$40) { | ||
s1$$6.delete(x$$40), null; | ||
iterate$$1(function (x$$41) { | ||
const value$$1 = s1$$6.delete(x$$41); | ||
value$$1, null; | ||
}, s2$$7); | ||
@@ -1917,0 +1836,0 @@ } |
@@ -31,6 +31,10 @@ import { declare } from "./Types.js"; | ||
} | ||
export function StringBuilder$$AppendFormat$$433E080(x$$1, fmt, o) { | ||
x$$1.buf.push(format(fmt, o)); | ||
export function StringBuilder$$Append$$244C7CD6(x$$1, c) { | ||
x$$1.buf.push(c); | ||
return x$$1; | ||
} | ||
export function StringBuilder$$AppendFormat$$433E080(x$$2, fmt, o) { | ||
x$$2.buf.push(format(fmt, o)); | ||
return x$$2; | ||
} | ||
@@ -37,0 +41,0 @@ StringBuilder.prototype.toString = function () { |
@@ -28,3 +28,3 @@ import { fromNumber, op_Division, op_Multiply, toNumber } from "./Long.js"; | ||
} | ||
export function fromTicks(ticks /* Long */) { | ||
export function fromTicks(ticks) { | ||
return toNumber(op_Division(ticks, 10000)); | ||
@@ -59,3 +59,3 @@ } | ||
} | ||
export function ticks(ts /* Long */) { | ||
export function ticks(ts) { | ||
return op_Multiply(fromNumber(ts), 10000); | ||
@@ -117,4 +117,4 @@ } | ||
if (firstColon > 0) { // process time part | ||
// WIP: (-?)(((\d+)\.)?([0-9]|0[0-9]|1[0-9]|2[0-3]):(\d+)(:\d+(\.\d{1,7})?)?|\d+(?:(?!\.))) | ||
// tslint:disable-next-line:max-line-length | ||
// WIP: (-?)(((\d+)\.)?([0-9]|0[0-9]|1[0-9]|2[0-3]):(\d+)(:\d+(\.\d{1,7})?)?|\d+(?:(?!\.))) | ||
const r = /^(-?)((\d+)\.)?(?:0*)([0-9]|0[0-9]|1[0-9]|2[0-3]):(?:0*)([0-5][0-9]|[0-9])(:(?:0*)([0-5][0-9]|[0-9]))?\.?(\d+)?$/.exec(str); | ||
@@ -125,3 +125,3 @@ if (r != null && r[4] != null && r[5] != null) { | ||
let s = 0; | ||
const sign = r[1] != null && r[1] === '-' ? -1 : 1; | ||
const sign = r[1] != null && r[1] === "-" ? -1 : 1; | ||
const h = +r[4]; | ||
@@ -128,0 +128,0 @@ const m = +r[5]; |
@@ -1,2 +0,2 @@ | ||
import { combineHashCodes, compare, compareArrays, equals, equalArrays, identityHash, structuralHash, numberHash } from "./Util.js"; | ||
import { combineHashCodes, compare, compareArrays, equalArrays, equals, identityHash, numberHash, structuralHash } from "./Util.js"; | ||
function sameType(x, y) { | ||
@@ -31,5 +31,6 @@ return y != null && Object.getPrototypeOf(x).constructor === Object.getPrototypeOf(y).constructor; | ||
export function SystemObject() { | ||
return; | ||
} | ||
SystemObject.prototype.toString = function () { | ||
return "{" + Object.keys(this).map(k => k + " = " + String(this[k])).join(";\n ") + "}"; | ||
return "{" + Object.keys(this).map((k) => k + " = " + String(this[k])).join(";\n ") + "}"; | ||
}; | ||
@@ -69,3 +70,3 @@ SystemObject.prototype.GetHashCode = function () { | ||
List.prototype.toString = function () { | ||
return "[" + Array.from(this).map(x => String(x)).join("; ") + "]"; | ||
return "[" + Array.from(this).map((x) => String(x)).join("; ") + "]"; | ||
}; | ||
@@ -109,3 +110,3 @@ List.prototype.toJSON = function () { | ||
else { | ||
return this.name + " (" + this.fields.map(x => String(x)).join(",") + ")"; | ||
return this.name + " (" + this.fields.map((x) => String(x)).join(",") + ")"; | ||
} | ||
@@ -119,3 +120,3 @@ }; | ||
Union.prototype.GetHashCode = function () { | ||
let hashes = this.fields.map(x => structuralHash(x)); | ||
const hashes = this.fields.map((x) => structuralHash(x)); | ||
hashes.splice(0, 0, numberHash(this.tag)); | ||
@@ -188,5 +189,6 @@ return combineHashCodes(hashes); | ||
export function Record() { | ||
return; | ||
} | ||
Record.prototype.toString = function () { | ||
return "{" + Object.keys(this).map(k => k + " = " + String(this[k])).join(";\n ") + "}"; | ||
return "{" + Object.keys(this).map((k) => k + " = " + String(this[k])).join(";\n ") + "}"; | ||
}; | ||
@@ -197,3 +199,3 @@ Record.prototype.toJSON = function () { | ||
Record.prototype.GetHashCode = function () { | ||
const hashes = Object.keys(this).map(k => structuralHash(this[k])); | ||
const hashes = Object.keys(this).map((k) => structuralHash(this[k])); | ||
return combineHashCodes(hashes); | ||
@@ -222,3 +224,3 @@ }; | ||
function getFSharpExceptionFieldNames(self) { | ||
return Object.keys(self).filter(k => k !== "message" && k !== "stack"); | ||
return Object.keys(self).filter((k) => k !== "message" && k !== "stack"); | ||
} | ||
@@ -238,3 +240,3 @@ export const FSharpException = declare(function FSharpException() { | ||
else { | ||
return this.message + " (" + fieldNames.map(k => String(this[k])).join(",") + ")"; | ||
return this.message + " (" + fieldNames.map((k) => String(this[k])).join(",") + ")"; | ||
} | ||
@@ -246,3 +248,3 @@ }; | ||
FSharpException.prototype.GetHashCode = function () { | ||
const hashes = getFSharpExceptionFieldNames(this).map(k => structuralHash(this[k])); | ||
const hashes = getFSharpExceptionFieldNames(this).map((k) => structuralHash(this[k])); | ||
return combineHashCodes(hashes); | ||
@@ -262,3 +264,3 @@ }; | ||
}, FSharpException); | ||
export const Attribute = declare(function Attribute() { }); | ||
export const Attribute = declare(function Attribute() { return; }); | ||
//# sourceMappingURL=Types.js.map |
@@ -487,3 +487,12 @@ // tslint:disable:ban-types | ||
export function count(col) { | ||
return isArray(col) ? col.length : col.size; | ||
if (isArray(col)) { | ||
return col.length; | ||
} | ||
else { | ||
let count = 0; | ||
for (const _ of col) { | ||
count++; | ||
} | ||
return count; | ||
} | ||
} | ||
@@ -570,3 +579,3 @@ export function clear(col) { | ||
f = f[CURRIED_KEY]; | ||
for (var i = 0; i < args.length; i++) { | ||
for (let i = 0; i < args.length; i++) { | ||
f = f(args[i]); | ||
@@ -620,10 +629,6 @@ } | ||
else { | ||
return function (arg) { | ||
return mapArg(res, arg, mappings, idx + 1); | ||
}; | ||
return (arg) => mapArg(res, arg, mappings, idx + 1); | ||
} | ||
} | ||
return function (arg) { | ||
return mapArg(fn, arg, mappings, 0); | ||
}; | ||
return (arg) => mapArg(fn, arg, mappings, 0); | ||
} | ||
@@ -630,0 +635,0 @@ export function addToDict(dict, k, v) { |
{ | ||
"name": "fable-standalone", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"main": "dist/bundle.min.js", | ||
@@ -5,0 +5,0 @@ "description": "Fable compiler", |
@@ -0,1 +1,5 @@ | ||
### 1.1.7 | ||
* fable-compiler 2.3.24 | ||
### 1.1.6 | ||
@@ -2,0 +6,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
20310
5672309