prelude.ts
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -152,2 +152,7 @@ import { ISet } from "./ISet"; | ||
/** | ||
* Returns a new set with the element you give removed | ||
* if it was present in the set. | ||
*/ | ||
remove(elt: T & WithEquality): HashSet<T>; | ||
/** | ||
* Returns a new set with all the elements of the current | ||
@@ -154,0 +159,0 @@ * Set, minus the elements of the iterable you give as a parameter. |
@@ -237,2 +237,9 @@ "use strict"; | ||
/** | ||
* Returns a new set with the element you give removed | ||
* if it was present in the set. | ||
*/ | ||
HashSet.prototype.remove = function (elt) { | ||
return new HashSet(this.hamt.remove(elt)); | ||
}; | ||
/** | ||
* Returns a new set with all the elements of the current | ||
@@ -445,2 +452,5 @@ * Set, minus the elements of the iterable you give as a parameter. | ||
}; | ||
EmptyHashSet.prototype.remove = function (elt) { | ||
return this; | ||
}; | ||
EmptyHashSet.prototype.equals = function (other) { | ||
@@ -447,0 +457,0 @@ if (!other || !other.length) { |
@@ -12,1 +12,2 @@ export * from "./Option"; | ||
export * from "./Contract"; | ||
export * from "./Predicate"; |
@@ -21,2 +21,3 @@ "use strict"; | ||
__export(require("./Contract")); | ||
__export(require("./Predicate")); | ||
//# sourceMappingURL=index.js.map |
@@ -190,2 +190,10 @@ import { Option } from "./Option"; | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* List.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): List<[T, number]>; | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -233,2 +241,7 @@ * | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
abstract removeFirst(predicate: (v: T) => boolean): List<T>; | ||
/** | ||
* Prepend an element at the beginning of the collection. | ||
@@ -235,0 +248,0 @@ */ |
@@ -107,2 +107,12 @@ "use strict"; | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* List.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
List.prototype.zipWithIndex = function () { | ||
return SeqHelpers.zipWithIndex(this); | ||
}; | ||
/** | ||
* Matches each element with a unique key that you extract from it. | ||
@@ -226,2 +236,5 @@ * If the same key is present twice, the function will return None. | ||
}; | ||
EmptyList.prototype.removeFirst = function (predicate) { | ||
return this; | ||
}; | ||
EmptyList.prototype.prepend = function (elt) { | ||
@@ -448,2 +461,17 @@ return new ConsList(elt, this); | ||
}; | ||
ConsList.prototype.removeFirst = function (predicate) { | ||
var curItem = this; | ||
var result = emptyList; | ||
var removed = false; | ||
while (!curItem.isEmpty()) { | ||
if (predicate(curItem.value) && !removed) { | ||
removed = true; | ||
} | ||
else { | ||
result = new ConsList(curItem.value, result); | ||
} | ||
curItem = curItem._tail; | ||
} | ||
return result.reverse(); | ||
}; | ||
ConsList.prototype.prepend = function (elt) { | ||
@@ -450,0 +478,0 @@ return new ConsList(elt, this); |
/** | ||
* prelude.ts v0.3.3 | ||
* prelude.ts v0.3.4 | ||
* 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(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)}); | ||
!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":12,hamt_plus:14}],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.remove=function(r){return new t(this.hamt.remove(r))},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.remove=function(t){return 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":12,hamt_plus:14}],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.zipWithIndex=function(){return s.zipWithIndex(this)},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.removeFirst=function(t){return this},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.removeFirst=function(t){for(var n=this,e=l,o=!1;!n.isEmpty();)t(n.value)&&!o?o=!0:e=new r(n.value,e),n=n._tail;return e.reverse()},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":9,"./Vector":12}],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":12}],8:[function(t,r,n){"use strict";n.__esModule=!0;var e=t("./Comparison"),o=t("./List"),i=function(){function t(){}return t.lift=function(r){var n=r;return n.and=function(r){return t.lift(function(t){return n(t)&&r(t)})},n.or=function(r){return t.lift(function(t){return n(t)||r(t)})},n.negate=function(){return t.lift(function(t){return!r(t)})},n},t.equals=function(r){return t.lift(function(t){return e.areEqual(r,t)})},t.isIn=function(r){return t.lift(function(t){return o.List.ofIterable(r).contains(t)})},t.allOf=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.lift(function(t){return o.List.ofIterable(r).allMatch(function(r){return r(t)})})},t.anyOf=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.lift(function(t){return o.List.ofIterable(r).anyMatch(function(r){return r(t)})})},t.noneOf=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.lift(function(t){return!o.List.ofIterable(r).anyMatch(function(r){return r(t)})})},t}();n.Predicates=i},{"./Comparison":1,"./List":6}],9:[function(t,r,n){"use strict";n.__esModule=!0;var e=t("./Option"),o=t("./Stream");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()},n.zipWithIndex=function(t){return t.zip(o.Stream.iterate(0,function(t){return t+1}))}},{"./Option":7,"./Stream":10}],10:[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("./List"),c=t("./SeqHelpers"),y=function(){function t(){}return t.empty=function(){return m},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 m;var n=r[0];return new v(n,s.Lazy.of(function(){return t.ofArray(r.slice(1))}))},t.iterate=function(r,n){return new v(r,s.Lazy.of(function(){return t.iterate(n(r),n)}))},t.continually=function(r){return new v(r(),s.Lazy.of(function(){return t.continually(r)}))},t.unfoldRight=function(r,n){var e=n(r);return e.isNone()?m:new v(e.getOrThrow()[0],s.Lazy.of(function(){return t.unfoldRight(e.getOrThrow()[1],n)}))},t.prototype.hasTrueEquality=function(){return c.seqHasTrueEquality(this)},t.prototype.fold=function(t,r){return this.foldLeft(t,r)},t.prototype.zipWithIndex=function(){return c.zipWithIndex(this)},t.prototype.arrangeBy=function(t){return c.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(c.shuffle(this.toArray()))},t.prototype.sortOn=function(t){return this.sortBy(function(r,n){return t(r)-t(n)})},t.prototype.toList=function(){return h.List.ofIterable(this)},t.prototype.transform=function(t){return t(this)},t.prototype.inspect=function(){return this.toString()},t}();n.Stream=y;var l=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 m},r.prototype.reverse=function(){return this},r.prototype.partition=function(t){return[y.empty(),y.empty()]},r.prototype.groupBy=function(t){return a.HashMap.empty()},r.prototype.append=function(t){return y.of(t)},r.prototype.appendAll=function(t){return y.ofIterable(t)},r.prototype.removeFirst=function(t){return this},r.prototype.appendStream=function(t){return t},r.prototype.prepend=function(t){return y.of(t)},r.prototype.prependAll=function(t){return y.ofIterable(t)},r.prototype.cycle=function(){return m},r.prototype.map=function(t){return m},r.prototype.mapOption=function(t){return m},r.prototype.flatMap=function(t){return m},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}(y),v=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?m: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)})):m},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?m: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(m,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),y.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(y.ofIterable(t))},r.prototype.removeFirst=function(t){var n=this._tail.get();return t(this.value)?n:new r(this.value,s.Lazy.of(function(){return n.removeFirst(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 y.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 y.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}(y),m=new l},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./List":6,"./Option":7,"./SeqHelpers":9,"./Vector":12}],11:[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}],12:[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("./List"),f=t("./SeqHelpers"),s=t("hamt_plus"),h=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(s.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 f.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.removeFirst=function(r){var n=this;return new t(s.empty.mutate(function(t){for(var e=!1,o=0;o<n.hamt.size;o++){var i=n.hamt.get(o+n.indexShift);r(i)&&!e?e=!0:t.set(t.size,i)}}),0)},t.prototype.map=function(r){var n=this;return new t(s.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(s.empty.mutate(function(t){for(var e=0;e<n.hamt.size;e++){var o=n.hamt.get(e+n.indexShift),i=r(o);i.isSome()&&t.set(t.size,i.getOrThrow())}}),0)},t.prototype.filter=function(r){var n=this;return new t(s.empty.mutate(function(t){for(var e=0;e<n.hamt.size;e++){var o=n.hamt.get(e+n.indexShift);r(o)&&t.set(t.size,o)}}),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},s.make()),0)},t.prototype.dropWhile=function(r){for(var n=s.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=s.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},s.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),s.beginMutation(s.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 f.arrangeBy(this,t)},t.prototype.shuffle=function(){return t.ofIterable(f.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.toList=function(){return a.List.ofIterable(this)},t.prototype.zip=function(r){var n=this;return new t(s.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.zipWithIndex=function(){return f.zipWithIndex(this)},t.prototype.reverse=function(){var r=this,n=this.hamt.size-1+this.indexShift;return new t(s.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 s.empty.mutate(function(o){return s.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(s.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(s.make(),0),t}();n.Vector=h},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./List":6,"./Option":7,"./SeqHelpers":9,hamt_plus:14}],13:[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")),e(t("./Predicate"))},{"./Comparison":1,"./Contract":2,"./HashMap":3,"./HashSet":4,"./Lazy":5,"./List":6,"./Option":7,"./Predicate":8,"./Stream":10,"./Tuple2":11,"./Vector":12}],14:[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:A}},b=function(t,r,n){return{type:2,edit:t,hash:r,children:n,_modify:T}},x=function(t,r,n){return{type:3,edit:t,mask:r,children:n,_modify:I}},q=function(t,r,n){return{type:4,edit:t,size:r,children:n,_modify:V}},M=function(t){return t===O||1===t.type||2===t.type},z=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,q(t,p+1,i)},H=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 x(t,u,o)},k=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 x(r,m(p)|m(a),p===a?[t(r,n+5,e,o,i,u)]:p<a?[o,u]:[u,o])},L=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))},C=function(t,r){return t===r.edit},A=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):C(t,this)?(this.value=p,this):w(t,o,i,p)}var a=e();return a===h?this:(++u.value,k(t,n,this.hash,this,o,w(t,o,i,a)))},T=function(t,r,n,e,o,i,u){if(o===this.hash){var p=C(t,this),a=L(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,k(t,n,this.hash,this,o,w(t,o,i,f)))},I=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=C(t,this),q=p,H=void 0;if(y&&E(w)){if(!(q&=~h))return O;if(a.length<=2&&M(a[1^c]))return a[1^c];H=_(b,c,a)}else if(y||E(w))H=g(b,c,w,a);else{if(a.length>=f)return z(t,s,w,p,a);q|=h,H=S(b,c,w,a)}return b?(this.mask=q,this.children=H,this):x(t,q,H)},V=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=C(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 H(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):q(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 P=u.getHash=function(t,r,n){return B(void 0,t,r,n)};e.prototype.getHash=function(t,r){return P(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 R=u.has=function(t,r,n){return B(h,t,r,n)!==h};e.prototype.hasHash=function(t,r){return R(t,r,this)};var N=u.has=function(t,r){return R(r._config.hash(t),t,r)};e.prototype.has=function(t){return N(t,this)};var j=function(t,r){return t===r};u.make=function(t){return new e(0,0,{keyEq:t&&t.keyEq||j,hash:t&&t.hash||y},O,0)},u.empty=u.make();var F=u.isEmpty=function(t){return t&&!!E(t._root)};e.prototype.isEmpty=function(){return F(this)};var U=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 U(n,t,r,this)};var G=u.modify=function(t,r,n){return U(t,n._config.hash(r),r,n)};e.prototype.modify=function(t,r){return G(r,t,this)};var D=u.setHash=function(t,r,n,e){return U(c(n),t,r,e)};e.prototype.setHash=function(t,r,n){return D(t,r,n,this)};var J=u.set=function(t,r,n){return D(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 U(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},{}]},{},[13])(13)}); |
@@ -21,2 +21,7 @@ import { WithEquality, Ordering } from "./Comparison"; | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
removeFirst(predicate: (v: T) => boolean): Seq<T>; | ||
/** | ||
* Call a function for element in the collection. | ||
@@ -132,2 +137,10 @@ * Return the unchanged collection. | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Vector.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Seq<[T, number]>; | ||
/** | ||
* Retrieve the element at index idx. | ||
@@ -134,0 +147,0 @@ * Returns an option because the collection may |
@@ -17,1 +17,5 @@ import { Option } from "./Option"; | ||
export declare function seqHasTrueEquality<T>(seq: Seq<T>): boolean; | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function zipWithIndex<T>(seq: Seq<T>): Seq<[T, number]>; |
"use strict"; | ||
exports.__esModule = true; | ||
var Option_1 = require("./Option"); | ||
var Stream_1 = require("./Stream"); | ||
/** | ||
@@ -39,2 +40,9 @@ * @hidden | ||
exports.seqHasTrueEquality = seqHasTrueEquality; | ||
/** | ||
* @hidden | ||
*/ | ||
function zipWithIndex(seq) { | ||
return seq.zip(Stream_1.Stream.iterate(0, function (i) { return i + 1; })); | ||
} | ||
exports.zipWithIndex = zipWithIndex; | ||
//# sourceMappingURL=SeqHelpers.js.map |
@@ -7,2 +7,3 @@ import { Option } from "./Option"; | ||
import { Seq } from "./Seq"; | ||
import { List } from "./List"; | ||
/** | ||
@@ -209,2 +210,10 @@ * A lazy, potentially infinite, sequence of values. | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Stream.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Stream<[T, number]>; | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -251,2 +260,7 @@ * | ||
abstract appendAll(elts: Iterable<T>): Stream<T>; | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Stream.filter]] to remove all elements matching a predicate) | ||
*/ | ||
abstract removeFirst(predicate: (v: T) => boolean): Stream<T>; | ||
abstract appendStream(elts: Stream<T>): Stream<T>; | ||
@@ -358,2 +372,6 @@ /** | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
toList(): List<T>; | ||
/** | ||
* Transform this value to another value type. | ||
@@ -360,0 +378,0 @@ * Enables fluent-style programming by chaining calls. |
@@ -20,2 +20,3 @@ "use strict"; | ||
var Lazy_1 = require("./Lazy"); | ||
var List_1 = require("./List"); | ||
var SeqHelpers = require("./SeqHelpers"); | ||
@@ -134,2 +135,12 @@ /** | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Stream.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
Stream.prototype.zipWithIndex = function () { | ||
return SeqHelpers.zipWithIndex(this); | ||
}; | ||
/** | ||
* Matches each element with a unique key that you extract from it. | ||
@@ -160,2 +171,8 @@ * If the same key is present twice, the function will return None. | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
Stream.prototype.toList = function () { | ||
return List_1.List.ofIterable(this); | ||
}; | ||
/** | ||
* Transform this value to another value type. | ||
@@ -254,2 +271,5 @@ * Enables fluent-style programming by chaining calls. | ||
}; | ||
EmptyStream.prototype.removeFirst = function (predicate) { | ||
return this; | ||
}; | ||
EmptyStream.prototype.appendStream = function (elts) { | ||
@@ -475,2 +495,8 @@ return elts; | ||
}; | ||
ConsStream.prototype.removeFirst = function (predicate) { | ||
var tail = this._tail.get(); | ||
return predicate(this.value) ? | ||
tail : | ||
new ConsStream(this.value, Lazy_1.Lazy.of(function () { return tail.removeFirst(predicate); })); | ||
}; | ||
ConsStream.prototype.appendStream = function (elts) { | ||
@@ -477,0 +503,0 @@ var tail = this._tail.get(); |
@@ -6,2 +6,3 @@ import { Seq } from "./Seq"; | ||
import { Option } from "./Option"; | ||
import { List } from "./List"; | ||
/** | ||
@@ -119,2 +120,7 @@ * A general-purpose list class with all-around good performance. | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
removeFirst(predicate: (v: T) => boolean): Vector<T>; | ||
/** | ||
* Return a new collection where each element was transformed | ||
@@ -289,2 +295,6 @@ * by the mapper function you give. | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
toList(): List<T>; | ||
/** | ||
* Combine this collection with the collection you give in | ||
@@ -302,2 +312,10 @@ * parameter to produce a new collection which combines both, | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Vector.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Vector<[T, number]>; | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -304,0 +322,0 @@ * |
@@ -8,2 +8,3 @@ "use strict"; | ||
var HashSet_1 = require("./HashSet"); | ||
var List_1 = require("./List"); | ||
var SeqHelpers = require("./SeqHelpers"); | ||
@@ -213,2 +214,21 @@ var hamt = require("hamt_plus"); | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
Vector.prototype.removeFirst = function (predicate) { | ||
var _this = this; | ||
return new Vector(hamt.empty.mutate(function (h) { | ||
var found = false; | ||
for (var i = 0; i < _this.hamt.size; i++) { | ||
var item = _this.hamt.get(i + _this.indexShift); | ||
if (predicate(item) && !found) { | ||
found = true; | ||
} | ||
else { | ||
h.set(h.size, item); | ||
} | ||
} | ||
}), 0); | ||
}; | ||
/** | ||
* Return a new collection where each element was transformed | ||
@@ -232,3 +252,2 @@ * by the mapper function you give. | ||
return new Vector(hamt.empty.mutate(function (h) { | ||
var outputIdx = 0; | ||
for (var i = 0; i < _this.hamt.size; i++) { | ||
@@ -238,3 +257,3 @@ var item = _this.hamt.get(i + _this.indexShift); | ||
if (val.isSome()) { | ||
h.set(outputIdx++, val.getOrThrow()); | ||
h.set(h.size, val.getOrThrow()); | ||
} | ||
@@ -252,7 +271,6 @@ } | ||
return new Vector(hamt.empty.mutate(function (h) { | ||
var outputIdx = 0; | ||
for (var i = 0; i < _this.hamt.size; i++) { | ||
var item = _this.hamt.get(i + _this.indexShift); | ||
if (predicate(item)) { | ||
h.set(outputIdx++, item); | ||
h.set(h.size, item); | ||
} | ||
@@ -539,2 +557,8 @@ } | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
Vector.prototype.toList = function () { | ||
return List_1.List.ofIterable(this); | ||
}; | ||
/** | ||
* Combine this collection with the collection you give in | ||
@@ -566,2 +590,12 @@ * parameter to produce a new collection which combines both, | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Vector.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
Vector.prototype.zipWithIndex = function () { | ||
return SeqHelpers.zipWithIndex(this); | ||
}; | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -568,0 +602,0 @@ * |
@@ -103,2 +103,5 @@ "use strict"; | ||
it("calculates removeAll from empty well", function () { return assert.ok(HashSet_1.HashSet.empty().equals(HashSet_1.HashSet.empty().removeAll([0, 3]))); }); | ||
it("calculates remove well", function () { return assert.ok(HashSet_1.HashSet.of(0, 1, 2, 4).equals(HashSet_1.HashSet.of(0, 1, 2, 3, 4).remove(3))); }); | ||
it("calculates remove well event if item not present", function () { return assert.ok(HashSet_1.HashSet.of(0, 1, 2, 3, 4).equals(HashSet_1.HashSet.of(0, 1, 2, 3, 4).remove(5))); }); | ||
it("calculates remove from empty well", function () { return assert.ok(HashSet_1.HashSet.empty().equals(HashSet_1.HashSet.empty().remove(3))); }); | ||
it("filters correctly", function () { return assert.ok(HashSet_1.HashSet.of(2, 4).equals(HashSet_1.HashSet.of(1, 2, 3, 4, 5).filter(function (x) { return x % 2 == 0; }))); }); | ||
@@ -105,0 +108,0 @@ }); |
@@ -6,2 +6,3 @@ "use strict"; | ||
var Option_1 = require("../src/Option"); | ||
var Predicate_1 = require("../src/Predicate"); | ||
var SampleData_1 = require("./SampleData"); | ||
@@ -149,2 +150,5 @@ var TestHelpers_1 = require("./TestHelpers"); | ||
it("returns an empty stream when dropping too much", function () { return assert.deepEqual([], of(1, 2).drop(3).toArray()); }); | ||
it("calculates removeFirst well", function () { return assert.deepEqual([0, 1, 3, 4], of(0, 1, 2, 3, 4).removeFirst(Predicate_1.Predicates.isIn([3, 2])).toArray()); }); | ||
it("calculates removeFirst well event if item not present", function () { return assert.deepEqual([0, 1, 2, 3, 4], of(0, 1, 2, 3, 4).removeFirst(Predicate_1.Predicates.equals(5)).toArray()); }); | ||
it("calculates removeFirst from empty well", function () { return assert.ok(empty().equals(empty().removeFirst(function (x) { return x === 3; }))); }); | ||
}); | ||
@@ -151,0 +155,0 @@ describe(seqName + " value extraction", function () { |
{ | ||
"name": "prelude.ts", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A typescript functional programming library", | ||
@@ -40,5 +40,5 @@ "main": "dist/src/index.js", | ||
"clean": "rm -Rf ./dist", | ||
"docgen": "./node_modules/typedoc/bin/typedoc --mode file --out apidoc --excludePrivate --excludeExternals --excludeNotExported --ignoreCompilerErrors src/index.ts", | ||
"docgen": "./scripts/make_doc.sh", | ||
"benchmarks": "tsc && node ./dist/benchmarks/bench.js" | ||
} | ||
} |
@@ -249,2 +249,10 @@ import { ISet } from "./ISet"; | ||
/** | ||
* Returns a new set with the element you give removed | ||
* if it was present in the set. | ||
*/ | ||
remove(elt: T&WithEquality): HashSet<T> { | ||
return new HashSet<T>(this.hamt.remove(elt)); | ||
} | ||
/** | ||
* Returns a new set with all the elements of the current | ||
@@ -483,2 +491,6 @@ * Set, minus the elements of the iterable you give as a parameter. | ||
remove(elt: T&WithEquality): HashSet<T> { | ||
return this; | ||
} | ||
equals(other: HashSet<T>): boolean { | ||
@@ -485,0 +497,0 @@ if (!other || !other.length) { |
@@ -17,1 +17,2 @@ // Not re-exporting the abstract types such as Seq, Collection and so on, | ||
export * from "./Contract"; | ||
export * from "./Predicate"; |
@@ -249,2 +249,13 @@ import { Option } from "./Option"; | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* List.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): List<[T,number]> { | ||
return <List<[T,number]>>SeqHelpers.zipWithIndex<T>(this); | ||
} | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -292,3 +303,3 @@ * | ||
shuffle(): List<T> { | ||
return List.ofIterable(SeqHelpers.shuffle(this.toArray())); | ||
return List.ofIterable<T>(SeqHelpers.shuffle(this.toArray())); | ||
} | ||
@@ -307,2 +318,8 @@ | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
abstract removeFirst(predicate: (v:T)=>boolean): List<T>; | ||
/** | ||
* Prepend an element at the beginning of the collection. | ||
@@ -554,2 +571,6 @@ */ | ||
removeFirst(predicate: (x:T)=>boolean): List<T> { | ||
return this; | ||
} | ||
prepend(elt: T): List<T> { | ||
@@ -821,2 +842,17 @@ return new ConsList(elt, this); | ||
removeFirst(predicate: (x:T)=>boolean): List<T> { | ||
let curItem: List<T> = this; | ||
let result = <EmptyList<T>>emptyList; | ||
let removed = false; | ||
while (!curItem.isEmpty()) { | ||
if (predicate((<ConsList<T>>curItem).value) && !removed) { | ||
removed = true; | ||
} else { | ||
result = new ConsList((<ConsList<T>>curItem).value, result); | ||
} | ||
curItem = (<ConsList<T>>curItem)._tail; | ||
} | ||
return result.reverse(); | ||
} | ||
prepend(elt: T): List<T> { | ||
@@ -823,0 +859,0 @@ return new ConsList(elt, this); |
@@ -25,2 +25,8 @@ import { WithEquality, Ordering } from "./Comparison"; | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
removeFirst(predicate: (v:T)=>boolean): Seq<T>; | ||
/** | ||
* Call a function for element in the collection. | ||
@@ -153,2 +159,11 @@ * Return the unchanged collection. | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Vector.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Seq<[T,number]>; | ||
/** | ||
* Retrieve the element at index idx. | ||
@@ -155,0 +170,0 @@ * Returns an option because the collection may |
@@ -5,2 +5,3 @@ import { Option } from "./Option"; | ||
import { Seq } from "./Seq"; | ||
import { Stream } from "./Stream"; | ||
@@ -45,1 +46,8 @@ /** | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
export function zipWithIndex<T>(seq: Seq<T>): Seq<[T,number]> { | ||
return seq.zip<number>(Stream.iterate(0,i=>i+1)); | ||
} |
@@ -13,2 +13,3 @@ import { Option } from "./Option"; | ||
import { Lazy } from "./Lazy"; | ||
import { List } from "./List"; | ||
import * as SeqHelpers from "./SeqHelpers"; | ||
@@ -279,2 +280,13 @@ | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Stream.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Stream<[T,number]> { | ||
return <Stream<[T,number]>>SeqHelpers.zipWithIndex<T>(this); | ||
} | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -335,2 +347,8 @@ * | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Stream.filter]] to remove all elements matching a predicate) | ||
*/ | ||
abstract removeFirst(predicate: (v:T)=>boolean): Stream<T>; | ||
/* | ||
@@ -471,2 +489,9 @@ * Append another Stream at the end of this Stream. | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
toList(): List<T> { | ||
return List.ofIterable(this); | ||
} | ||
/** | ||
* Transform this value to another value type. | ||
@@ -604,2 +629,6 @@ * Enables fluent-style programming by chaining calls. | ||
removeFirst(predicate: (x:T)=>boolean): Stream<T> { | ||
return this; | ||
} | ||
appendStream(elts:Stream<T>): Stream<T> { | ||
@@ -870,2 +899,10 @@ return elts; | ||
removeFirst(predicate: (x:T)=>boolean): Stream<T> { | ||
const tail = this._tail.get(); | ||
return predicate(this.value) ? | ||
tail : | ||
new ConsStream(this.value, | ||
Lazy.of(()=>tail.removeFirst(predicate))); | ||
} | ||
appendStream(elts:Stream<T>): Stream<T> { | ||
@@ -872,0 +909,0 @@ const tail = this._tail.get(); |
@@ -9,2 +9,3 @@ import { Seq } from "./Seq"; | ||
import { HashSet } from "./HashSet"; | ||
import { List } from "./List"; | ||
import * as SeqHelpers from "./SeqHelpers"; | ||
@@ -232,2 +233,21 @@ const hamt: any = require("hamt_plus"); | ||
/** | ||
* Removes the first element matching the predicate | ||
* (use [[Seq.filter]] to remove all elements matching a predicate) | ||
*/ | ||
removeFirst(predicate: (v:T)=>boolean): Vector<T> { | ||
return new Vector<T>(hamt.empty.mutate( | ||
(h:any) => { | ||
let found = false; | ||
for (let i=0;i<this.hamt.size;i++) { | ||
const item = this.hamt.get(i+this.indexShift); | ||
if (predicate(item) && !found) { | ||
found = true; | ||
} else { | ||
h.set(h.size, item); | ||
} | ||
} | ||
}), 0); | ||
} | ||
/** | ||
* Return a new collection where each element was transformed | ||
@@ -254,3 +274,2 @@ * by the mapper function you give. | ||
(h:any) => { | ||
let outputIdx = 0; | ||
for (let i=0;i<this.hamt.size;i++) { | ||
@@ -260,3 +279,3 @@ const item = this.hamt.get(i+this.indexShift); | ||
if (val.isSome()) { | ||
h.set(outputIdx++, val.getOrThrow()); | ||
h.set(h.size, val.getOrThrow()); | ||
} | ||
@@ -275,7 +294,6 @@ } | ||
(h:any) => { | ||
let outputIdx = 0; | ||
for (let i=0;i<this.hamt.size;i++) { | ||
const item = this.hamt.get(i+this.indexShift); | ||
if (predicate(item)) { | ||
h.set(outputIdx++, item); | ||
h.set(h.size, item); | ||
} | ||
@@ -587,2 +605,9 @@ } | ||
/** | ||
* Convert this collection to a list. | ||
*/ | ||
toList(): List<T> { | ||
return List.ofIterable(this); | ||
} | ||
/** | ||
* Combine this collection with the collection you give in | ||
@@ -616,2 +641,13 @@ * parameter to produce a new collection which combines both, | ||
/** | ||
* Combine this collection with the index of the elements | ||
* in it. Handy if you need the index when you map on | ||
* the collection for instance: | ||
* | ||
* Vector.of("a","b").zipWithIndex().map([v,idx] => ...) | ||
*/ | ||
zipWithIndex(): Vector<[T,number]> { | ||
return <Vector<[T,number]>>SeqHelpers.zipWithIndex<T>(this); | ||
} | ||
/** | ||
* Reverse the collection. For instance: | ||
@@ -618,0 +654,0 @@ * |
@@ -135,2 +135,8 @@ import { HashSet } from "../src/HashSet"; | ||
HashSet.empty<number>().equals(HashSet.empty<number>().removeAll([0,3])))); | ||
it("calculates remove well", () => assert.ok( | ||
HashSet.of(0,1,2,4).equals(HashSet.of(0,1,2,3,4).remove(3)))); | ||
it("calculates remove well event if item not present", () => assert.ok( | ||
HashSet.of(0,1,2,3,4).equals(HashSet.of(0,1,2,3,4).remove(5)))); | ||
it("calculates remove from empty well", () => assert.ok( | ||
HashSet.empty<number>().equals(HashSet.empty<number>().remove(3)))); | ||
it("filters correctly", () => assert.ok( | ||
@@ -137,0 +143,0 @@ HashSet.of(2,4).equals(HashSet.of(1,2,3,4,5).filter(x => x%2==0)))); |
@@ -5,2 +5,3 @@ import { Seq } from "../src/Seq"; | ||
import { Option } from "../src/Option"; | ||
import { Predicates } from "../src/Predicate"; | ||
import { MyClass } from "./SampleData"; | ||
@@ -229,2 +230,8 @@ import { assertFailCompile } from "./TestHelpers"; | ||
[], of(1,2).drop(3).toArray())); | ||
it("calculates removeFirst well", () => assert.deepEqual( | ||
[0,1,3,4], of(0,1,2,3,4).removeFirst(Predicates.isIn([3,2])).toArray())); | ||
it("calculates removeFirst well event if item not present", () => assert.deepEqual( | ||
[0,1,2,3,4], of(0,1,2,3,4).removeFirst(Predicates.equals(5)).toArray())); | ||
it("calculates removeFirst from empty well", () => assert.ok( | ||
empty<number>().equals(empty<number>().removeFirst(x => x === 3)))); | ||
}); | ||
@@ -231,0 +238,0 @@ describe(seqName + " value extraction", () => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2539906
170
18976