prelude.ts
Advanced tools
Comparing version 0.3.2 to 0.3.3
const Benchmark: any = require('benchmark'); | ||
import { Vector } from "../src/Vector" | ||
import { List } from "../src/List" | ||
import * as imm from 'immutable'; | ||
@@ -16,3 +18,3 @@ function compare(...items: Array<[string, ()=>any]>) { | ||
}) | ||
.run({ 'async': true }); | ||
.run(); | ||
} | ||
@@ -22,5 +24,49 @@ | ||
const getArray = (length:number) => Array.from({length}, () => Math.floor(Math.random() * length)); | ||
const array = getArray(200) | ||
const vec = Vector.ofIterable(array) | ||
const array = getArray(200); | ||
const vec = Vector.ofIterable(array); | ||
const list = List.ofIterable(array); | ||
const immList = imm.List(array); | ||
compare(['Vector.filter', () => vec.filter(x => x%2===0)], | ||
['Array.filter', () => array.filter(x => x%2===0)]); | ||
['Array.filter', () => array.filter(x => x%2===0)], | ||
['immList.filter', () => immList.filter(x => x%2===0)], | ||
['List.filter', () => list.filter(x => x%2===0)]); | ||
compare(['Vector.map', () => vec.map(x => x*2)], | ||
['Array.map', () => array.map(x => x*2)], | ||
['immList.map', () => immList.map(x => x*2)], | ||
['List.map', () => list.map(x => x*2)]); | ||
compare(['Vector.ofIterable', () => Vector.ofIterable(array)], | ||
['List.ofIterable', () => List.ofIterable(array)], | ||
['immList.ofIterable', () => imm.List(array)]); | ||
compare(['Vector.flatMap', () => vec.flatMap(x => Vector.of(1,2))], | ||
['List.flatMap', () => list.flatMap(x => List.of(1,2))], | ||
['immList.flatMap', () => immList.flatMap(x => imm.List([1,2]))]); | ||
compare(['Vector.reverse', () => vec.reverse()], | ||
['Array.reverse', () => array.reverse()], | ||
['immList.reverse', () => immList.reverse()], | ||
['List.reverse', () => list.reverse()]); | ||
compare(['Vector.groupBy', () => vec.groupBy(x => x%2)], | ||
['List.groupBy', () => list.groupBy(x => x%2)], | ||
['immList.groupBy', () => immList.groupBy(x => x%2)]); | ||
compare(['Vector.appendAll', () => vec.appendAll(vec)], | ||
['Array.appendAll', () => array.concat(array)], | ||
['immList.appendAll', () => immList.concat(immList)], | ||
['List.appendAll', () => list.appendAll(list)]); | ||
compare(['Vector.prependAll', () => vec.prependAll(vec)], | ||
['Array.prependAll', () => array.concat(array)], | ||
['List.prependAll', () => list.prependAll(list)]); | ||
compare(['Vector.foldLeft', () => vec.foldLeft(0, (acc,i)=>acc+i)], | ||
['Array.foldLeft', () => array.reduce((acc,i)=>acc+i)], | ||
['immList.foldLeft', () => immList.reduce((acc,i)=>acc+i,0)], | ||
['List.foldLeft', () => vec.foldLeft(0, (acc,i)=>acc+i)]); | ||
compare(['Vector.foldRight', () => vec.foldRight(0, (i,acc)=>acc+i)], | ||
['immList.foldRight', () => immList.reduceRight((acc,i)=>acc+i,0)], | ||
['List.foldRight', () => vec.foldRight(0, (i,acc)=>acc+i)]); |
@@ -5,2 +5,4 @@ "use strict"; | ||
var Vector_1 = require("../src/Vector"); | ||
var List_1 = require("../src/List"); | ||
var imm = require("immutable"); | ||
function compare() { | ||
@@ -22,3 +24,3 @@ var items = []; | ||
}) | ||
.run({ 'async': true }); | ||
.run(); | ||
} | ||
@@ -29,3 +31,14 @@ // https://stackoverflow.com/a/43044960/516188 | ||
var vec = Vector_1.Vector.ofIterable(array); | ||
compare(['Vector.filter', function () { return vec.filter(function (x) { return x % 2 === 0; }); }], ['Array.filter', function () { return array.filter(function (x) { return x % 2 === 0; }); }]); | ||
var list = List_1.List.ofIterable(array); | ||
var immList = imm.List(array); | ||
compare(['Vector.filter', function () { return vec.filter(function (x) { return x % 2 === 0; }); }], ['Array.filter', function () { return array.filter(function (x) { return x % 2 === 0; }); }], ['immList.filter', function () { return immList.filter(function (x) { return x % 2 === 0; }); }], ['List.filter', function () { return list.filter(function (x) { return x % 2 === 0; }); }]); | ||
compare(['Vector.map', function () { return vec.map(function (x) { return x * 2; }); }], ['Array.map', function () { return array.map(function (x) { return x * 2; }); }], ['immList.map', function () { return immList.map(function (x) { return x * 2; }); }], ['List.map', function () { return list.map(function (x) { return x * 2; }); }]); | ||
compare(['Vector.ofIterable', function () { return Vector_1.Vector.ofIterable(array); }], ['List.ofIterable', function () { return List_1.List.ofIterable(array); }], ['immList.ofIterable', function () { return imm.List(array); }]); | ||
compare(['Vector.flatMap', function () { return vec.flatMap(function (x) { return Vector_1.Vector.of(1, 2); }); }], ['List.flatMap', function () { return list.flatMap(function (x) { return List_1.List.of(1, 2); }); }], ['immList.flatMap', function () { return immList.flatMap(function (x) { return imm.List([1, 2]); }); }]); | ||
compare(['Vector.reverse', function () { return vec.reverse(); }], ['Array.reverse', function () { return array.reverse(); }], ['immList.reverse', function () { return immList.reverse(); }], ['List.reverse', function () { return list.reverse(); }]); | ||
compare(['Vector.groupBy', function () { return vec.groupBy(function (x) { return x % 2; }); }], ['List.groupBy', function () { return list.groupBy(function (x) { return x % 2; }); }], ['immList.groupBy', function () { return immList.groupBy(function (x) { return x % 2; }); }]); | ||
compare(['Vector.appendAll', function () { return vec.appendAll(vec); }], ['Array.appendAll', function () { return array.concat(array); }], ['immList.appendAll', function () { return immList.concat(immList); }], ['List.appendAll', function () { return list.appendAll(list); }]); | ||
compare(['Vector.prependAll', function () { return vec.prependAll(vec); }], ['Array.prependAll', function () { return array.concat(array); }], ['List.prependAll', function () { return list.prependAll(list); }]); | ||
compare(['Vector.foldLeft', function () { return vec.foldLeft(0, function (acc, i) { return acc + i; }); }], ['Array.foldLeft', function () { return array.reduce(function (acc, i) { return acc + i; }); }], ['immList.foldLeft', function () { return immList.reduce(function (acc, i) { return acc + i; }, 0); }], ['List.foldLeft', function () { return vec.foldLeft(0, function (acc, i) { return acc + i; }); }]); | ||
compare(['Vector.foldRight', function () { return vec.foldRight(0, function (i, acc) { return acc + i; }); }], ['immList.foldRight', function () { return immList.reduceRight(function (acc, i) { return acc + i; }, 0); }], ['List.foldRight', function () { return vec.foldRight(0, function (i, acc) { return acc + i; }); }]); | ||
//# sourceMappingURL=bench.js.map |
@@ -5,4 +5,11 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.prelude_ts_object_formatters = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var olStyle = "list-style-type:none; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; margin-left: 12px"; | ||
function getWithToArrayBody(elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
} | ||
var VectorHandler = /** @class */ (function () { | ||
function VectorHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
@@ -18,8 +25,2 @@ VectorHandler.prototype.isElement = function (object) { | ||
}; | ||
VectorHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return VectorHandler; | ||
@@ -30,5 +31,6 @@ }()); | ||
function StreamHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
StreamHandler.prototype.isElement = function (object) { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
return object.hashCode && object.equals && object.sortBy && object.cycle && object.toVector; | ||
}; | ||
@@ -43,12 +45,24 @@ StreamHandler.prototype.getHeader = function (object) { | ||
}; | ||
StreamHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return StreamHandler; | ||
}()); | ||
var ListHandler = /** @class */ (function () { | ||
function ListHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
ListHandler.prototype.isElement = function (object) { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
}; | ||
ListHandler.prototype.getHeader = function (object) { | ||
// not displaying the length for streams in case | ||
// of infinite streams. the user can expand if needed. | ||
return ["span", {}, "List(" + object.length() + ")"]; | ||
}; | ||
ListHandler.prototype.hasBody = function (elt) { | ||
return !elt.isEmpty(); | ||
}; | ||
return ListHandler; | ||
}()); | ||
var HashSetHandler = /** @class */ (function () { | ||
function HashSetHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
@@ -64,8 +78,2 @@ HashSetHandler.prototype.isElement = function (object) { | ||
}; | ||
HashSetHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return HashSetHandler; | ||
@@ -101,2 +109,3 @@ }()); | ||
new StreamHandler(), | ||
new ListHandler(), | ||
new HashSetHandler(), | ||
@@ -103,0 +112,0 @@ new HashMapHandler()]; |
@@ -8,2 +8,3 @@ interface ElementHandler { | ||
declare const olStyle = "list-style-type:none; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; margin-left: 12px"; | ||
declare function getWithToArrayBody(elt: any): any; | ||
declare class VectorHandler implements ElementHandler { | ||
@@ -13,3 +14,3 @@ isElement(object: any): boolean; | ||
hasBody(elt: any): boolean; | ||
getBody(elt: any): any; | ||
getBody: typeof getWithToArrayBody; | ||
} | ||
@@ -20,4 +21,10 @@ declare class StreamHandler implements ElementHandler { | ||
hasBody(elt: any): boolean; | ||
getBody(elt: any): any; | ||
getBody: typeof getWithToArrayBody; | ||
} | ||
declare class ListHandler implements ElementHandler { | ||
isElement(object: any): boolean; | ||
getHeader(object: any): any; | ||
hasBody(elt: any): boolean; | ||
getBody: typeof getWithToArrayBody; | ||
} | ||
declare class HashSetHandler implements ElementHandler { | ||
@@ -27,3 +34,3 @@ isElement(object: any): boolean; | ||
hasBody(elt: any): boolean; | ||
getBody(elt: any): any; | ||
getBody: typeof getWithToArrayBody; | ||
} | ||
@@ -30,0 +37,0 @@ declare class HashMapHandler implements ElementHandler { |
"use strict"; | ||
// http://bit.ly/object-formatters | ||
var olStyle = "list-style-type:none; padding-left: 0px; margin-top: 0px; margin-bottom: 0px; margin-left: 12px"; | ||
function getWithToArrayBody(elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
} | ||
var VectorHandler = /** @class */ (function () { | ||
function VectorHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
@@ -16,8 +23,2 @@ VectorHandler.prototype.isElement = function (object) { | ||
}; | ||
VectorHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return VectorHandler; | ||
@@ -28,5 +29,6 @@ }()); | ||
function StreamHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
StreamHandler.prototype.isElement = function (object) { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
return object.hashCode && object.equals && object.sortBy && object.cycle && object.toVector; | ||
}; | ||
@@ -41,12 +43,24 @@ StreamHandler.prototype.getHeader = function (object) { | ||
}; | ||
StreamHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return StreamHandler; | ||
}()); | ||
var ListHandler = /** @class */ (function () { | ||
function ListHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
ListHandler.prototype.isElement = function (object) { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
}; | ||
ListHandler.prototype.getHeader = function (object) { | ||
// not displaying the length for streams in case | ||
// of infinite streams. the user can expand if needed. | ||
return ["span", {}, "List(" + object.length() + ")"]; | ||
}; | ||
ListHandler.prototype.hasBody = function (elt) { | ||
return !elt.isEmpty(); | ||
}; | ||
return ListHandler; | ||
}()); | ||
var HashSetHandler = /** @class */ (function () { | ||
function HashSetHandler() { | ||
this.getBody = getWithToArrayBody; | ||
} | ||
@@ -62,8 +76,2 @@ HashSetHandler.prototype.isElement = function (object) { | ||
}; | ||
HashSetHandler.prototype.getBody = function (elt) { | ||
return ["ol", | ||
{ "style": olStyle }].concat(elt.toArray().map(function (x, idx) { return ["li", {}, | ||
["span", { "style": "color: rgb(136, 19, 145);" }, idx + ": "], | ||
["object", { "object": x }]]; })); | ||
}; | ||
return HashSetHandler; | ||
@@ -99,2 +107,3 @@ }()); | ||
new StreamHandler(), | ||
new ListHandler(), | ||
new HashSetHandler(), | ||
@@ -101,0 +110,0 @@ new HashMapHandler()]; |
export * from "./Option"; | ||
export * from "./Lazy"; | ||
export * from "./Vector"; | ||
export * from "./List"; | ||
export * from "./HashMap"; | ||
@@ -5,0 +6,0 @@ export * from "./HashSet"; |
@@ -14,2 +14,3 @@ "use strict"; | ||
__export(require("./Vector")); | ||
__export(require("./List")); | ||
__export(require("./HashMap")); | ||
@@ -16,0 +17,0 @@ __export(require("./HashSet")); |
/** | ||
* prelude.ts v0.3.2 | ||
* prelude.ts v0.3.3 | ||
* https://github.com/emmanueltouzery/prelude.ts | ||
@@ -7,2 +7,2 @@ * (c) 2017-2017 Emmanuel Touzery | ||
*/ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).prelude_ts=t()}}(function(){return function t(n,r,e){function o(u,a){if(!r[u]){if(!n[u]){var p="function"==typeof require&&require;if(!a&&p)return p(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=r[u]={exports:{}};n[u][0].call(s.exports,function(t){var r=n[u][1][t];return o(r||t)},s,s.exports,t,n,r,e)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<e.length;u++)o(e[u]);return o}({1:[function(t,n,r){"use strict";function e(t){return void 0!==t.equals}function o(t){var n,r=0;if(0===t.length)return r;for(n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n),r|=0;return r}function i(t){return t?e(t)?t.hashCode():"number"==typeof t?t:o(t+""):0}function u(t){return Array.isArray(t)?"["+t.map(u)+"]":"string"==typeof t?"'"+t+"'":t+""}r.__esModule=!0;var a=t("./Option");r.hasEquals=e,r.fieldsHashCode=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=1,e=0,o=t;e<o.length;e++)r=37*r+i(o[e]);return r},r.stringHashCode=o,r.areEqual=function(t,n){return null===t!=n!==null&&(null===t||null===n||(e(t)?t.equals(n):t===n))},r.getHashCode=i,r.hasTrueEquality=function(t){if(!t)return a.Option.none();if(t.equals)return a.Option.of(!0);switch(t.constructor){case String:case Number:case Boolean:return a.Option.of(!0)}return a.Option.of(!1)},r.toStringHelper=u},{"./Option":6}],2:[function(t,n,r){"use strict";function e(t){o(t)}r.__esModule=!0;var o=function(t){throw t};r.setContractViolationAction=function(t){o=t},r.reportContractViolation=e,r.contractTrueEquality=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var u=i[o];u&&u.hasTrueEquality&&!u.hasTrueEquality()&&e(t+": element doesn't support true equality: "+u)}}},{}],3:[function(t,n,r){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}();r.__esModule=!0;var o=t("./Comparison"),i=t("./Contract"),u=t("./Option"),a=t("./HashSet"),p=t("./Vector"),f=t("hamt_plus"),s=function(){function t(t){this.hamt=t}return t.empty=function(){return h},t.of=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.ofIterable(n)},t.ofIterable=function(n){for(var r=t.empty(),e=n[Symbol.iterator](),o=e.next();!o.done;)r=r.put(o.value[0],o.value[1]),o=e.next();return r},t.prototype.get=function(t){return u.Option.of(this.hamt.get(t))},t.prototype[Symbol.iterator]=function(){return this.hamt.entries()},t.prototype.hasTrueEquality=function(){return u.Option.of(this.hamt.entries().next().value).map(function(t){return t[0]}).hasTrueEquality()&&u.Option.of(this.hamt.entries().next().value).map(function(t){return t[1]}).hasTrueEquality()},t.prototype.put=function(n,r){return new t(this.hamt.set(n,r))},t.prototype.putWithMerge=function(n,r,e){return new t(this.hamt.modify(n,function(t){return void 0===t?r:e(t,r)}))},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?u.Option.of(this.hamt.entries().next().value):u.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.keySet=function(){return a.HashSet.ofIterable(this.hamt.keys())},t.prototype.valueIterable=function(){return this.hamt.values()},t.prototype.mergeWith=function(t,n){for(var r=t[Symbol.iterator](),e=this,o=r.next();!o.done;)e=e.putWithMerge(o.value[0],o.value[1],n),o=r.next();return e},t.prototype.map=function(n){return this.hamt.fold(function(t,r,e){var o=n(e,r),i=o[0],u=o[1];return t.put(i,u)},t.empty())},t.prototype.mapValues=function(n){return this.hamt.fold(function(t,r,e){return t.put(e,n(r))},t.empty())},t.prototype.flatMap=function(n){return this.foldLeft(t.empty(),function(t,r){return t.mergeWith(n(r[0],r[1]),function(t,n){return n})})},t.prototype.allMatch=function(t){for(var n=this.hamt.entries(),r=n.next();!r.done;){if(!t(r.value[0],r.value[1]))return!1;r=n.next()}return!0},t.prototype.anyMatch=function(t){for(var n=this.hamt.entries(),r=n.next();!r.done;){if(t(r.value[0],r.value[1]))return!0;r=n.next()}return!1},t.prototype.contains=function(t){return o.areEqual(this.hamt.get(t[0]),t[1])},t.prototype.filter=function(n){return this.hamt.fold(function(t,r,e){return n(e,r)?t.put(e,r):t},t.empty())},t.prototype.fold=function(t,n){return this.foldLeft(t,n)},t.prototype.foldLeft=function(t,n){return this.hamt.fold(function(t,r,e){return n(t,[e,r])},t)},t.prototype.foldRight=function(t,n){return this.foldLeft(t,function(t,r){return n(r,t)})},t.prototype.toArray=function(){return this.hamt.fold(function(t,n,r){return t.push([r,n]),t},[])},t.prototype.toVector=function(){return this.hamt.fold(function(t,n,r){return t.append([r,n])},p.Vector.empty())},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){if(!t||!t.valueIterable)return!1;i.contractTrueEquality("HashMap.equals",this,t);var n=this.hamt.size;if(0===t.length()&&0===n)return!0;if(n!==t.length())return!1;for(var r=0,e=Array.from(this.hamt.keys());r<e.length;r++){var u=e[r],a=this.hamt.get(u),p=t.get(u).getOrUndefined();if(void 0===a||void 0===p)return!1;if(!o.areEqual(a,p))return!1}return!0},t.prototype.hashCode=function(){return this.hamt.fold(function(t,n,r){return o.getHashCode(r)+o.getHashCode(n)},0)},t.prototype.toString=function(){return"{"+this.hamt.fold(function(t,n,r){return t.push(r+" => "+o.toStringHelper(n)),t},[]).join(", ")+"}"},t.prototype.inspect=function(){return this.toString()},t}();r.HashMap=s;var h=new(function(t){function n(){return t.call(this,{})||this}return e(n,t),n.prototype.get=function(t){return u.none},n.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},n.prototype.put=function(t,n){return i.contractTrueEquality("Error building a HashMap",t),new s(o.hasEquals(t)?f.make({hash:function(t){return t.hashCode()},keyEq:function(t,n){return t.equals(n)}}).set(t,n):f.make().set(t,n))},n.prototype.hasTrueEquality=function(){return!0},n.prototype.putWithMerge=function(t,n,r){return this.put(t,n)},n.prototype.length=function(){return 0},n.prototype.single=function(){return u.Option.none()},n.prototype.isEmpty=function(){return!0},n.prototype.keySet=function(){return a.HashSet.empty()},n.prototype.valueIterable=function(){return t={},t[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},t;var t},n.prototype.mergeWith=function(t,n){return s.ofIterable(t)},n.prototype.map=function(t){return s.empty()},n.prototype.mapValues=function(t){return s.empty()},n.prototype.allMatch=function(t){return!0},n.prototype.anyMatch=function(t){return!1},n.prototype.contains=function(t){return!1},n.prototype.filter=function(t){return this},n.prototype.foldLeft=function(t,n){return t},n.prototype.toArray=function(){return[]},n.prototype.toVector=function(){return p.Vector.empty()},n.prototype.equals=function(t){return!(!t||!t.valueIterable)&&(t===h||0===t.length())},n.prototype.hashCode=function(){return 0},n.prototype.toString=function(){return""},n}(s))},{"./Comparison":1,"./Contract":2,"./HashSet":4,"./Option":6,"./Vector":10,hamt_plus:12}],4:[function(t,n,r){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}();r.__esModule=!0;var o=t("./Vector"),i=t("./Option"),u=t("./Comparison"),a=t("./Contract"),p=t("hamt_plus"),f=function(){function t(t){this.hamt=t}return t.empty=function(){return s},t.ofIterable=function(n){return new t(p.empty).addAll(n)},t.of=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.ofIterable(n)},t.prototype[Symbol.iterator]=function(){return this.hamt.keys()},t.prototype.add=function(n){return new t(this.hamt.set(n,n))},t.prototype.addAll=function(n){return new t(this.hamt.mutate(function(t){var r=n[Symbol.iterator](),e=r.next();for(e.done||a.contractTrueEquality("Error building a HashSet",e.value);!e.done;)t.set(e.value,e.value),e=r.next()}))},t.prototype.contains=function(t){return this.hamt.has(t)},t.prototype.map=function(n){return this.hamt.fold(function(t,r,e){return t.add(n(r))},t.empty())},t.prototype.mapOption=function(n){return this.hamt.fold(function(t,r,e){var o=n(r);return o.isSome()?t.add(o.getOrThrow()):t},t.empty())},t.prototype.flatMap=function(n){return this.foldLeft(t.empty(),function(t,r){return t.addAll(n(r))})},t.prototype.filter=function(n){return this.hamt.fold(function(t,r,e){return n(r)?t.add(r):t},t.empty())},t.prototype.fold=function(t,n){return this.foldLeft(t,n)},t.prototype.foldLeft=function(t,n){return this.hamt.fold(function(t,r,e){return n(t,r)},t)},t.prototype.foldRight=function(t,n){return this.foldLeft(t,function(t,r){return n(r,t)})},t.prototype.toArray=function(){return Array.from(this.hamt.keys())},t.prototype.toVector=function(){return o.Vector.ofIterable(this.hamt.keys())},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?i.Option.of(this.hamt.keys().next().value):i.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.diff=function(n){return new t(this.hamt.fold(function(t,r,e){return n.contains(e)?t:t.set(e,e)},p.empty))},t.prototype.intersect=function(n){return new t(this.hamt.fold(function(t,r,e){return n.contains(e)?t.set(e,e):t},p.empty))},t.prototype.removeAll=function(n){return this.diff(t.ofIterable(n))},t.prototype.allMatch=function(t){for(var n=this.hamt.values(),r=n.next();!r.done;){if(!t(r.value))return!1;r=n.next()}return!0},t.prototype.anyMatch=function(t){for(var n=this.hamt.values(),r=n.next();!r.done;){if(t(r.value))return!0;r=n.next()}return!1},t.prototype.partition=function(n){for(var r=t.empty(),e=t.empty(),o=this.hamt.values(),i=o.next();!i.done;)n(i.value)?r=r.add(i.value):e=e.add(i.value),i=o.next();return[r,e]},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){var n=this.hamt.size;if(t===s&&0===n)return!0;if(!t||!t.hamt)return!1;if(n!==t.hamt.size)return!1;a.contractTrueEquality("HashSet.equals",this,t);for(var r=0,e=Array.from(this.hamt.keys());r<e.length;r++){var o=e[r],i=t.hamt.get(o);if(void 0===i)return!1;if(!u.areEqual(o,i))return!1}return!0},t.prototype.hashCode=function(){return this.hamt.fold(function(t,n,r){return u.getHashCode(r)},0)},t.prototype.toString=function(){return"{"+this.mkString(", ")+"}"},t.prototype.inspect=function(){return this.toString()},t.prototype.mkString=function(t){return this.hamt.fold(function(t,n,r){return t.push(u.toStringHelper(r)),t},[]).join(t)},t}();r.HashSet=f;var s=new(function(t){function n(){return t.call(this,{})||this}return e(n,t),n.prototype.add=function(t){return a.contractTrueEquality("Error building a HashSet",t),new f(u.hasEquals(t)?p.make({hash:function(t){return t.hashCode()},keyEq:function(t,n){return t.equals(n)}}).set(t,t):p.make().set(t,t))},n.prototype.addAll=function(t){return f.ofIterable(t)},n.prototype.contains=function(t){return!1},n.prototype.map=function(t){return s},n.prototype.mapOption=function(t){return s},n.prototype.filter=function(t){return this},n.prototype.foldLeft=function(t,n){return t},n.prototype.toArray=function(){return[]},n.prototype.toVector=function(){return o.Vector.empty()},n.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},n.prototype.length=function(){return 0},n.prototype.isEmpty=function(){return!0},n.prototype.diff=function(t){return this},n.prototype.intersect=function(t){return this},n.prototype.anyMatch=function(t){return!1},n.prototype.allMatch=function(t){return!0},n.prototype.partition=function(t){return[this,this]},n.prototype.equals=function(t){return!(!t||!t.length)&&(t===s||0===t.length())},n.prototype.hashCode=function(){return 0},n.prototype.toString=function(){return"{}"},n.prototype.mkString=function(t){return""},n}(f))},{"./Comparison":1,"./Contract":2,"./Option":6,"./Vector":10,hamt_plus:12}],5:[function(t,n,r){"use strict";r.__esModule=!0;var e=function(){function t(t){this.thunk=t}return t.of=function(n){return new t(n)},t.prototype.get=function(){return this.thunk&&(this.value=this.thunk(),this.thunk=void 0),this.value},t.prototype.isEvaluated=function(){return void 0===this.thunk},t}();r.Lazy=e},{}],6:[function(t,n,r){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}();r.__esModule=!0;var o=t("./Vector"),i=t("./Comparison"),u=t("./Contract"),a=function(){function t(){}return t.of=function(t){return void 0===t?r.none:new p(t)},t.none=function(){return r.none},t.sequence=function(n){for(var e=o.Vector.empty(),i=n[Symbol.iterator](),u=i.next();!u.done;){var a=u.value;if(a.isNone())return r.none;e=e.append(a.getOrThrow()),u=i.next()}return t.of(e)},t.liftA2=function(t){return function(n,r){return n.flatMap(function(n){return r.map(function(r){return t(n,r)})})}},t.prototype.hasTrueEquality=function(){return this.flatMap(function(n){return n&&n.hasTrueEquality?t.of(n.hasTrueEquality()):i.hasTrueEquality(n)}).getOrElse(!0)},t.prototype.transform=function(t){return t(this)},t}();r.Option=a;var p=function(t){function n(n){var r=t.call(this)||this;return r.value=n,r}return e(n,t),n.prototype.isSome=function(){return!0},n.prototype.isNone=function(){return!1},n.prototype.orElse=function(t){return this},n.prototype.getOrThrow=function(t){return this.value},n.prototype.contains=function(t){return t===this.value},n.prototype.getOrUndefined=function(){return this.value},n.prototype.getOrElse=function(t){return this.value},n.prototype.map=function(t){return a.of(t(this.value))},n.prototype.flatMap=function(t){return t(this.value)},n.prototype.filter=function(t){return t(this.value)?this:a.none()},n.prototype.ifPresent=function(t){return t(this.value),this},n.prototype.toVector=function(){return o.Vector.of(this.value)},n.prototype.equals=function(t){if(t===r.none||!t||!t.isSome)return!1;var n=t;return u.contractTrueEquality("Option.equals",this,n),i.areEqual(this.value,n.value)},n.prototype.hashCode=function(){return i.getHashCode(this.value)},n.prototype.toString=function(){return"Some("+i.toStringHelper(this.value)+")"},n.prototype.inspect=function(){return this.toString()},n}(a);r.Some=p;var f=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.isSome=function(){return!1},n.prototype.isNone=function(){return!0},n.prototype.orElse=function(t){return t},n.prototype.getOrThrow=function(t){throw t||"getOrThrow called on none!"},n.prototype.contains=function(t){return!1},n.prototype.getOrUndefined=function(){},n.prototype.getOrElse=function(t){return t},n.prototype.map=function(t){return r.none},n.prototype.flatMap=function(t){return r.none},n.prototype.filter=function(t){return r.none},n.prototype.ifPresent=function(t){return this},n.prototype.toVector=function(){return o.Vector.empty()},n.prototype.equals=function(t){return t===r.none},n.prototype.hashCode=function(){return 1},n.prototype.toString=function(){return"None()"},n.prototype.inspect=function(){return this.toString()},n}(a);r.None=f,r.none=new f},{"./Comparison":1,"./Contract":2,"./Vector":10}],7:[function(t,n,r){"use strict";r.__esModule=!0;var e=t("./Option");r.shuffle=function(t){for(var n,r,e=t.length;0!==e;)r=Math.floor(Math.random()*e),n=t[e-=1],t[e]=t[r],t[r]=n;return t},r.arrangeBy=function(t,n){return e.Option.of(t.groupBy(n).mapValues(function(t){return t.single()})).filter(function(t){return!t.anyMatch(function(t,n){return n.isNone()})}).map(function(t){return t.mapValues(function(t){return t.getOrThrow()})})},r.seqHasTrueEquality=function(t){return t.find(function(t){return null!=t}).hasTrueEquality()}},{"./Option":6}],8:[function(t,n,r){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}();r.__esModule=!0;var o=t("./Option"),i=t("./Vector"),u=t("./Comparison"),a=t("./Contract"),p=t("./HashMap"),f=t("./HashSet"),s=t("./Lazy"),h=t("./SeqHelpers"),c=function(){function t(){}return t.empty=function(){return m},t.of=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.ofIterable(n)},t.ofIterable=function(n){return t.ofArray(Array.from(n))},t.ofArray=function(n){if(0===n.length)return m;var r=n[0];return new l(r,s.Lazy.of(function(){return t.ofArray(n.slice(1))}))},t.iterate=function(n,r){return new l(n,s.Lazy.of(function(){return t.iterate(r(n),r)}))},t.continually=function(n){return new l(n(),s.Lazy.of(function(){return t.continually(n)}))},t.unfoldRight=function(n,r){var e=r(n);return e.isNone()?m:new l(e.getOrThrow()[0],s.Lazy.of(function(){return t.unfoldRight(e.getOrThrow()[1],r)}))},t.prototype.hasTrueEquality=function(){return h.seqHasTrueEquality(this)},t.prototype.fold=function(t,n){return this.foldLeft(t,n)},t.prototype.arrangeBy=function(t){return h.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(h.shuffle(this.toArray()))},t.prototype.sortOn=function(t){return this.sortBy(function(n,r){return t(n)-t(r)})},t.prototype.transform=function(t){return t(this)},t.prototype.inspect=function(){return this.toString()},t}();r.Stream=c;var y=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},n.prototype.length=function(){return 0},n.prototype.single=function(){return o.Option.none()},n.prototype.isEmpty=function(){return!0},n.prototype.head=function(){return o.Option.none()},n.prototype.tail=function(){return o.Option.none()},n.prototype.last=function(){return o.Option.none()},n.prototype.get=function(t){return o.Option.none()},n.prototype.find=function(t){return o.Option.none()},n.prototype.contains=function(t){return!1},n.prototype.take=function(t){return this},n.prototype.takeWhile=function(t){return this},n.prototype.drop=function(t){return this},n.prototype.dropWhile=function(t){return this},n.prototype.dropRight=function(t){return this},n.prototype.foldLeft=function(t,n){return t},n.prototype.foldRight=function(t,n){return t},n.prototype.zip=function(t){return m},n.prototype.reverse=function(){return this},n.prototype.partition=function(t){return[c.empty(),c.empty()]},n.prototype.groupBy=function(t){return p.HashMap.empty()},n.prototype.append=function(t){return c.of(t)},n.prototype.appendAll=function(t){return c.ofIterable(t)},n.prototype.appendStream=function(t){return t},n.prototype.prepend=function(t){return c.of(t)},n.prototype.prependAll=function(t){return c.ofIterable(t)},n.prototype.cycle=function(){return m},n.prototype.map=function(t){return m},n.prototype.mapOption=function(t){return m},n.prototype.flatMap=function(t){return m},n.prototype.allMatch=function(t){return!0},n.prototype.anyMatch=function(t){return!1},n.prototype.filter=function(t){return this},n.prototype.sortBy=function(t){return this},n.prototype.distinctBy=function(t){return this},n.prototype.forEach=function(t){return this},n.prototype.mkString=function(t){return""},n.prototype.toArray=function(){return[]},n.prototype.toVector=function(){return i.Vector.empty()},n.prototype.toMap=function(t){return p.HashMap.empty()},n.prototype.equals=function(t){return!!t&&t.isEmpty()},n.prototype.hashCode=function(){return 1},n.prototype.toString=function(){return"[]"},n}(c),l=function(t){function n(n,r){var e=t.call(this)||this;return e.value=n,e._tail=r,e}return e(n,t),n.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){if(t.isEmpty())return{done:!0,value:void 0};var n=t.head().getOrThrow();return t=t.tail().getOrThrow(),{done:!1,value:n}}}},n.prototype.length=function(){return this.foldLeft(0,function(t,n){return t+1})},n.prototype.single=function(){return this._tail.get().isEmpty()?o.Option.of(this.value):o.Option.none()},n.prototype.isEmpty=function(){return!1},n.prototype.head=function(){return o.Option.of(this.value)},n.prototype.tail=function(){return o.Option.of(this._tail.get())},n.prototype.last=function(){for(var t=this;;){var n=t.value;if((t=t._tail.get()).isEmpty())return o.Option.of(n)}},n.prototype.get=function(t){for(var n=this,r=0;!n.isEmpty();){if(r===t){var e=n.value;return o.Option.of(e)}n=n._tail.get(),++r}return o.Option.none()},n.prototype.find=function(t){for(var n=this;!n.isEmpty();){var r=n.value;if(t(r))return o.Option.of(r);n=n._tail.get()}return o.Option.none()},n.prototype.contains=function(t){return this.find(function(n){return u.areEqual(n,t)}).isSome()},n.prototype.take=function(t){var r=this;return t<1?m:new n(this.value,s.Lazy.of(function(){return r._tail.get().take(t-1)}))},n.prototype.takeWhile=function(t){var r=this;return t(this.value)?new n(this.value,s.Lazy.of(function(){return r._tail.get().takeWhile(t)})):m},n.prototype.drop=function(t){for(var n=t,r=this;n-- >0&&!r.isEmpty();)r=r._tail.get();return r},n.prototype.dropWhile=function(t){for(var n=this;!n.isEmpty()&&t(n.value);)n=n._tail.get();return n},n.prototype.dropRight=function(t){var n=this.length();return this.take(n-t)},n.prototype.foldLeft=function(t,n){for(var r=t,e=this;!e.isEmpty();)r=n(r,e.value),e=e._tail.get();return r},n.prototype.foldRight=function(t,n){return this.reverse().foldLeft(t,function(t,r){return n(r,t)})},n.prototype.zip=function(t){var r=this,e=t[Symbol.iterator](),o=e.next();return this.isEmpty()||o.done?m:new n([this.value,o.value],s.Lazy.of(function(){return r._tail.get().zip((t={},t[Symbol.iterator]=function(){return e},t));var t}))},n.prototype.reverse=function(){return this.foldLeft(m,function(t,n){return t.prepend(n)})},n.prototype.partition=function(t){return[this.filter(t),this.filter(function(n){return!t(n)})]},n.prototype.groupBy=function(t){return this.foldLeft(p.HashMap.empty(),function(n,r){return n.putWithMerge(t(r),c.of(r),function(t,n){return t.appendStream(n)})})},n.prototype.append=function(t){var r=this._tail.get();return new n(this.value,s.Lazy.of(function(){return r.append(t)}))},n.prototype.appendAll=function(t){return this.appendStream(c.ofIterable(t))},n.prototype.appendStream=function(t){var r=this._tail.get();return new n(this.value,s.Lazy.of(function(){return r.appendStream(t)}))},n.prototype.prepend=function(t){var r=this;return new n(t,s.Lazy.of(function(){return r}))},n.prototype.prependAll=function(t){return c.ofIterable(t).appendAll(this)},n.prototype.cycle=function(){return this._cycle(this)},n.prototype._cycle=function(t){var r=this._tail.get();return new n(this.value,s.Lazy.of(function(){return r.isEmpty()?t.cycle():r._cycle(t)}))},n.prototype.map=function(t){var r=this;return new n(t(this.value),s.Lazy.of(function(){return r._tail.get().map(t)}))},n.prototype.mapOption=function(t){var r=this,e=t(this.value);return e.isSome()?new n(e.getOrThrow(),s.Lazy.of(function(){return r._tail.get().mapOption(t)})):this._tail.get().mapOption(t)},n.prototype.flatMap=function(t){return t(this.value).appendStream(this._tail.get().flatMap(t))},n.prototype.allMatch=function(t){return this.find(function(n){return!t(n)}).isNone()},n.prototype.anyMatch=function(t){return this.find(t).isSome()},n.prototype.filter=function(t){var r=this;return t(this.value)?new n(this.value,s.Lazy.of(function(){return r._tail.get().filter(t)})):this._tail.get().filter(t)},n.prototype.sortBy=function(t){return c.ofIterable(this.toArray().sort(t))},n.prototype.distinctBy=function(t){var n=f.HashSet.empty();return this.filter(function(r){var e=t(r),o=n.contains(e);return o||(n=n.add(e)),!o})},n.prototype.forEach=function(t){for(var n=this;!n.isEmpty();)t(n.value),n=n._tail.get();return this},n.prototype.mkString=function(t){for(var n="",r=this,e=!1;!r.isEmpty();)e&&(n+=t),n+=r.value.toString(),r=r._tail.get(),e=!0;return n},n.prototype.toArray=function(){var t=this._tail.get().toArray();return t.unshift(this.value),t},n.prototype.toVector=function(){return i.Vector.ofIterable(this.toArray())},n.prototype.toMap=function(t){return this.foldLeft(p.HashMap.empty(),function(n,r){var e=t(r);return n.put(e[0],e[1])})},n.prototype.equals=function(t){if(!t||!t.tail)return!1;a.contractTrueEquality("Stream.equals",this,t);for(var n=this,r=t;;){if(n.isEmpty()!==r.isEmpty())return!1;if(n.isEmpty())return!0;var e=n.value,o=r.value;if(void 0===e!=(void 0===o))return!1;if(void 0!==e&&void 0!==o){if(!u.areEqual(e,o))return!1;n=n._tail.get(),r=r._tail.get()}}},n.prototype.hashCode=function(){for(var t=1,n=this;!n.isEmpty();)t=31*t+u.getHashCode(n.value),n=n._tail.get();return t},n.prototype.toString=function(){for(var t=this,n="Stream(";!t.isEmpty();){n+=u.toStringHelper(t.value);var r=t._tail;if(!r.isEvaluated()){n+=", ?";break}(t=r.get()).isEmpty()||(n+=", ")}return n+")"},n}(c),m=new y},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./Option":6,"./SeqHelpers":7,"./Vector":10}],9:[function(t,n,r){"use strict";r.__esModule=!0;var e=t("./Option"),o=t("./Comparison"),i=t("./Contract"),u=function(){function t(t,n){this._fst=t,this._snd=n}return t.of=function(n,r){return new t(n,r)},t.ofArray=function(n){return new t(n[0],n[1])},t.prototype.hasTrueEquality=function(){return e.Option.of(this.fst()).hasTrueEquality()&&e.Option.of(this.snd()).hasTrueEquality()},t.prototype.fst=function(){return this._fst},t.prototype.snd=function(){return this._snd},t.prototype.map1=function(n){return new t(n(this._fst),this._snd)},t.prototype.map2=function(n){return new t(this._fst,n(this._snd))},t.prototype.map=function(t){return t(this._fst,this._snd)},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){return!(!t||!t._fst)&&(i.contractTrueEquality("Tuple2.equals",this,t),o.areEqual(this._fst,t._fst)&&o.areEqual(this._snd,t._snd))},t.prototype.hashCode=function(){return 53*o.getHashCode(this._fst)+o.getHashCode(this._snd)},t.prototype.toString=function(){return"Tuple2("+o.toStringHelper(this._fst)+", "+o.toStringHelper(this._snd)+")"},t.prototype.inspect=function(){return this.toString()},t}();r.Tuple2=u},{"./Comparison":1,"./Contract":2,"./Option":6}],10:[function(t,n,r){"use strict";r.__esModule=!0;var e=t("./Comparison"),o=t("./Contract"),i=t("./HashMap"),u=t("./Option"),a=t("./HashSet"),p=t("./SeqHelpers"),f=t("hamt_plus"),s=function(){function t(t,n){this.hamt=t,this.indexShift=n}return t.empty=function(){return t.emptyVector},t.ofIterable=function(n){return t.emptyVector.appendAll(n)},t.of=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.ofIterable(n)},t.unfoldRight=function(n,r){return new t(f.empty.mutate(function(t){for(var e=0,o=r(n);o.isSome();)t.set(e++,o.getOrThrow()[0]),o=r(o.getOrThrow()[1])}),0)},t.prototype[Symbol.iterator]=function(){var t=0,n=this.hamt;return{next:function(){return t<n.size?{done:!1,value:n.get(t++)}:{done:!0,value:void 0}}}},t.prototype.toArray=function(){for(var t=[],n=0;n<this.hamt.size;n++)t.push(this.hamt.get(n+this.indexShift));return t},t.prototype.hasTrueEquality=function(){return p.seqHasTrueEquality(this)},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?u.Option.of(this.hamt.get(this.indexShift)):u.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.head=function(){return u.Option.of(this.hamt.get(this.indexShift))},t.prototype.last=function(){return u.Option.of(this.hamt.get(this.hamt.size+this.indexShift-1))},t.prototype.tail=function(){return this.isEmpty()?u.Option.none():u.Option.of(new t(this.hamt.remove(this.indexShift),this.indexShift+1))},t.prototype.append=function(n){return new t(this.hamt.set(this.hamt.size+this.indexShift,n),this.indexShift)},t.prototype.prepend=function(n){var r=this.indexShift-1;return new t(this.hamt.set(r,n),r)},t.prototype.prependAll=function(n){for(var r=Array.from(n),e=this.indexShift-r.length,o=this.hamt,i=0;i<r.length;i++)o=o.set(e+i,r[i]);return new t(o,e)},t.prototype.forEach=function(t){for(var n=0;n<this.hamt.size;n++)t(this.hamt.get(n+this.indexShift));return this},t.prototype.appendAll=function(n){var r=this;return new t(this.hamt.mutate(function(t){for(var e=n[Symbol.iterator](),o=e.next();!o.done;)t.set(t.size+r.indexShift,o.value),o=e.next()}),this.indexShift)},t.prototype.map=function(n){var r=this;return new t(this.hamt.fold(function(t,e,o){return t.set(o-r.indexShift,n(e))},f.empty),0)},t.prototype.mapOption=function(n){var r=this;return new t(f.empty.mutate(function(t){for(var e=0,o=0;o<r.hamt.size;o++){var i=r.hamt.get(o+r.indexShift),u=n(i);u.isSome()&&t.set(e++,u.getOrThrow())}}),0)},t.prototype.filter=function(n){var r=this;return new t(f.empty.mutate(function(t){for(var e=0,o=0;o<r.hamt.size;o++){var i=r.hamt.get(o+r.indexShift);n(i)&&t.set(e++,i)}}),0)},t.prototype.find=function(t){for(var n=0;n<this.hamt.size;n++){var r=this.hamt.get(n+this.indexShift);if(t(r))return u.Option.of(r)}return u.Option.none()},t.prototype.contains=function(t){return this.anyMatch(function(n){return e.areEqual(n,t)})},t.prototype.flatMap=function(n){for(var r=[],e=0;e<this.hamt.size;e++)r=r.concat(n(this.hamt.get(e+this.indexShift)).toArray());return t.ofIterable(r)},t.prototype.fold=function(t,n){return this.foldLeft(t,n)},t.prototype.foldLeft=function(t,n){for(var r=t,e=0;e<this.hamt.size;e++)r=n(r,this.hamt.get(e+this.indexShift));return r},t.prototype.foldRight=function(t,n){for(var r=t,e=this.hamt.size-1;e>=0;e--)r=n(this.hamt.get(e+this.indexShift),r);return r},t.prototype.mkString=function(t){for(var n="",r=0;r<this.hamt.size;r++)r>0&&(n+=t),n+=this.hamt.get(r+this.indexShift).toString();return n},t.prototype.get=function(t){return u.Option.of(this.hamt.get(t+this.indexShift))},t.prototype.drop=function(n){var r=this;return n>=this.hamt.size?t.emptyVector:new t(this.hamt.fold(function(t,e,o){return o-r.indexShift>=n?t.set(o-r.indexShift-n,e):t},f.make()),0)},t.prototype.dropWhile=function(n){for(var r=f.make(),e=!0,o=0,i=0;i<this.hamt.size;i++){var u=this.hamt.get(i+this.indexShift);e&&!n(u)&&(e=!1),e||(r=r.set(o++,u))}return new t(r,0)},t.prototype.takeWhile=function(n){for(var r=f.make(),e=0,o=0;o<this.hamt.size;o++){var i=this.hamt.get(o+this.indexShift);if(!n(i))break;r=r.set(e++,i)}return new t(r,0)},t.prototype.dropRight=function(n){var r=this,e=this.hamt.size;return n>=e?t.emptyVector:new t(this.hamt.fold(function(t,o,i){return e-i+r.indexShift>n?t.set(i-r.indexShift,o):t},f.make()),0)},t.prototype.allMatch=function(t){for(var n=this.hamt.values(),r=n.next();!r.done;){if(!t(r.value))return!1;r=n.next()}return!0},t.prototype.anyMatch=function(t){for(var n=this.hamt.values(),r=n.next();!r.done;){if(t(r.value))return!0;r=n.next()}return!1},t.prototype.sortBy=function(n){return t.ofIterable(this.toArray().sort(n))},t.prototype.sortOn=function(t){return this.sortBy(function(n,r){return t(n)-t(r)})},t.prototype.groupBy=function(n){return this.hamt.fold(function(r,e,o){return r.putWithMerge(n(e),t.of(e),function(t,n){return t.appendAll(n)})},i.HashMap.empty())},t.prototype.arrangeBy=function(t){return p.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(p.shuffle(this.toArray()))},t.prototype.toMap=function(t){return this.hamt.fold(function(n,r,e){var o=t(r);return n.put(o[0],o[1])},i.HashMap.empty())},t.prototype.zip=function(n){var r=this;return new t(f.empty.mutate(function(t){for(var e=0,o=r[Symbol.iterator](),i=n[Symbol.iterator](),u=o.next(),a=i.next();!u.done&&!a.done;)t.set(e++,[u.value,a.value]),u=o.next(),a=i.next()}),0)},t.prototype.reverse=function(){var n=this,r=this.hamt.size;return new t(this.hamt.fold(function(t,e,o){return t.set(r-1-o+n.indexShift,e)},f.make()),0)},t.prototype.partition=function(n){var r=this,e=[null,null];return f.empty.mutate(function(o){return f.empty.mutate(function(i){for(var u=0,a=0,p=0;p<r.hamt.size;p++){var f=r.hamt.get(p+r.indexShift);n(f)?o.set(u++,f):i.set(a++,f)}e[0]=new t(o,0),e[1]=new t(i,0)})}),e},t.prototype.distinctBy=function(n){var r=this,e=a.HashSet.empty();return new t(f.empty.mutate(function(t){for(var o=0,i=0;i<r.hamt.size;i++){var u=r.hamt.get(i+r.indexShift),a=n(u);e.contains(a)||(t.set(o++,u),e=e.add(a))}}),0)},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){if(!t||!t.hamt)return!1;if(this.hamt.size!==t.hamt.size)return!1;o.contractTrueEquality("Vector.equals",this,t);for(var n=0;n<this.hamt.size;n++){var r=this.hamt.get(n+this.indexShift),i=t.hamt.get(n+t.indexShift);if(void 0===r!=(void 0===i))return!1;if(void 0!==r&&void 0!==i&&!e.areEqual(r,i))return!1}return!0},t.prototype.hashCode=function(){for(var t=1,n=0;n<this.hamt.size;n++)t=31*t+e.getHashCode(this.hamt.get(n+this.indexShift));return t},t.prototype.toString=function(){for(var t="Vector(",n=0;n<this.hamt.size;n++)n>0&&(t+=", "),t+=e.toStringHelper(this.hamt.get(n+this.indexShift));return t+")"},t.prototype.inspect=function(){return this.toString()},t.emptyVector=new t(f.make(),0),t}();r.Vector=s},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Option":6,"./SeqHelpers":7,hamt_plus:12}],11:[function(t,n,r){"use strict";function e(t){for(var n in t)r.hasOwnProperty(n)||(r[n]=t[n])}r.__esModule=!0,e(t("./Option")),e(t("./Lazy")),e(t("./Vector")),e(t("./HashMap")),e(t("./HashSet")),e(t("./Tuple2")),e(t("./Comparison")),e(t("./Stream")),e(t("./Contract"))},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./Option":6,"./Stream":8,"./Tuple2":9,"./Vector":10}],12:[function(t,n,r){"use strict";function e(t,n,r,e,o){this._editable=t,this._edit=n,this._config=r,this._root=e,this._size=o}function o(t){this.v=t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u={},a=Math.pow(2,5),p=a-1,f=a/2,s=a/4,h={},c=function(t){return function(){return t}},y=u.hash=function(t){var n=void 0===t?"undefined":i(t);if("number"===n)return t;"string"!==n&&(t+="");for(var r=0,e=0,o=t.length;e<o;++e)r=(r<<5)-r+t.charCodeAt(e)|0;return r},l=function(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)},m=function(t,n){return n>>>t&p},d=function(t){return 1<<t},v=function(t,n){return l(t&n-1)},g=function(t,n,r,e){var o=e;if(!t){var i=e.length;o=new Array(i);for(var u=0;u<i;++u)o[u]=e[u]}return o[n]=r,o},_=function(t,n,r){var e=r.length-1,o=0,i=0,u=r;if(t)o=i=n;else for(u=new Array(e);o<n;)u[i++]=r[o++];for(++o;o<=e;)u[i++]=r[o++];return t&&(u.length=e),u},S=function(t,n,r,e){var o=e.length;if(t){for(var i=o;i>=n;)e[i--]=e[i];return e[n]=r,e}for(var u=0,a=0,p=new Array(o+1);u<n;)p[a++]=e[u++];for(p[n]=r;u<o;)p[++a]=e[u++];return p},O={__hamt_isEmpty:!0},E=function(t){return t===O||t&&t.__hamt_isEmpty},w=function(t,n,r,e){return{type:1,edit:t,hash:n,key:r,value:e,_modify:A}},x=function(t,n,r){return{type:2,edit:t,hash:n,children:r,_modify:V}},b=function(t,n,r){return{type:3,edit:t,mask:n,children:r,_modify:L}},q=function(t,n,r){return{type:4,edit:t,size:n,children:r,_modify:I}},z=function(t){return t===O||1===t.type||2===t.type},H=function(t,n,r,e,o){for(var i=[],u=e,a=0,p=0;u;++p)1&u&&(i[p]=o[a++]),u>>>=1;return i[n]=r,q(t,a+1,i)},M=function(t,n,r,e){for(var o=new Array(n-1),i=0,u=0,a=0,p=e.length;a<p;++a)if(a!==r){var f=e[a];f&&!E(f)&&(o[i++]=f,u|=1<<a)}return b(t,u,o)},k=function t(n,r,e,o,i,u){if(e===i)return x(n,e,[u,o]);var a=m(r,e),p=m(r,i);return b(n,d(a)|d(p),a===p?[t(n,r+5,e,o,i,u)]:a<p?[o,u]:[u,o])},C=function(t,n,r,e,o,i,u,a){for(var p=o.length,f=0;f<p;++f){var s=o[f];if(r(u,s.key)){var c=s.value,y=i(c);return y===c?o:y===h?(--a.value,_(t,f,o)):g(t,f,w(n,e,u,y),o)}}var l=i();return l===h?o:(++a.value,g(t,p,w(n,e,u,l),o))},T=function(t,n){return t===n.edit},A=function(t,n,r,e,o,i,u){if(n(i,this.key)){var a=e(this.value);return a===this.value?this:a===h?(--u.value,O):T(t,this)?(this.value=a,this):w(t,o,i,a)}var p=e();return p===h?this:(++u.value,k(t,r,this.hash,this,o,w(t,o,i,p)))},V=function(t,n,r,e,o,i,u){if(o===this.hash){var a=T(t,this),p=C(a,t,n,this.hash,this.children,e,i,u);return p===this.children?this:p.length>1?x(t,this.hash,p):p[0]}var f=e();return f===h?this:(++u.value,k(t,r,this.hash,this,o,w(t,o,i,f)))},L=function(t,n,r,e,o,i,u){var a=this.mask,p=this.children,s=m(r,o),h=d(s),c=v(a,h),y=a&h,l=y?p[c]:O,w=l._modify(t,n,r+5,e,o,i,u);if(l===w)return this;var x=T(t,this),q=a,M=void 0;if(y&&E(w)){if(!(q&=~h))return O;if(p.length<=2&&z(p[1^c]))return p[1^c];M=_(x,c,p)}else if(y||E(w))M=g(x,c,w,p);else{if(p.length>=f)return H(t,s,w,a,p);q|=h,M=S(x,c,w,p)}return x?(this.mask=q,this.children=M,this):b(t,q,M)},I=function(t,n,r,e,o,i,u){var a=this.size,p=this.children,f=m(r,o),h=p[f],c=(h||O)._modify(t,n,r+5,e,o,i,u);if(h===c)return this;var y=T(t,this),l=void 0;if(E(h)&&!E(c))++a,l=g(y,f,c,p);else if(!E(h)&&E(c)){if(--a<=s)return M(t,a,f,p);l=g(y,f,O,p)}else l=g(y,f,c,p);return y?(this.size=a,this.children=l,this):q(t,a,l)};O._modify=function(t,n,r,e,o,i,u){var a=e();return a===h?O:(++u.value,w(t,o,i,a))},e.prototype.setTree=function(t,n){return this._editable?(this._root=t,this._size=n,this):t===this._root?this:new e(this._editable,this._edit,this._config,t,n)};var B=u.tryGetHash=function(t,n,r,e){for(var o=e._root,i=0,u=e._config.keyEq;;)switch(o.type){case 1:return u(r,o.key)?o.value:t;case 2:if(n===o.hash)for(var a=o.children,p=0,f=a.length;p<f;++p){var s=a[p];if(u(r,s.key))return s.value}return t;case 3:var h=m(i,n),c=d(h);if(o.mask&c){o=o.children[v(o.mask,c)],i+=5;break}return t;case 4:if(o=o.children[m(i,n)]){i+=5;break}return t;default:return t}};e.prototype.tryGetHash=function(t,n,r){return B(t,n,r,this)};var W=u.tryGet=function(t,n,r){return B(t,r._config.hash(n),n,r)};e.prototype.tryGet=function(t,n){return W(t,n,this)};var N=u.getHash=function(t,n,r){return B(void 0,t,n,r)};e.prototype.getHash=function(t,n){return N(t,n,this)};u.get=function(t,n){return B(void 0,n._config.hash(t),t,n)};e.prototype.get=function(t,n){return W(n,t,this)};var j=u.has=function(t,n,r){return B(h,t,n,r)!==h};e.prototype.hasHash=function(t,n){return j(t,n,this)};var P=u.has=function(t,n){return j(n._config.hash(t),t,n)};e.prototype.has=function(t){return P(t,this)};var R=function(t,n){return t===n};u.make=function(t){return new e(0,0,{keyEq:t&&t.keyEq||R,hash:t&&t.hash||y},O,0)},u.empty=u.make();var U=u.isEmpty=function(t){return t&&!!E(t._root)};e.prototype.isEmpty=function(){return U(this)};var G=u.modifyHash=function(t,n,r,e){var o={value:e._size},i=e._root._modify(e._editable?e._edit:NaN,e._config.keyEq,0,t,n,r,o);return e.setTree(i,o.value)};e.prototype.modifyHash=function(t,n,r){return G(r,t,n,this)};var D=u.modify=function(t,n,r){return G(t,r._config.hash(n),n,r)};e.prototype.modify=function(t,n){return D(n,t,this)};var F=u.setHash=function(t,n,r,e){return G(c(r),t,n,e)};e.prototype.setHash=function(t,n,r){return F(t,n,r,this)};var J=u.set=function(t,n,r){return F(r._config.hash(t),t,n,r)};e.prototype.set=function(t,n){return J(t,n,this)};var K=c(h),Q=u.removeHash=function(t,n,r){return G(K,t,n,r)};e.prototype.removeHash=e.prototype.deleteHash=function(t,n){return Q(t,n,this)};var X=u.remove=function(t,n){return Q(n._config.hash(t),t,n)};e.prototype.remove=e.prototype.delete=function(t){return X(t,this)};var Y=u.beginMutation=function(t){return new e(t._editable+1,t._edit+1,t._config,t._root,t._size)};e.prototype.beginMutation=function(){return Y(this)};var Z=u.endMutation=function(t){return t._editable=t._editable&&t._editable-1,t};e.prototype.endMutation=function(){return Z(this)};var $=u.mutate=function(t,n){var r=Y(n);return t(r),Z(r)};e.prototype.mutate=function(t){return $(t,this)};var tt=function(t){return t&&nt(t[0],t[1],t[2],t[3],t[4])},nt=function(t,n,r,e,o){for(;r<t;){var i=n[r++];if(i&&!E(i))return rt(i,e,[t,n,r,e,o])}return tt(o)},rt=function(t,n,r){switch(t.type){case 1:return{value:n(t),rest:r};case 2:case 4:case 3:var e=t.children;return nt(e.length,e,0,n,r);default:return tt(r)}},et={done:!0};o.prototype.next=function(){if(!this.v)return et;var t=this.v;return this.v=tt(t.rest),t},o.prototype[Symbol.iterator]=function(){return this};var ot=function(t,n){return new o(rt(t._root,n))},it=function(t){return[t.key,t.value]},ut=u.entries=function(t){return ot(t,it)};e.prototype.entries=e.prototype[Symbol.iterator]=function(){return ut(this)};var at=function(t){return t.key},pt=u.keys=function(t){return ot(t,at)};e.prototype.keys=function(){return pt(this)};var ft=function(t){return t.value},st=u.values=e.prototype.values=function(t){return ot(t,ft)};e.prototype.values=function(){return st(this)};var ht=u.fold=function(t,n,r){var e=r._root;if(1===e.type)return t(n,e.value,e.key);for(var o=[e.children],i=void 0;i=o.pop();)for(var u=0,a=i.length;u<a;){var p=i[u++];p&&p.type&&(1===p.type?n=t(n,p.value,p.key):o.push(p.children))}return n};e.prototype.fold=function(t,n){return ht(t,n,this)};var ct=u.forEach=function(t,n){return ht(function(r,e,o){return t(e,o,n)},null,n)};e.prototype.forEach=function(t){return ct(t,this)};var yt=u.count=function(t){return t._size};e.prototype.count=function(){return yt(this)},Object.defineProperty(e.prototype,"size",{get:e.prototype.count}),void 0!==n&&n.exports?n.exports=u:(void 0).hamt=u},{}]},{},[11])(11)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).prelude_ts=t()}}(function(){return function t(r,n,e){function o(u,p){if(!n[u]){if(!r[u]){var a="function"==typeof require&&require;if(!p&&a)return a(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[u]={exports:{}};r[u][0].call(s.exports,function(t){var n=r[u][1][t];return o(n||t)},s,s.exports,t,r,n,e)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<e.length;u++)o(e[u]);return o}({1:[function(t,r,n){"use strict";function e(t){return void 0!==t.equals}function o(t){var r,n=0;if(0===t.length)return n;for(r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n|=0;return n}function i(t){return t?e(t)?t.hashCode():"number"==typeof t?t:o(t+""):0}function u(t){return Array.isArray(t)?"["+t.map(u)+"]":"string"==typeof t?"'"+t+"'":t+""}n.__esModule=!0;var p=t("./Option");n.hasEquals=e,n.fieldsHashCode=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n=1,e=0,o=t;e<o.length;e++)n=37*n+i(o[e]);return n},n.stringHashCode=o,n.areEqual=function(t,r){return null===t!=r!==null&&(null===t||null===r||(e(t)?t.equals(r):t===r))},n.getHashCode=i,n.hasTrueEquality=function(t){if(!t)return p.Option.none();if(t.equals)return p.Option.of(!0);switch(t.constructor){case String:case Number:case Boolean:return p.Option.of(!0)}return p.Option.of(!1)},n.toStringHelper=u},{"./Option":7}],2:[function(t,r,n){"use strict";function e(t){o(t)}n.__esModule=!0;var o=function(t){throw t};n.setContractViolationAction=function(t){o=t},n.reportContractViolation=e,n.contractTrueEquality=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];for(var o=0,i=r;o<i.length;o++){var u=i[o];u&&u.hasTrueEquality&&!u.hasTrueEquality()&&e(t+": element doesn't support true equality: "+u)}}},{}],3:[function(t,r,n){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();n.__esModule=!0;var o=t("./Comparison"),i=t("./Contract"),u=t("./Option"),p=t("./HashSet"),a=t("./Vector"),f=t("hamt_plus"),s=function(){function t(t){this.hamt=t}return t.empty=function(){return h},t.of=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.ofIterable(r)},t.ofIterable=function(r){for(var n=t.empty(),e=r[Symbol.iterator](),o=e.next();!o.done;)n=n.put(o.value[0],o.value[1]),o=e.next();return n},t.prototype.get=function(t){return u.Option.of(this.hamt.get(t))},t.prototype[Symbol.iterator]=function(){return this.hamt.entries()},t.prototype.hasTrueEquality=function(){return u.Option.of(this.hamt.entries().next().value).map(function(t){return t[0]}).hasTrueEquality()&&u.Option.of(this.hamt.entries().next().value).map(function(t){return t[1]}).hasTrueEquality()},t.prototype.put=function(r,n){return new t(this.hamt.set(r,n))},t.prototype.putWithMerge=function(r,n,e){return new t(this.hamt.modify(r,function(t){return void 0===t?n:e(t,n)}))},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?u.Option.of(this.hamt.entries().next().value):u.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.keySet=function(){return p.HashSet.ofIterable(this.hamt.keys())},t.prototype.valueIterable=function(){return this.hamt.values()},t.prototype.mergeWith=function(t,r){for(var n=t[Symbol.iterator](),e=this,o=n.next();!o.done;)e=e.putWithMerge(o.value[0],o.value[1],r),o=n.next();return e},t.prototype.map=function(r){return this.hamt.fold(function(t,n,e){var o=r(e,n),i=o[0],u=o[1];return t.put(i,u)},t.empty())},t.prototype.mapValues=function(r){return this.hamt.fold(function(t,n,e){return t.put(e,r(n))},t.empty())},t.prototype.flatMap=function(r){return this.foldLeft(t.empty(),function(t,n){return t.mergeWith(r(n[0],n[1]),function(t,r){return r})})},t.prototype.allMatch=function(t){for(var r=this.hamt.entries(),n=r.next();!n.done;){if(!t(n.value[0],n.value[1]))return!1;n=r.next()}return!0},t.prototype.anyMatch=function(t){for(var r=this.hamt.entries(),n=r.next();!n.done;){if(t(n.value[0],n.value[1]))return!0;n=r.next()}return!1},t.prototype.contains=function(t){return o.areEqual(this.hamt.get(t[0]),t[1])},t.prototype.filter=function(r){return this.hamt.fold(function(t,n,e){return r(e,n)?t.put(e,n):t},t.empty())},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.foldLeft=function(t,r){return this.hamt.fold(function(t,n,e){return r(t,[e,n])},t)},t.prototype.foldRight=function(t,r){return this.foldLeft(t,function(t,n){return r(n,t)})},t.prototype.toArray=function(){return this.hamt.fold(function(t,r,n){return t.push([n,r]),t},[])},t.prototype.toVector=function(){return this.hamt.fold(function(t,r,n){return t.append([n,r])},a.Vector.empty())},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){if(!t||!t.valueIterable)return!1;i.contractTrueEquality("HashMap.equals",this,t);var r=this.hamt.size;if(0===t.length()&&0===r)return!0;if(r!==t.length())return!1;for(var n=0,e=Array.from(this.hamt.keys());n<e.length;n++){var u=e[n],p=this.hamt.get(u),a=t.get(u).getOrUndefined();if(void 0===p||void 0===a)return!1;if(!o.areEqual(p,a))return!1}return!0},t.prototype.hashCode=function(){return this.hamt.fold(function(t,r,n){return o.getHashCode(n)+o.getHashCode(r)},0)},t.prototype.toString=function(){return"{"+this.hamt.fold(function(t,r,n){return t.push(n+" => "+o.toStringHelper(r)),t},[]).join(", ")+"}"},t.prototype.inspect=function(){return this.toString()},t}();n.HashMap=s;var h=new(function(t){function r(){return t.call(this,{})||this}return e(r,t),r.prototype.get=function(t){return u.none},r.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},r.prototype.put=function(t,r){return i.contractTrueEquality("Error building a HashMap",t),new s(o.hasEquals(t)?f.make({hash:function(t){return t.hashCode()},keyEq:function(t,r){return t.equals(r)}}).set(t,r):f.make().set(t,r))},r.prototype.hasTrueEquality=function(){return!0},r.prototype.putWithMerge=function(t,r,n){return this.put(t,r)},r.prototype.length=function(){return 0},r.prototype.single=function(){return u.Option.none()},r.prototype.isEmpty=function(){return!0},r.prototype.keySet=function(){return p.HashSet.empty()},r.prototype.valueIterable=function(){return t={},t[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},t;var t},r.prototype.mergeWith=function(t,r){return s.ofIterable(t)},r.prototype.map=function(t){return s.empty()},r.prototype.mapValues=function(t){return s.empty()},r.prototype.allMatch=function(t){return!0},r.prototype.anyMatch=function(t){return!1},r.prototype.contains=function(t){return!1},r.prototype.filter=function(t){return this},r.prototype.foldLeft=function(t,r){return t},r.prototype.toArray=function(){return[]},r.prototype.toVector=function(){return a.Vector.empty()},r.prototype.equals=function(t){return!(!t||!t.valueIterable)&&(t===h||0===t.length())},r.prototype.hashCode=function(){return 0},r.prototype.toString=function(){return""},r}(s))},{"./Comparison":1,"./Contract":2,"./HashSet":4,"./Option":7,"./Vector":11,hamt_plus:13}],4:[function(t,r,n){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();n.__esModule=!0;var o=t("./Vector"),i=t("./Option"),u=t("./Comparison"),p=t("./Contract"),a=t("hamt_plus"),f=function(){function t(t){this.hamt=t}return t.empty=function(){return s},t.ofIterable=function(r){return new t(a.empty).addAll(r)},t.of=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.ofIterable(r)},t.prototype[Symbol.iterator]=function(){return this.hamt.keys()},t.prototype.add=function(r){return new t(this.hamt.set(r,r))},t.prototype.addAll=function(r){return new t(this.hamt.mutate(function(t){var n=r[Symbol.iterator](),e=n.next();for(e.done||p.contractTrueEquality("Error building a HashSet",e.value);!e.done;)t.set(e.value,e.value),e=n.next()}))},t.prototype.contains=function(t){return this.hamt.has(t)},t.prototype.map=function(r){return this.hamt.fold(function(t,n,e){return t.add(r(n))},t.empty())},t.prototype.mapOption=function(r){return this.hamt.fold(function(t,n,e){var o=r(n);return o.isSome()?t.add(o.getOrThrow()):t},t.empty())},t.prototype.flatMap=function(r){return this.foldLeft(t.empty(),function(t,n){return t.addAll(r(n))})},t.prototype.filter=function(r){return this.hamt.fold(function(t,n,e){return r(n)?t.add(n):t},t.empty())},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.foldLeft=function(t,r){return this.hamt.fold(function(t,n,e){return r(t,n)},t)},t.prototype.foldRight=function(t,r){return this.foldLeft(t,function(t,n){return r(n,t)})},t.prototype.toArray=function(){return Array.from(this.hamt.keys())},t.prototype.toVector=function(){return o.Vector.ofIterable(this.hamt.keys())},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?i.Option.of(this.hamt.keys().next().value):i.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.diff=function(r){return new t(this.hamt.fold(function(t,n,e){return r.contains(e)?t:t.set(e,e)},a.empty))},t.prototype.intersect=function(r){return new t(this.hamt.fold(function(t,n,e){return r.contains(e)?t.set(e,e):t},a.empty))},t.prototype.removeAll=function(r){return this.diff(t.ofIterable(r))},t.prototype.allMatch=function(t){for(var r=this.hamt.values(),n=r.next();!n.done;){if(!t(n.value))return!1;n=r.next()}return!0},t.prototype.anyMatch=function(t){for(var r=this.hamt.values(),n=r.next();!n.done;){if(t(n.value))return!0;n=r.next()}return!1},t.prototype.partition=function(r){for(var n=t.empty(),e=t.empty(),o=this.hamt.values(),i=o.next();!i.done;)r(i.value)?n=n.add(i.value):e=e.add(i.value),i=o.next();return[n,e]},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){var r=this.hamt.size;if(t===s&&0===r)return!0;if(!t||!t.hamt)return!1;if(r!==t.hamt.size)return!1;p.contractTrueEquality("HashSet.equals",this,t);for(var n=0,e=Array.from(this.hamt.keys());n<e.length;n++){var o=e[n],i=t.hamt.get(o);if(void 0===i)return!1;if(!u.areEqual(o,i))return!1}return!0},t.prototype.hashCode=function(){return this.hamt.fold(function(t,r,n){return u.getHashCode(n)},0)},t.prototype.toString=function(){return"{"+this.mkString(", ")+"}"},t.prototype.inspect=function(){return this.toString()},t.prototype.mkString=function(t){return this.hamt.fold(function(t,r,n){return t.push(u.toStringHelper(n)),t},[]).join(t)},t}();n.HashSet=f;var s=new(function(t){function r(){return t.call(this,{})||this}return e(r,t),r.prototype.add=function(t){return p.contractTrueEquality("Error building a HashSet",t),new f(u.hasEquals(t)?a.make({hash:function(t){return t.hashCode()},keyEq:function(t,r){return t.equals(r)}}).set(t,t):a.make().set(t,t))},r.prototype.addAll=function(t){return f.ofIterable(t)},r.prototype.contains=function(t){return!1},r.prototype.map=function(t){return s},r.prototype.mapOption=function(t){return s},r.prototype.filter=function(t){return this},r.prototype.foldLeft=function(t,r){return t},r.prototype.toArray=function(){return[]},r.prototype.toVector=function(){return o.Vector.empty()},r.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},r.prototype.length=function(){return 0},r.prototype.isEmpty=function(){return!0},r.prototype.diff=function(t){return this},r.prototype.intersect=function(t){return this},r.prototype.anyMatch=function(t){return!1},r.prototype.allMatch=function(t){return!0},r.prototype.partition=function(t){return[this,this]},r.prototype.equals=function(t){return!(!t||!t.length)&&(t===s||0===t.length())},r.prototype.hashCode=function(){return 0},r.prototype.toString=function(){return"{}"},r.prototype.mkString=function(t){return""},r}(f))},{"./Comparison":1,"./Contract":2,"./Option":7,"./Vector":11,hamt_plus:13}],5:[function(t,r,n){"use strict";n.__esModule=!0;var e=function(){function t(t){this.thunk=t}return t.of=function(r){return new t(r)},t.prototype.get=function(){return this.thunk&&(this.value=this.thunk(),this.thunk=void 0),this.value},t.prototype.isEvaluated=function(){return void 0===this.thunk},t}();n.Lazy=e},{}],6:[function(t,r,n){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();n.__esModule=!0;var o=t("./Option"),i=t("./Vector"),u=t("./Comparison"),p=t("./Contract"),a=t("./HashMap"),f=t("./HashSet"),s=t("./SeqHelpers"),h=function(){function t(){}return t.empty=function(){return l},t.of=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.ofIterable(r)},t.ofIterable=function(t){for(var r=t[Symbol.iterator](),n=r.next(),e=l;!n.done;)e=new y(n.value,e),n=r.next();return e.reverse()},t.unfoldRight=function(t,r){for(var n=r(t),e=l;!n.isNone();)e=new y(n.getOrThrow()[0],e),n=r(n.getOrThrow()[1]);return e.reverse()},t.prototype.hasTrueEquality=function(){return s.seqHasTrueEquality(this)},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.arrangeBy=function(t){return s.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(s.shuffle(this.toArray()))},t.prototype.sortOn=function(t){return this.sortBy(function(r,n){return t(r)-t(n)})},t.prototype.transform=function(t){return t(this)},t.prototype.inspect=function(){return this.toString()},t}();n.List=h;var c=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},r.prototype.length=function(){return 0},r.prototype.single=function(){return o.Option.none()},r.prototype.isEmpty=function(){return!0},r.prototype.head=function(){return o.Option.none()},r.prototype.tail=function(){return o.Option.none()},r.prototype.last=function(){return o.Option.none()},r.prototype.get=function(t){return o.Option.none()},r.prototype.find=function(t){return o.Option.none()},r.prototype.contains=function(t){return!1},r.prototype.take=function(t){return this},r.prototype.takeWhile=function(t){return this},r.prototype.drop=function(t){return this},r.prototype.dropWhile=function(t){return this},r.prototype.dropRight=function(t){return this},r.prototype.foldLeft=function(t,r){return t},r.prototype.foldRight=function(t,r){return t},r.prototype.zip=function(t){return l},r.prototype.reverse=function(){return this},r.prototype.partition=function(t){return[h.empty(),h.empty()]},r.prototype.groupBy=function(t){return a.HashMap.empty()},r.prototype.append=function(t){return h.of(t)},r.prototype.appendAll=function(t){return h.ofIterable(t)},r.prototype.prepend=function(t){return new y(t,this)},r.prototype.prependAll=function(t){return h.ofIterable(t)},r.prototype.map=function(t){return l},r.prototype.mapOption=function(t){return l},r.prototype.flatMap=function(t){return l},r.prototype.allMatch=function(t){return!0},r.prototype.anyMatch=function(t){return!1},r.prototype.filter=function(t){return this},r.prototype.sortBy=function(t){return this},r.prototype.distinctBy=function(t){return this},r.prototype.forEach=function(t){return this},r.prototype.mkString=function(t){return""},r.prototype.toArray=function(){return[]},r.prototype.toVector=function(){return i.Vector.empty()},r.prototype.toMap=function(t){return a.HashMap.empty()},r.prototype.equals=function(t){return!!t&&t.isEmpty()},r.prototype.hashCode=function(){return 1},r.prototype.toString=function(){return"[]"},r}(h),y=function(t){function r(r,n){var e=t.call(this)||this;return e.value=r,e._tail=n,e}return e(r,t),r.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){if(t.isEmpty())return{done:!0,value:void 0};var r=t.head().getOrThrow();return t=t.tail().getOrThrow(),{done:!1,value:r}}}},r.prototype.length=function(){return this.foldLeft(0,function(t,r){return t+1})},r.prototype.single=function(){return this._tail.isEmpty()?o.Option.of(this.value):o.Option.none()},r.prototype.isEmpty=function(){return!1},r.prototype.head=function(){return o.Option.of(this.value)},r.prototype.tail=function(){return o.Option.of(this._tail)},r.prototype.last=function(){for(var t=this;;){var r=t.value;if((t=t._tail).isEmpty())return o.Option.of(r)}},r.prototype.get=function(t){for(var r=this,n=0;!r.isEmpty();){if(n===t){var e=r.value;return o.Option.of(e)}r=r._tail,++n}return o.Option.none()},r.prototype.find=function(t){for(var r=this;!r.isEmpty();){var n=r.value;if(t(n))return o.Option.of(n);r=r._tail}return o.Option.none()},r.prototype.contains=function(t){return this.find(function(r){return u.areEqual(r,t)}).isSome()},r.prototype.take=function(t){for(var n=l,e=this,o=0;o++<t&&!e.isEmpty();)n=new r(e.value,n),e=e._tail;return n.reverse()},r.prototype.takeWhile=function(t){for(var n=l,e=this;!e.isEmpty()&&t(e.value);)n=new r(e.value,n),e=e._tail;return n.reverse()},r.prototype.drop=function(t){for(var r=t,n=this;r-- >0&&!n.isEmpty();)n=n._tail;return n},r.prototype.dropWhile=function(t){for(var r=this;!r.isEmpty()&&t(r.value);)r=r._tail;return r},r.prototype.dropRight=function(t){var r=this.length();return this.take(r-t)},r.prototype.foldLeft=function(t,r){for(var n=t,e=this;!e.isEmpty();)n=r(n,e.value),e=e._tail;return n},r.prototype.foldRight=function(t,r){return this.reverse().foldLeft(t,function(t,n){return r(n,t)})},r.prototype.zip=function(t){for(var n=t[Symbol.iterator](),e=n.next(),o=this,i=l;!o.isEmpty()&&!e.done;)i=new r([o.value,e.value],i),o=o._tail,e=n.next();return i.reverse()},r.prototype.reverse=function(){return this.foldLeft(l,function(t,r){return t.prepend(r)})},r.prototype.partition=function(t){return[this.filter(t),this.filter(function(r){return!t(r)})]},r.prototype.groupBy=function(t){return this.foldLeft(a.HashMap.empty(),function(r,n){return r.putWithMerge(t(n),h.of(n),function(t,r){return t.prepend(r.single().getOrThrow())})}).mapValues(function(t){return t.reverse()})},r.prototype.append=function(t){return new r(this.value,this._tail.append(t))},r.prototype.appendAll=function(t){return h.ofIterable(t).prependAll(this)},r.prototype.prepend=function(t){return new r(t,this)},r.prototype.prependAll=function(t){for(var n=h.ofIterable(t).reverse(),e=this;!n.isEmpty();)e=new r(n.value,e),n=n._tail;return e},r.prototype.map=function(t){for(var n=this,e=l;!n.isEmpty();)e=new r(t(n.value),e),n=n._tail;return e.reverse()},r.prototype.mapOption=function(t){for(var n=this,e=l;!n.isEmpty();){var o=t(n.value);o.isSome()&&(e=new r(o.getOrThrow(),e)),n=n._tail}return e.reverse()},r.prototype.flatMap=function(t){for(var r=this,n=l;!r.isEmpty();)n=n.prependAll(t(r.value).reverse()),r=r._tail;return n.reverse()},r.prototype.allMatch=function(t){return this.find(function(r){return!t(r)}).isNone()},r.prototype.anyMatch=function(t){return this.find(t).isSome()},r.prototype.filter=function(t){for(var n=this,e=l;!n.isEmpty();)t(n.value)&&(e=new r(n.value,e)),n=n._tail;return e.reverse()},r.prototype.sortBy=function(t){return h.ofIterable(this.toArray().sort(t))},r.prototype.distinctBy=function(t){var r=f.HashSet.empty();return this.filter(function(n){var e=t(n),o=r.contains(e);return o||(r=r.add(e)),!o})},r.prototype.forEach=function(t){for(var r=this;!r.isEmpty();)t(r.value),r=r._tail;return this},r.prototype.mkString=function(t){for(var r="",n=this,e=!1;!n.isEmpty();)e&&(r+=t),r+=n.value.toString(),n=n._tail,e=!0;return r},r.prototype.toArray=function(){var t=this._tail.toArray();return t.unshift(this.value),t},r.prototype.toVector=function(){return i.Vector.ofIterable(this.toArray())},r.prototype.toMap=function(t){return this.foldLeft(a.HashMap.empty(),function(r,n){var e=t(n);return r.put(e[0],e[1])})},r.prototype.equals=function(t){if(!t||!t.tail)return!1;p.contractTrueEquality("List.equals",this,t);for(var r=this,n=t;;){if(r.isEmpty()!==n.isEmpty())return!1;if(r.isEmpty())return!0;var e=r.value,o=n.value;if(void 0===e!=(void 0===o))return!1;if(void 0!==e&&void 0!==o){if(!u.areEqual(e,o))return!1;r=r._tail,n=n._tail}}},r.prototype.hashCode=function(){for(var t=1,r=this;!r.isEmpty();)t=31*t+u.getHashCode(r.value),r=r._tail;return t},r.prototype.toString=function(){for(var t=this,r="List(";!t.isEmpty();)r+=u.toStringHelper(t.value),(t=t._tail).isEmpty()||(r+=", ");return r+")"},r}(h),l=new c},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Option":7,"./SeqHelpers":8,"./Vector":11}],7:[function(t,r,n){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();n.__esModule=!0;var o=t("./Vector"),i=t("./Comparison"),u=t("./Contract"),p=function(){function t(){}return t.of=function(t){return void 0===t?n.none:new a(t)},t.none=function(){return n.none},t.sequence=function(r){for(var e=o.Vector.empty(),i=r[Symbol.iterator](),u=i.next();!u.done;){var p=u.value;if(p.isNone())return n.none;e=e.append(p.getOrThrow()),u=i.next()}return t.of(e)},t.liftA2=function(t){return function(r,n){return r.flatMap(function(r){return n.map(function(n){return t(r,n)})})}},t.prototype.hasTrueEquality=function(){return this.flatMap(function(r){return r&&r.hasTrueEquality?t.of(r.hasTrueEquality()):i.hasTrueEquality(r)}).getOrElse(!0)},t.prototype.transform=function(t){return t(this)},t}();n.Option=p;var a=function(t){function r(r){var n=t.call(this)||this;return n.value=r,n}return e(r,t),r.prototype.isSome=function(){return!0},r.prototype.isNone=function(){return!1},r.prototype.orElse=function(t){return this},r.prototype.getOrThrow=function(t){return this.value},r.prototype.contains=function(t){return t===this.value},r.prototype.getOrUndefined=function(){return this.value},r.prototype.getOrElse=function(t){return this.value},r.prototype.map=function(t){return p.of(t(this.value))},r.prototype.flatMap=function(t){return t(this.value)},r.prototype.filter=function(t){return t(this.value)?this:p.none()},r.prototype.ifPresent=function(t){return t(this.value),this},r.prototype.toVector=function(){return o.Vector.of(this.value)},r.prototype.equals=function(t){if(t===n.none||!t||!t.isSome)return!1;var r=t;return u.contractTrueEquality("Option.equals",this,r),i.areEqual(this.value,r.value)},r.prototype.hashCode=function(){return i.getHashCode(this.value)},r.prototype.toString=function(){return"Some("+i.toStringHelper(this.value)+")"},r.prototype.inspect=function(){return this.toString()},r}(p);n.Some=a;var f=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype.isSome=function(){return!1},r.prototype.isNone=function(){return!0},r.prototype.orElse=function(t){return t},r.prototype.getOrThrow=function(t){throw t||"getOrThrow called on none!"},r.prototype.contains=function(t){return!1},r.prototype.getOrUndefined=function(){},r.prototype.getOrElse=function(t){return t},r.prototype.map=function(t){return n.none},r.prototype.flatMap=function(t){return n.none},r.prototype.filter=function(t){return n.none},r.prototype.ifPresent=function(t){return this},r.prototype.toVector=function(){return o.Vector.empty()},r.prototype.equals=function(t){return t===n.none},r.prototype.hashCode=function(){return 1},r.prototype.toString=function(){return"None()"},r.prototype.inspect=function(){return this.toString()},r}(p);n.None=f,n.none=new f},{"./Comparison":1,"./Contract":2,"./Vector":11}],8:[function(t,r,n){"use strict";n.__esModule=!0;var e=t("./Option");n.shuffle=function(t){for(var r,n,e=t.length;0!==e;)n=Math.floor(Math.random()*e),r=t[e-=1],t[e]=t[n],t[n]=r;return t},n.arrangeBy=function(t,r){return e.Option.of(t.groupBy(r).mapValues(function(t){return t.single()})).filter(function(t){return!t.anyMatch(function(t,r){return r.isNone()})}).map(function(t){return t.mapValues(function(t){return t.getOrThrow()})})},n.seqHasTrueEquality=function(t){return t.find(function(t){return null!=t}).hasTrueEquality()}},{"./Option":7}],9:[function(t,r,n){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}();n.__esModule=!0;var o=t("./Option"),i=t("./Vector"),u=t("./Comparison"),p=t("./Contract"),a=t("./HashMap"),f=t("./HashSet"),s=t("./Lazy"),h=t("./SeqHelpers"),c=function(){function t(){}return t.empty=function(){return v},t.of=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.ofIterable(r)},t.ofIterable=function(r){return t.ofArray(Array.from(r))},t.ofArray=function(r){if(0===r.length)return v;var n=r[0];return new l(n,s.Lazy.of(function(){return t.ofArray(r.slice(1))}))},t.iterate=function(r,n){return new l(r,s.Lazy.of(function(){return t.iterate(n(r),n)}))},t.continually=function(r){return new l(r(),s.Lazy.of(function(){return t.continually(r)}))},t.unfoldRight=function(r,n){var e=n(r);return e.isNone()?v:new l(e.getOrThrow()[0],s.Lazy.of(function(){return t.unfoldRight(e.getOrThrow()[1],n)}))},t.prototype.hasTrueEquality=function(){return h.seqHasTrueEquality(this)},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.arrangeBy=function(t){return h.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(h.shuffle(this.toArray()))},t.prototype.sortOn=function(t){return this.sortBy(function(r,n){return t(r)-t(n)})},t.prototype.transform=function(t){return t(this)},t.prototype.inspect=function(){return this.toString()},t}();n.Stream=c;var y=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e(r,t),r.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},r.prototype.length=function(){return 0},r.prototype.single=function(){return o.Option.none()},r.prototype.isEmpty=function(){return!0},r.prototype.head=function(){return o.Option.none()},r.prototype.tail=function(){return o.Option.none()},r.prototype.last=function(){return o.Option.none()},r.prototype.get=function(t){return o.Option.none()},r.prototype.find=function(t){return o.Option.none()},r.prototype.contains=function(t){return!1},r.prototype.take=function(t){return this},r.prototype.takeWhile=function(t){return this},r.prototype.drop=function(t){return this},r.prototype.dropWhile=function(t){return this},r.prototype.dropRight=function(t){return this},r.prototype.foldLeft=function(t,r){return t},r.prototype.foldRight=function(t,r){return t},r.prototype.zip=function(t){return v},r.prototype.reverse=function(){return this},r.prototype.partition=function(t){return[c.empty(),c.empty()]},r.prototype.groupBy=function(t){return a.HashMap.empty()},r.prototype.append=function(t){return c.of(t)},r.prototype.appendAll=function(t){return c.ofIterable(t)},r.prototype.appendStream=function(t){return t},r.prototype.prepend=function(t){return c.of(t)},r.prototype.prependAll=function(t){return c.ofIterable(t)},r.prototype.cycle=function(){return v},r.prototype.map=function(t){return v},r.prototype.mapOption=function(t){return v},r.prototype.flatMap=function(t){return v},r.prototype.allMatch=function(t){return!0},r.prototype.anyMatch=function(t){return!1},r.prototype.filter=function(t){return this},r.prototype.sortBy=function(t){return this},r.prototype.distinctBy=function(t){return this},r.prototype.forEach=function(t){return this},r.prototype.mkString=function(t){return""},r.prototype.toArray=function(){return[]},r.prototype.toVector=function(){return i.Vector.empty()},r.prototype.toMap=function(t){return a.HashMap.empty()},r.prototype.equals=function(t){return!!t&&t.isEmpty()},r.prototype.hashCode=function(){return 1},r.prototype.toString=function(){return"[]"},r}(c),l=function(t){function r(r,n){var e=t.call(this)||this;return e.value=r,e._tail=n,e}return e(r,t),r.prototype[Symbol.iterator]=function(){var t=this;return{next:function(){if(t.isEmpty())return{done:!0,value:void 0};var r=t.head().getOrThrow();return t=t.tail().getOrThrow(),{done:!1,value:r}}}},r.prototype.length=function(){return this.foldLeft(0,function(t,r){return t+1})},r.prototype.single=function(){return this._tail.get().isEmpty()?o.Option.of(this.value):o.Option.none()},r.prototype.isEmpty=function(){return!1},r.prototype.head=function(){return o.Option.of(this.value)},r.prototype.tail=function(){return o.Option.of(this._tail.get())},r.prototype.last=function(){for(var t=this;;){var r=t.value;if((t=t._tail.get()).isEmpty())return o.Option.of(r)}},r.prototype.get=function(t){for(var r=this,n=0;!r.isEmpty();){if(n===t){var e=r.value;return o.Option.of(e)}r=r._tail.get(),++n}return o.Option.none()},r.prototype.find=function(t){for(var r=this;!r.isEmpty();){var n=r.value;if(t(n))return o.Option.of(n);r=r._tail.get()}return o.Option.none()},r.prototype.contains=function(t){return this.find(function(r){return u.areEqual(r,t)}).isSome()},r.prototype.take=function(t){var n=this;return t<1?v:new r(this.value,s.Lazy.of(function(){return n._tail.get().take(t-1)}))},r.prototype.takeWhile=function(t){var n=this;return t(this.value)?new r(this.value,s.Lazy.of(function(){return n._tail.get().takeWhile(t)})):v},r.prototype.drop=function(t){for(var r=t,n=this;r-- >0&&!n.isEmpty();)n=n._tail.get();return n},r.prototype.dropWhile=function(t){for(var r=this;!r.isEmpty()&&t(r.value);)r=r._tail.get();return r},r.prototype.dropRight=function(t){var r=this.length();return this.take(r-t)},r.prototype.foldLeft=function(t,r){for(var n=t,e=this;!e.isEmpty();)n=r(n,e.value),e=e._tail.get();return n},r.prototype.foldRight=function(t,r){return this.reverse().foldLeft(t,function(t,n){return r(n,t)})},r.prototype.zip=function(t){var n=this,e=t[Symbol.iterator](),o=e.next();return this.isEmpty()||o.done?v:new r([this.value,o.value],s.Lazy.of(function(){return n._tail.get().zip((t={},t[Symbol.iterator]=function(){return e},t));var t}))},r.prototype.reverse=function(){return this.foldLeft(v,function(t,r){return t.prepend(r)})},r.prototype.partition=function(t){return[this.filter(t),this.filter(function(r){return!t(r)})]},r.prototype.groupBy=function(t){return this.foldLeft(a.HashMap.empty(),function(r,n){return r.putWithMerge(t(n),c.of(n),function(t,r){return t.appendStream(r)})})},r.prototype.append=function(t){var n=this._tail.get();return new r(this.value,s.Lazy.of(function(){return n.append(t)}))},r.prototype.appendAll=function(t){return this.appendStream(c.ofIterable(t))},r.prototype.appendStream=function(t){var n=this._tail.get();return new r(this.value,s.Lazy.of(function(){return n.appendStream(t)}))},r.prototype.prepend=function(t){var n=this;return new r(t,s.Lazy.of(function(){return n}))},r.prototype.prependAll=function(t){return c.ofIterable(t).appendAll(this)},r.prototype.cycle=function(){return this._cycle(this)},r.prototype._cycle=function(t){var n=this._tail.get();return new r(this.value,s.Lazy.of(function(){return n.isEmpty()?t.cycle():n._cycle(t)}))},r.prototype.map=function(t){var n=this;return new r(t(this.value),s.Lazy.of(function(){return n._tail.get().map(t)}))},r.prototype.mapOption=function(t){var n=this,e=t(this.value);return e.isSome()?new r(e.getOrThrow(),s.Lazy.of(function(){return n._tail.get().mapOption(t)})):this._tail.get().mapOption(t)},r.prototype.flatMap=function(t){return t(this.value).appendStream(this._tail.get().flatMap(t))},r.prototype.allMatch=function(t){return this.find(function(r){return!t(r)}).isNone()},r.prototype.anyMatch=function(t){return this.find(t).isSome()},r.prototype.filter=function(t){var n=this;return t(this.value)?new r(this.value,s.Lazy.of(function(){return n._tail.get().filter(t)})):this._tail.get().filter(t)},r.prototype.sortBy=function(t){return c.ofIterable(this.toArray().sort(t))},r.prototype.distinctBy=function(t){var r=f.HashSet.empty();return this.filter(function(n){var e=t(n),o=r.contains(e);return o||(r=r.add(e)),!o})},r.prototype.forEach=function(t){for(var r=this;!r.isEmpty();)t(r.value),r=r._tail.get();return this},r.prototype.mkString=function(t){for(var r="",n=this,e=!1;!n.isEmpty();)e&&(r+=t),r+=n.value.toString(),n=n._tail.get(),e=!0;return r},r.prototype.toArray=function(){var t=this._tail.get().toArray();return t.unshift(this.value),t},r.prototype.toVector=function(){return i.Vector.ofIterable(this.toArray())},r.prototype.toMap=function(t){return this.foldLeft(a.HashMap.empty(),function(r,n){var e=t(n);return r.put(e[0],e[1])})},r.prototype.equals=function(t){if(!t||!t.tail)return!1;p.contractTrueEquality("Stream.equals",this,t);for(var r=this,n=t;;){if(r.isEmpty()!==n.isEmpty())return!1;if(r.isEmpty())return!0;var e=r.value,o=n.value;if(void 0===e!=(void 0===o))return!1;if(void 0!==e&&void 0!==o){if(!u.areEqual(e,o))return!1;r=r._tail.get(),n=n._tail.get()}}},r.prototype.hashCode=function(){for(var t=1,r=this;!r.isEmpty();)t=31*t+u.getHashCode(r.value),r=r._tail.get();return t},r.prototype.toString=function(){for(var t=this,r="Stream(";!t.isEmpty();){r+=u.toStringHelper(t.value);var n=t._tail;if(!n.isEvaluated()){r+=", ?";break}(t=n.get()).isEmpty()||(r+=", ")}return r+")"},r}(c),v=new y},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./Option":7,"./SeqHelpers":8,"./Vector":11}],10:[function(t,r,n){"use strict";n.__esModule=!0;var e=t("./Option"),o=t("./Comparison"),i=t("./Contract"),u=function(){function t(t,r){this._fst=t,this._snd=r}return t.of=function(r,n){return new t(r,n)},t.ofArray=function(r){return new t(r[0],r[1])},t.prototype.hasTrueEquality=function(){return e.Option.of(this.fst()).hasTrueEquality()&&e.Option.of(this.snd()).hasTrueEquality()},t.prototype.fst=function(){return this._fst},t.prototype.snd=function(){return this._snd},t.prototype.map1=function(r){return new t(r(this._fst),this._snd)},t.prototype.map2=function(r){return new t(this._fst,r(this._snd))},t.prototype.map=function(t){return t(this._fst,this._snd)},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){return!(!t||!t._fst)&&(i.contractTrueEquality("Tuple2.equals",this,t),o.areEqual(this._fst,t._fst)&&o.areEqual(this._snd,t._snd))},t.prototype.hashCode=function(){return 53*o.getHashCode(this._fst)+o.getHashCode(this._snd)},t.prototype.toString=function(){return"Tuple2("+o.toStringHelper(this._fst)+", "+o.toStringHelper(this._snd)+")"},t.prototype.inspect=function(){return this.toString()},t}();n.Tuple2=u},{"./Comparison":1,"./Contract":2,"./Option":7}],11:[function(t,r,n){"use strict";n.__esModule=!0;var e=t("./Comparison"),o=t("./Contract"),i=t("./HashMap"),u=t("./Option"),p=t("./HashSet"),a=t("./SeqHelpers"),f=t("hamt_plus"),s=function(){function t(t,r){this.hamt=t,this.indexShift=r}return t.empty=function(){return t.emptyVector},t.ofIterable=function(r){return t.emptyVector.appendAll(r)},t.of=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.ofIterable(r)},t.unfoldRight=function(r,n){return new t(f.empty.mutate(function(t){for(var e=0,o=n(r);o.isSome();)t.set(e++,o.getOrThrow()[0]),o=n(o.getOrThrow()[1])}),0)},t.prototype[Symbol.iterator]=function(){var t=0,r=this.hamt;return{next:function(){return t<r.size?{done:!1,value:r.get(t++)}:{done:!0,value:void 0}}}},t.prototype.toArray=function(){for(var t=[],r=0;r<this.hamt.size;r++)t.push(this.hamt.get(r+this.indexShift));return t},t.prototype.hasTrueEquality=function(){return a.seqHasTrueEquality(this)},t.prototype.length=function(){return this.hamt.size},t.prototype.single=function(){return 1===this.hamt.size?u.Option.of(this.hamt.get(this.indexShift)):u.Option.none()},t.prototype.isEmpty=function(){return 0===this.hamt.size},t.prototype.head=function(){return u.Option.of(this.hamt.get(this.indexShift))},t.prototype.last=function(){return u.Option.of(this.hamt.get(this.hamt.size+this.indexShift-1))},t.prototype.tail=function(){return this.isEmpty()?u.Option.none():u.Option.of(new t(this.hamt.remove(this.indexShift),this.indexShift+1))},t.prototype.append=function(r){return new t(this.hamt.set(this.hamt.size+this.indexShift,r),this.indexShift)},t.prototype.prepend=function(r){var n=this.indexShift-1;return new t(this.hamt.set(n,r),n)},t.prototype.prependAll=function(r){for(var n=Array.from(r),e=this.indexShift-n.length,o=this.hamt,i=0;i<n.length;i++)o=o.set(e+i,n[i]);return new t(o,e)},t.prototype.forEach=function(t){for(var r=0;r<this.hamt.size;r++)t(this.hamt.get(r+this.indexShift));return this},t.prototype.appendAll=function(r){var n=this;return new t(this.hamt.mutate(function(t){for(var e=r[Symbol.iterator](),o=e.next();!o.done;)t.set(t.size+n.indexShift,o.value),o=e.next()}),this.indexShift)},t.prototype.map=function(r){var n=this;return new t(f.empty.mutate(function(t){n.hamt.fold(function(t,e,o){return t.set(o-n.indexShift,r(e))},t)}),0)},t.prototype.mapOption=function(r){var n=this;return new t(f.empty.mutate(function(t){for(var e=0,o=0;o<n.hamt.size;o++){var i=n.hamt.get(o+n.indexShift),u=r(i);u.isSome()&&t.set(e++,u.getOrThrow())}}),0)},t.prototype.filter=function(r){var n=this;return new t(f.empty.mutate(function(t){for(var e=0,o=0;o<n.hamt.size;o++){var i=n.hamt.get(o+n.indexShift);r(i)&&t.set(e++,i)}}),0)},t.prototype.find=function(t){for(var r=0;r<this.hamt.size;r++){var n=this.hamt.get(r+this.indexShift);if(t(n))return u.Option.of(n)}return u.Option.none()},t.prototype.contains=function(t){return this.anyMatch(function(r){return e.areEqual(r,t)})},t.prototype.flatMap=function(r){for(var n=[],e=0;e<this.hamt.size;e++)n=n.concat(r(this.hamt.get(e+this.indexShift)).toArray());return t.ofIterable(n)},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.foldLeft=function(t,r){for(var n=t,e=0;e<this.hamt.size;e++)n=r(n,this.hamt.get(e+this.indexShift));return n},t.prototype.foldRight=function(t,r){for(var n=t,e=this.hamt.size-1;e>=0;e--)n=r(this.hamt.get(e+this.indexShift),n);return n},t.prototype.mkString=function(t){for(var r="",n=0;n<this.hamt.size;n++)n>0&&(r+=t),r+=this.hamt.get(n+this.indexShift).toString();return r},t.prototype.get=function(t){return u.Option.of(this.hamt.get(t+this.indexShift))},t.prototype.drop=function(r){var n=this;return r>=this.hamt.size?t.emptyVector:new t(this.hamt.fold(function(t,e,o){return o-n.indexShift>=r?t.set(o-n.indexShift-r,e):t},f.make()),0)},t.prototype.dropWhile=function(r){for(var n=f.make(),e=!0,o=0,i=0;i<this.hamt.size;i++){var u=this.hamt.get(i+this.indexShift);e&&!r(u)&&(e=!1),e||(n=n.set(o++,u))}return new t(n,0)},t.prototype.takeWhile=function(r){for(var n=f.make(),e=0,o=0;o<this.hamt.size;o++){var i=this.hamt.get(o+this.indexShift);if(!r(i))break;n=n.set(e++,i)}return new t(n,0)},t.prototype.dropRight=function(r){var n=this,e=this.hamt.size;return r>=e?t.emptyVector:new t(this.hamt.fold(function(t,o,i){return e-i+n.indexShift>r?t.set(i-n.indexShift,o):t},f.make()),0)},t.prototype.allMatch=function(t){for(var r=this.hamt.values(),n=r.next();!n.done;){if(!t(n.value))return!1;n=r.next()}return!0},t.prototype.anyMatch=function(t){for(var r=this.hamt.values(),n=r.next();!n.done;){if(t(n.value))return!0;n=r.next()}return!1},t.prototype.sortBy=function(r){return t.ofIterable(this.toArray().sort(r))},t.prototype.sortOn=function(t){return this.sortBy(function(r,n){return t(r)-t(n)})},t.prototype.groupBy=function(r){return this.hamt.fold(function(t,n,e){return t.putWithMerge(r(n),f.beginMutation(f.make()).set(0,n),function(t,r){return t.set(t.size,r.get(0))})},i.HashMap.empty()).mapValues(function(r){return new t(r.endMutation(),0)})},t.prototype.arrangeBy=function(t){return a.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(a.shuffle(this.toArray()))},t.prototype.toMap=function(t){return this.hamt.fold(function(r,n,e){var o=t(n);return r.put(o[0],o[1])},i.HashMap.empty())},t.prototype.zip=function(r){var n=this;return new t(f.empty.mutate(function(t){for(var e=0,o=n[Symbol.iterator](),i=r[Symbol.iterator](),u=o.next(),p=i.next();!u.done&&!p.done;)t.set(e++,[u.value,p.value]),u=o.next(),p=i.next()}),0)},t.prototype.reverse=function(){var r=this,n=this.hamt.size-1+this.indexShift;return new t(f.empty.mutate(function(t){return r.hamt.fold(function(t,r,e){return t.set(n-e,r)},t)}),0)},t.prototype.partition=function(r){var n=this,e=[null,null];return f.empty.mutate(function(o){return f.empty.mutate(function(i){for(var u=0,p=0,a=0;a<n.hamt.size;a++){var f=n.hamt.get(a+n.indexShift);r(f)?o.set(u++,f):i.set(p++,f)}e[0]=new t(o,0),e[1]=new t(i,0)})}),e},t.prototype.distinctBy=function(r){var n=this,e=p.HashSet.empty();return new t(f.empty.mutate(function(t){for(var o=0,i=0;i<n.hamt.size;i++){var u=n.hamt.get(i+n.indexShift),p=r(u);e.contains(p)||(t.set(o++,u),e=e.add(p))}}),0)},t.prototype.transform=function(t){return t(this)},t.prototype.equals=function(t){if(!t||!t.hamt)return!1;if(this.hamt.size!==t.hamt.size)return!1;o.contractTrueEquality("Vector.equals",this,t);for(var r=0;r<this.hamt.size;r++){var n=this.hamt.get(r+this.indexShift),i=t.hamt.get(r+t.indexShift);if(void 0===n!=(void 0===i))return!1;if(void 0!==n&&void 0!==i&&!e.areEqual(n,i))return!1}return!0},t.prototype.hashCode=function(){for(var t=1,r=0;r<this.hamt.size;r++)t=31*t+e.getHashCode(this.hamt.get(r+this.indexShift));return t},t.prototype.toString=function(){for(var t="Vector(",r=0;r<this.hamt.size;r++)r>0&&(t+=", "),t+=e.toStringHelper(this.hamt.get(r+this.indexShift));return t+")"},t.prototype.inspect=function(){return this.toString()},t.emptyVector=new t(f.make(),0),t}();n.Vector=s},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Option":7,"./SeqHelpers":8,hamt_plus:13}],12:[function(t,r,n){"use strict";function e(t){for(var r in t)n.hasOwnProperty(r)||(n[r]=t[r])}n.__esModule=!0,e(t("./Option")),e(t("./Lazy")),e(t("./Vector")),e(t("./List")),e(t("./HashMap")),e(t("./HashSet")),e(t("./Tuple2")),e(t("./Comparison")),e(t("./Stream")),e(t("./Contract"))},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./List":6,"./Option":7,"./Stream":9,"./Tuple2":10,"./Vector":11}],13:[function(t,r,n){"use strict";function e(t,r,n,e,o){this._editable=t,this._edit=r,this._config=n,this._root=e,this._size=o}function o(t){this.v=t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u={},p=Math.pow(2,5),a=p-1,f=p/2,s=p/4,h={},c=function(t){return function(){return t}},y=u.hash=function(t){var r=void 0===t?"undefined":i(t);if("number"===r)return t;"string"!==r&&(t+="");for(var n=0,e=0,o=t.length;e<o;++e)n=(n<<5)-n+t.charCodeAt(e)|0;return n},l=function(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)},v=function(t,r){return r>>>t&a},m=function(t){return 1<<t},d=function(t,r){return l(t&r-1)},g=function(t,r,n,e){var o=e;if(!t){var i=e.length;o=new Array(i);for(var u=0;u<i;++u)o[u]=e[u]}return o[r]=n,o},_=function(t,r,n){var e=n.length-1,o=0,i=0,u=n;if(t)o=i=r;else for(u=new Array(e);o<r;)u[i++]=n[o++];for(++o;o<=e;)u[i++]=n[o++];return t&&(u.length=e),u},S=function(t,r,n,e){var o=e.length;if(t){for(var i=o;i>=r;)e[i--]=e[i];return e[r]=n,e}for(var u=0,p=0,a=new Array(o+1);u<r;)a[p++]=e[u++];for(a[r]=n;u<o;)a[++p]=e[u++];return a},O={__hamt_isEmpty:!0},E=function(t){return t===O||t&&t.__hamt_isEmpty},w=function(t,r,n,e){return{type:1,edit:t,hash:r,key:n,value:e,_modify:T}},b=function(t,r,n){return{type:2,edit:t,hash:r,children:n,_modify:L}},q=function(t,r,n){return{type:3,edit:t,mask:r,children:n,_modify:V}},x=function(t,r,n){return{type:4,edit:t,size:r,children:n,_modify:I}},M=function(t){return t===O||1===t.type||2===t.type},H=function(t,r,n,e,o){for(var i=[],u=e,p=0,a=0;u;++a)1&u&&(i[a]=o[p++]),u>>>=1;return i[r]=n,x(t,p+1,i)},k=function(t,r,n,e){for(var o=new Array(r-1),i=0,u=0,p=0,a=e.length;p<a;++p)if(p!==n){var f=e[p];f&&!E(f)&&(o[i++]=f,u|=1<<p)}return q(t,u,o)},z=function t(r,n,e,o,i,u){if(e===i)return b(r,e,[u,o]);var p=v(n,e),a=v(n,i);return q(r,m(p)|m(a),p===a?[t(r,n+5,e,o,i,u)]:p<a?[o,u]:[u,o])},C=function(t,r,n,e,o,i,u,p){for(var a=o.length,f=0;f<a;++f){var s=o[f];if(n(u,s.key)){var c=s.value,y=i(c);return y===c?o:y===h?(--p.value,_(t,f,o)):g(t,f,w(r,e,u,y),o)}}var l=i();return l===h?o:(++p.value,g(t,a,w(r,e,u,l),o))},A=function(t,r){return t===r.edit},T=function(t,r,n,e,o,i,u){if(r(i,this.key)){var p=e(this.value);return p===this.value?this:p===h?(--u.value,O):A(t,this)?(this.value=p,this):w(t,o,i,p)}var a=e();return a===h?this:(++u.value,z(t,n,this.hash,this,o,w(t,o,i,a)))},L=function(t,r,n,e,o,i,u){if(o===this.hash){var p=A(t,this),a=C(p,t,r,this.hash,this.children,e,i,u);return a===this.children?this:a.length>1?b(t,this.hash,a):a[0]}var f=e();return f===h?this:(++u.value,z(t,n,this.hash,this,o,w(t,o,i,f)))},V=function(t,r,n,e,o,i,u){var p=this.mask,a=this.children,s=v(n,o),h=m(s),c=d(p,h),y=p&h,l=y?a[c]:O,w=l._modify(t,r,n+5,e,o,i,u);if(l===w)return this;var b=A(t,this),x=p,k=void 0;if(y&&E(w)){if(!(x&=~h))return O;if(a.length<=2&&M(a[1^c]))return a[1^c];k=_(b,c,a)}else if(y||E(w))k=g(b,c,w,a);else{if(a.length>=f)return H(t,s,w,p,a);x|=h,k=S(b,c,w,a)}return b?(this.mask=x,this.children=k,this):q(t,x,k)},I=function(t,r,n,e,o,i,u){var p=this.size,a=this.children,f=v(n,o),h=a[f],c=(h||O)._modify(t,r,n+5,e,o,i,u);if(h===c)return this;var y=A(t,this),l=void 0;if(E(h)&&!E(c))++p,l=g(y,f,c,a);else if(!E(h)&&E(c)){if(--p<=s)return k(t,p,f,a);l=g(y,f,O,a)}else l=g(y,f,c,a);return y?(this.size=p,this.children=l,this):x(t,p,l)};O._modify=function(t,r,n,e,o,i,u){var p=e();return p===h?O:(++u.value,w(t,o,i,p))},e.prototype.setTree=function(t,r){return this._editable?(this._root=t,this._size=r,this):t===this._root?this:new e(this._editable,this._edit,this._config,t,r)};var B=u.tryGetHash=function(t,r,n,e){for(var o=e._root,i=0,u=e._config.keyEq;;)switch(o.type){case 1:return u(n,o.key)?o.value:t;case 2:if(r===o.hash)for(var p=o.children,a=0,f=p.length;a<f;++a){var s=p[a];if(u(n,s.key))return s.value}return t;case 3:var h=v(i,r),c=m(h);if(o.mask&c){o=o.children[d(o.mask,c)],i+=5;break}return t;case 4:if(o=o.children[v(i,r)]){i+=5;break}return t;default:return t}};e.prototype.tryGetHash=function(t,r,n){return B(t,r,n,this)};var W=u.tryGet=function(t,r,n){return B(t,n._config.hash(r),r,n)};e.prototype.tryGet=function(t,r){return W(t,r,this)};var R=u.getHash=function(t,r,n){return B(void 0,t,r,n)};e.prototype.getHash=function(t,r){return R(t,r,this)};u.get=function(t,r){return B(void 0,r._config.hash(t),t,r)};e.prototype.get=function(t,r){return W(r,t,this)};var N=u.has=function(t,r,n){return B(h,t,r,n)!==h};e.prototype.hasHash=function(t,r){return N(t,r,this)};var j=u.has=function(t,r){return N(r._config.hash(t),t,r)};e.prototype.has=function(t){return j(t,this)};var P=function(t,r){return t===r};u.make=function(t){return new e(0,0,{keyEq:t&&t.keyEq||P,hash:t&&t.hash||y},O,0)},u.empty=u.make();var U=u.isEmpty=function(t){return t&&!!E(t._root)};e.prototype.isEmpty=function(){return U(this)};var G=u.modifyHash=function(t,r,n,e){var o={value:e._size},i=e._root._modify(e._editable?e._edit:NaN,e._config.keyEq,0,t,r,n,o);return e.setTree(i,o.value)};e.prototype.modifyHash=function(t,r,n){return G(n,t,r,this)};var D=u.modify=function(t,r,n){return G(t,n._config.hash(r),r,n)};e.prototype.modify=function(t,r){return D(r,t,this)};var F=u.setHash=function(t,r,n,e){return G(c(n),t,r,e)};e.prototype.setHash=function(t,r,n){return F(t,r,n,this)};var J=u.set=function(t,r,n){return F(n._config.hash(t),t,r,n)};e.prototype.set=function(t,r){return J(t,r,this)};var K=c(h),Q=u.removeHash=function(t,r,n){return G(K,t,r,n)};e.prototype.removeHash=e.prototype.deleteHash=function(t,r){return Q(t,r,this)};var X=u.remove=function(t,r){return Q(r._config.hash(t),t,r)};e.prototype.remove=e.prototype.delete=function(t){return X(t,this)};var Y=u.beginMutation=function(t){return new e(t._editable+1,t._edit+1,t._config,t._root,t._size)};e.prototype.beginMutation=function(){return Y(this)};var Z=u.endMutation=function(t){return t._editable=t._editable&&t._editable-1,t};e.prototype.endMutation=function(){return Z(this)};var $=u.mutate=function(t,r){var n=Y(r);return t(n),Z(n)};e.prototype.mutate=function(t){return $(t,this)};var tt=function(t){return t&&rt(t[0],t[1],t[2],t[3],t[4])},rt=function(t,r,n,e,o){for(;n<t;){var i=r[n++];if(i&&!E(i))return nt(i,e,[t,r,n,e,o])}return tt(o)},nt=function(t,r,n){switch(t.type){case 1:return{value:r(t),rest:n};case 2:case 4:case 3:var e=t.children;return rt(e.length,e,0,r,n);default:return tt(n)}},et={done:!0};o.prototype.next=function(){if(!this.v)return et;var t=this.v;return this.v=tt(t.rest),t},o.prototype[Symbol.iterator]=function(){return this};var ot=function(t,r){return new o(nt(t._root,r))},it=function(t){return[t.key,t.value]},ut=u.entries=function(t){return ot(t,it)};e.prototype.entries=e.prototype[Symbol.iterator]=function(){return ut(this)};var pt=function(t){return t.key},at=u.keys=function(t){return ot(t,pt)};e.prototype.keys=function(){return at(this)};var ft=function(t){return t.value},st=u.values=e.prototype.values=function(t){return ot(t,ft)};e.prototype.values=function(){return st(this)};var ht=u.fold=function(t,r,n){var e=n._root;if(1===e.type)return t(r,e.value,e.key);for(var o=[e.children],i=void 0;i=o.pop();)for(var u=0,p=i.length;u<p;){var a=i[u++];a&&a.type&&(1===a.type?r=t(r,a.value,a.key):o.push(a.children))}return r};e.prototype.fold=function(t,r){return ht(t,r,this)};var ct=u.forEach=function(t,r){return ht(function(n,e,o){return t(e,o,r)},null,r)};e.prototype.forEach=function(t){return ct(t,this)};var yt=u.count=function(t){return t._size};e.prototype.count=function(){return yt(this)},Object.defineProperty(e.prototype,"size",{get:e.prototype.count}),void 0!==r&&r.exports?r.exports=u:(void 0).hamt=u},{}]},{},[12])(12)}); |
@@ -217,3 +217,5 @@ "use strict"; | ||
var _this = this; | ||
return new Vector(this.hamt.fold(function (acc, v, k) { return acc.set(k - _this.indexShift, mapper(v)); }, hamt.empty), 0); | ||
return new Vector(hamt.empty.mutate(function (h_) { | ||
_this.hamt.fold(function (acc, v, k) { return acc.set(k - _this.indexShift, mapper(v)); }, h_); | ||
}), 0); | ||
}; | ||
@@ -498,4 +500,7 @@ /** | ||
return this.hamt.fold(function (acc, v, k) { | ||
return acc.putWithMerge(classifier(v), Vector.of(v), function (v1, v2) { return v1.appendAll(v2); }); | ||
}, HashMap_1.HashMap.empty()); | ||
return acc.putWithMerge(classifier(v), hamt.beginMutation(hamt.make()).set(0, v), function (v1, v2) { | ||
return v1.set(v1.size, v2.get(0)); | ||
}); | ||
}, HashMap_1.HashMap.empty()) | ||
.mapValues(function (h) { return new Vector(h.endMutation(), 0); }); | ||
}; | ||
@@ -564,3 +569,6 @@ /** | ||
var sz = this.hamt.size; | ||
return new Vector(this.hamt.fold(function (h, v, k) { return h.set(sz - 1 - k + _this.indexShift, v); }, hamt.make()), 0); | ||
var basis = sz - 1 + this.indexShift; | ||
return new Vector(hamt.empty.mutate(function (hamt2) { | ||
return _this.hamt.fold(function (h, v, k) { return h.set(basis - k, v); }, hamt2); | ||
}), 0); | ||
}; | ||
@@ -567,0 +575,0 @@ /** |
@@ -29,2 +29,3 @@ "use strict"; | ||
" import { Stream } from './dist/src/Stream';" + | ||
" import { List } from './dist/src/List';" + | ||
" import { HashMap } from './dist/src/HashMap';" + | ||
@@ -31,0 +32,0 @@ " import { Option } from './dist/src/Option';" + |
{ | ||
"name": "prelude.ts", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A typescript functional programming library", | ||
@@ -21,3 +21,4 @@ "main": "dist/src/index.js", | ||
"browserify": "14.4.0", | ||
"uglify-js": "3.1.2" | ||
"uglify-js": "3.1.2", | ||
"immutable": "4.0.0-rc.3" | ||
}, | ||
@@ -24,0 +25,0 @@ "keywords": [ |
@@ -83,2 +83,12 @@ # prelude.ts | ||
Typescript must know about `Iterable`, an ES6 feature (but present in most browsers) | ||
to compile prelude.ts. If you target ES5, a minimum change to your tsconfig.json | ||
could be to add: | ||
```json | ||
"lib": ["DOM", "ES5", "ScriptHost", "es2015.iterable"] | ||
``` | ||
(compared to the default es5 settings it only adds 'es2015.iterable') | ||
### Using in nodejs | ||
@@ -103,3 +113,2 @@ | ||
``` | ||
(the minified JS file is 42kb as of 0.3.1) | ||
@@ -106,0 +115,0 @@ You shouldn't have an issue to import prelude.ts in your application, but if you use |
@@ -12,2 +12,10 @@ // http://bit.ly/object-formatters | ||
function getWithToArrayBody(elt: any): any { | ||
return ["ol", | ||
{"style":olStyle}, | ||
...elt.toArray().map((x:any,idx:number) => ["li",{}, | ||
["span",{"style":"color: rgb(136, 19, 145);"},idx+": "], | ||
["object", {"object":x}]])]; | ||
} | ||
class VectorHandler implements ElementHandler { | ||
@@ -23,9 +31,3 @@ isElement(object:any): boolean { | ||
} | ||
getBody(elt:any): any { | ||
return ["ol", | ||
{"style":olStyle}, | ||
...elt.toArray().map((x:any,idx:number) => ["li",{}, | ||
["span",{"style":"color: rgb(136, 19, 145);"},idx+": "], | ||
["object", {"object":x}]])]; | ||
} | ||
getBody = getWithToArrayBody | ||
} | ||
@@ -36,3 +38,3 @@ | ||
isElement(object:any): boolean { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
return object.hashCode && object.equals && object.sortBy && object.cycle && object.toVector; | ||
} | ||
@@ -47,9 +49,18 @@ getHeader(object:any): any { | ||
} | ||
getBody(elt:any): any { | ||
return ["ol", | ||
{"style":olStyle}, | ||
...elt.toArray().map((x:any,idx:number) => ["li",{}, | ||
["span",{"style":"color: rgb(136, 19, 145);"},idx+": "], | ||
["object", {"object":x}]])]; | ||
getBody = getWithToArrayBody | ||
} | ||
class ListHandler implements ElementHandler { | ||
isElement(object:any): boolean { | ||
return object.hashCode && object.equals && object.sortBy && object.toVector; | ||
} | ||
getHeader(object:any): any { | ||
// not displaying the length for streams in case | ||
// of infinite streams. the user can expand if needed. | ||
return ["span", {}, "List(" + object.length() + ")"]; | ||
} | ||
hasBody(elt:any): boolean { | ||
return !elt.isEmpty(); | ||
} | ||
getBody = getWithToArrayBody | ||
} | ||
@@ -67,9 +78,3 @@ | ||
} | ||
getBody(elt:any): any { | ||
return ["ol", | ||
{"style":olStyle}, | ||
...elt.toArray().map((x:any,idx:number) => ["li",{}, | ||
["span",{"style":"color: rgb(136, 19, 145);"},idx+": "], | ||
["object", {"object":x}]])]; | ||
} | ||
getBody = getWithToArrayBody | ||
} | ||
@@ -104,2 +109,3 @@ | ||
new StreamHandler(), | ||
new ListHandler(), | ||
new HashSetHandler(), | ||
@@ -106,0 +112,0 @@ new HashMapHandler()]; |
@@ -9,2 +9,3 @@ // Not re-exporting the abstract types such as Seq, Collection and so on, | ||
export * from "./Vector"; | ||
export * from "./List"; | ||
export * from "./HashMap"; | ||
@@ -11,0 +12,0 @@ export * from "./HashSet"; |
@@ -33,3 +33,3 @@ import { Seq } from "./Seq"; | ||
} | ||
/** | ||
@@ -77,3 +77,3 @@ * Build a vector from any iterable, which means also | ||
} | ||
/** | ||
@@ -237,5 +237,8 @@ * Implementation of the Iterator interface. | ||
map<U>(mapper:(v:T)=>U): Vector<U> { | ||
return new Vector<U>(this.hamt.fold( | ||
(acc: any, v:T & WithEquality, k:number) => acc.set(k-this.indexShift, mapper(v)), | ||
hamt.empty), 0); | ||
return new Vector<U>(hamt.empty.mutate( | ||
(h_:any) => { | ||
this.hamt.fold( | ||
(acc: any, v:T & WithEquality, k:number) => acc.set(k-this.indexShift, mapper(v)), | ||
h_) | ||
}), 0); | ||
} | ||
@@ -303,3 +306,3 @@ | ||
} | ||
/** | ||
@@ -542,6 +545,8 @@ * Calls the function you give for each item in the collection, | ||
return this.hamt.fold( | ||
(acc: HashMap<C,Vector<T>>, v:T & WithEquality, k:number) => | ||
(acc: HashMap<C,any>, v:T & WithEquality, k:number) => | ||
acc.putWithMerge( | ||
classifier(v), Vector.of(v), | ||
(v1:Vector<T&WithEquality>,v2:Vector<T&WithEquality>)=>v1.appendAll(v2)), HashMap.empty()); | ||
classifier(v), hamt.beginMutation(hamt.make()).set(0,v), | ||
(v1:any,v2:any)=> | ||
v1.set(v1.size, v2.get(0))), HashMap.empty()) | ||
.mapValues((h:any) => new Vector<T>(h.endMutation(), 0)); | ||
} | ||
@@ -616,5 +621,7 @@ | ||
const sz = this.hamt.size; | ||
return new Vector<T>(this.hamt.fold( | ||
(h:any,v:T,k:number) => h.set(sz-1-k+this.indexShift, v), | ||
hamt.make()), 0); | ||
const basis = sz-1+this.indexShift; | ||
return new Vector<T>(hamt.empty.mutate((hamt2:any) => | ||
this.hamt.fold( | ||
(h:any,v:T,k:number) => h.set(basis-k, v), | ||
hamt2)), 0); | ||
} | ||
@@ -621,0 +628,0 @@ |
@@ -32,2 +32,3 @@ import * as ts from "typescript"; | ||
" import { Stream } from './dist/src/Stream';" + | ||
" import { List } from './dist/src/List';" + | ||
" import { HashMap } from './dist/src/HashMap';" + | ||
@@ -34,0 +35,0 @@ " import { Option } from './dist/src/Option';" + |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2254076
156
18187
185
8