fable-core
Advanced tools
Comparing version 0.7.5-alpha.4 to 0.7.5-alpha.5
@@ -17,4 +17,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import { compareWith as seqCompareWith } from "./Seq"; | ||
var MapTree = function MapTree(caseName, fields) { | ||
export var MapTree = function MapTree(caseName, fields) { | ||
_classCallCheck(this, MapTree); | ||
@@ -25,19 +24,18 @@ | ||
}; | ||
export function tree_sizeAux(acc, m) { | ||
function tree_sizeAux(acc, m) { | ||
return m.Case === "MapOne" ? acc + 1 : m.Case === "MapNode" ? tree_sizeAux(tree_sizeAux(acc + 1, m.Fields[2]), m.Fields[3]) : acc; | ||
} | ||
export function tree_size(x) { | ||
function tree_size(x) { | ||
return tree_sizeAux(0, x); | ||
} | ||
export function tree_empty() { | ||
function tree_empty() { | ||
return new MapTree("MapEmpty", []); | ||
} | ||
export function tree_height(_arg1) { | ||
function tree_height(_arg1) { | ||
return _arg1.Case === "MapOne" ? 1 : _arg1.Case === "MapNode" ? _arg1.Fields[4] : 0; | ||
} | ||
export function tree_isEmpty(m) { | ||
function tree_isEmpty(m) { | ||
return m.Case === "MapEmpty" ? true : false; | ||
} | ||
export function tree_mk(l, k, v, r) { | ||
function tree_mk(l, k, v, r) { | ||
var matchValue = [l, r]; | ||
@@ -61,3 +59,3 @@ var $target1 = function $target1() { | ||
; | ||
export function tree_rebalance(t1, k, v, t2) { | ||
function tree_rebalance(t1, k, v, t2) { | ||
var t1h = tree_height(t1); | ||
@@ -99,3 +97,3 @@ var t2h = tree_height(t2); | ||
} | ||
export function tree_add(comparer, k, v, m) { | ||
function tree_add(comparer, k, v, m) { | ||
if (m.Case === "MapOne") { | ||
@@ -120,3 +118,3 @@ var c = comparer.Compare(k, m.Fields[0]); | ||
} | ||
export function tree_find(comparer, k, m) { | ||
function tree_find(comparer, k, m) { | ||
var res = tree_tryFind(comparer, k, m); | ||
@@ -126,3 +124,3 @@ if (res != null) return res; | ||
} | ||
export function tree_tryFind(comparer, k, m) { | ||
function tree_tryFind(comparer, k, m) { | ||
if (m.Case === "MapOne") { | ||
@@ -145,6 +143,6 @@ var c = comparer.Compare(k, m.Fields[0]); | ||
} | ||
export function tree_partition1(comparer, f, k, v, acc1, acc2) { | ||
function tree_partition1(comparer, f, k, v, acc1, acc2) { | ||
return f(k, v) ? [tree_add(comparer, k, v, acc1), acc2] : [acc1, tree_add(comparer, k, v, acc2)]; | ||
} | ||
export function tree_partitionAux(comparer, f, s, acc_0, acc_1) { | ||
function tree_partitionAux(comparer, f, s, acc_0, acc_1) { | ||
var acc = [acc_0, acc_1]; | ||
@@ -160,9 +158,9 @@ if (s.Case === "MapOne") { | ||
} | ||
export function tree_partition(comparer, f, s) { | ||
function tree_partition(comparer, f, s) { | ||
return tree_partitionAux(comparer, f, s, tree_empty(), tree_empty()); | ||
} | ||
export function tree_filter1(comparer, f, k, v, acc) { | ||
function tree_filter1(comparer, f, k, v, acc) { | ||
return f(k, v) ? tree_add(comparer, k, v, acc) : acc; | ||
} | ||
export function tree_filterAux(comparer, f, s, acc) { | ||
function tree_filterAux(comparer, f, s, acc) { | ||
return s.Case === "MapOne" ? tree_filter1(comparer, f, s.Fields[0], s.Fields[1], acc) : s.Case === "MapNode" ? function () { | ||
@@ -174,6 +172,6 @@ var acc_1 = tree_filterAux(comparer, f, s.Fields[2], acc); | ||
} | ||
export function tree_filter(comparer, f, s) { | ||
function tree_filter(comparer, f, s) { | ||
return tree_filterAux(comparer, f, s, tree_empty()); | ||
} | ||
export function tree_spliceOutSuccessor(m) { | ||
function tree_spliceOutSuccessor(m) { | ||
if (m.Case === "MapOne") { | ||
@@ -191,3 +189,3 @@ return [m.Fields[0], m.Fields[1], new MapTree("MapEmpty", [])]; | ||
} | ||
export function tree_remove(comparer, k, m) { | ||
function tree_remove(comparer, k, m) { | ||
if (m.Case === "MapOne") { | ||
@@ -228,3 +226,3 @@ var c = comparer.Compare(k, m.Fields[0]); | ||
} | ||
export function tree_mem(comparer, k, m) { | ||
function tree_mem(comparer, k, m) { | ||
return m.Case === "MapOne" ? comparer.Compare(k, m.Fields[0]) === 0 : m.Case === "MapNode" ? function () { | ||
@@ -243,3 +241,3 @@ var c = comparer.Compare(k, m.Fields[0]); | ||
} | ||
export function tree_iter(f, m) { | ||
function tree_iter(f, m) { | ||
if (m.Case === "MapOne") { | ||
@@ -253,3 +251,3 @@ f(m.Fields[0], m.Fields[1]); | ||
} | ||
export function tree_tryPick(f, m) { | ||
function tree_tryPick(f, m) { | ||
return m.Case === "MapOne" ? f(m.Fields[0], m.Fields[1]) : m.Case === "MapNode" ? function () { | ||
@@ -271,9 +269,9 @@ var matchValue = tree_tryPick(f, m.Fields[2]); | ||
} | ||
export function tree_exists(f, m) { | ||
function tree_exists(f, m) { | ||
return m.Case === "MapOne" ? f(m.Fields[0], m.Fields[1]) : m.Case === "MapNode" ? (tree_exists(f, m.Fields[2]) ? true : f(m.Fields[0], m.Fields[1])) ? true : tree_exists(f, m.Fields[3]) : false; | ||
} | ||
export function tree_forall(f, m) { | ||
function tree_forall(f, m) { | ||
return m.Case === "MapOne" ? f(m.Fields[0], m.Fields[1]) : m.Case === "MapNode" ? (tree_forall(f, m.Fields[2]) ? f(m.Fields[0], m.Fields[1]) : false) ? tree_forall(f, m.Fields[3]) : false : true; | ||
} | ||
// export function tree_map(f: (v:any) => any, m: MapTree): MapTree { | ||
// function tree_map(f: (v:any) => any, m: MapTree): MapTree { | ||
// return m.Case === "MapOne" ? new MapTree("MapOne", [m.Fields[0], f(m.Fields[1])]) : m.Case === "MapNode" ? (() => { | ||
@@ -286,3 +284,3 @@ // var l2 = tree_map(f, m.Fields[2]); | ||
// } | ||
export function tree_mapi(f, m) { | ||
function tree_mapi(f, m) { | ||
return m.Case === "MapOne" ? new MapTree("MapOne", [m.Fields[0], f(m.Fields[0], m.Fields[1])]) : m.Case === "MapNode" ? function () { | ||
@@ -295,3 +293,3 @@ var l2 = tree_mapi(f, m.Fields[2]); | ||
} | ||
export function tree_foldBack(f, m, x) { | ||
function tree_foldBack(f, m, x) { | ||
return m.Case === "MapOne" ? f(m.Fields[0], m.Fields[1], x) : m.Case === "MapNode" ? function () { | ||
@@ -303,3 +301,3 @@ var x_1 = tree_foldBack(f, m.Fields[3], x); | ||
} | ||
export function tree_fold(f, x, m) { | ||
function tree_fold(f, x, m) { | ||
return m.Case === "MapOne" ? f(x, m.Fields[0], m.Fields[1]) : m.Case === "MapNode" ? function () { | ||
@@ -311,3 +309,3 @@ var x_1 = tree_fold(f, x, m.Fields[2]); | ||
} | ||
// export function tree_foldFromTo(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any): any { | ||
// function tree_foldFromTo(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any): any { | ||
// if (m.Case === "MapOne") { | ||
@@ -329,6 +327,6 @@ // var cLoKey = comparer.Compare(lo, m.Fields[0]); | ||
// } | ||
// export function tree_foldSection(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any) { | ||
// function tree_foldSection(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any) { | ||
// return comparer.Compare(lo, hi) === 1 ? x : tree_foldFromTo(comparer, lo, hi, f, m, x); | ||
// } | ||
// export function tree_loop(m: MapTree, acc: any): List<[any,any]> { | ||
// function tree_loop(m: MapTree, acc: any): List<[any,any]> { | ||
// return m.Case === "MapOne" | ||
@@ -340,9 +338,9 @@ // ? new List([m.Fields[0], m.Fields[1]], acc) | ||
// } | ||
// export function tree_toList(m: MapTree) { | ||
// function tree_toList(m: MapTree) { | ||
// return tree_loop(m, new List()); | ||
// } | ||
// export function tree_toArray(m: MapTree) { | ||
// function tree_toArray(m: MapTree) { | ||
// return Array.from(tree_toList(m)); | ||
// } | ||
// export function tree_ofList(comparer: IComparer<any>, l: List<[any,any]>) { | ||
// function tree_ofList(comparer: IComparer<any>, l: List<[any,any]>) { | ||
// return Seq.fold((acc: MapTree, tupledArg: [any, any]) => { | ||
@@ -352,3 +350,3 @@ // return tree_add(comparer, tupledArg[0], tupledArg[1], acc); | ||
// } | ||
export function tree_mkFromEnumerator(comparer, acc, e) { | ||
function tree_mkFromEnumerator(comparer, acc, e) { | ||
var cur = e.next(); | ||
@@ -361,3 +359,3 @@ while (!cur.done) { | ||
} | ||
// export function tree_ofArray(comparer: IComparer<any>, arr: ArrayLike<[any,any]>) { | ||
// function tree_ofArray(comparer: IComparer<any>, arr: ArrayLike<[any,any]>) { | ||
// var res = tree_empty(); | ||
@@ -369,10 +367,10 @@ // for (var i = 0; i <= arr.length - 1; i++) { | ||
// } | ||
export function tree_ofSeq(comparer, c) { | ||
function tree_ofSeq(comparer, c) { | ||
var ie = c[Symbol.iterator](); | ||
return tree_mkFromEnumerator(comparer, tree_empty(), ie); | ||
} | ||
// export function tree_copyToArray(s: MapTree, arr: ArrayLike<any>, i: number) { | ||
// function tree_copyToArray(s: MapTree, arr: ArrayLike<any>, i: number) { | ||
// tree_iter((x, y) => { arr[i++] = [x, y]; }, s); | ||
// } | ||
export function tree_collapseLHS(stack) { | ||
function tree_collapseLHS(stack) { | ||
if (stack.tail != null) { | ||
@@ -390,6 +388,6 @@ if (stack.head.Case === "MapOne") { | ||
} | ||
export function tree_mkIterator(s) { | ||
function tree_mkIterator(s) { | ||
return { stack: tree_collapseLHS(new List(s, new List())), started: false }; | ||
} | ||
export function tree_moveNext(i) { | ||
function tree_moveNext(i) { | ||
function current(i) { | ||
@@ -396,0 +394,0 @@ if (i.stack.tail == null) { |
@@ -14,4 +14,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import { exists as seqExists } from "./Seq"; | ||
var SetTree = function SetTree(caseName, fields) { | ||
export var SetTree = function SetTree(caseName, fields) { | ||
_classCallCheck(this, SetTree); | ||
@@ -22,3 +21,2 @@ | ||
}; | ||
var tree_tolerance = 2; | ||
@@ -764,3 +762,3 @@ function tree_countAux(s, acc) { | ||
// Pass args as union(s, acc) instead of union(acc, s) | ||
// to discard the comparer of the first empty set | ||
// to discard the comparer of the first empty set | ||
return seqFold(function (acc, s) { | ||
@@ -767,0 +765,0 @@ return union(s, acc); |
52
Map.js
"use strict"; | ||
exports.__esModule = true; | ||
exports.MapTree = undefined; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
exports.tree_sizeAux = tree_sizeAux; | ||
exports.tree_size = tree_size; | ||
exports.tree_empty = tree_empty; | ||
exports.tree_height = tree_height; | ||
exports.tree_isEmpty = tree_isEmpty; | ||
exports.tree_mk = tree_mk; | ||
exports.tree_rebalance = tree_rebalance; | ||
exports.tree_add = tree_add; | ||
exports.tree_find = tree_find; | ||
exports.tree_tryFind = tree_tryFind; | ||
exports.tree_partition1 = tree_partition1; | ||
exports.tree_partitionAux = tree_partitionAux; | ||
exports.tree_partition = tree_partition; | ||
exports.tree_filter1 = tree_filter1; | ||
exports.tree_filterAux = tree_filterAux; | ||
exports.tree_filter = tree_filter; | ||
exports.tree_spliceOutSuccessor = tree_spliceOutSuccessor; | ||
exports.tree_remove = tree_remove; | ||
exports.tree_mem = tree_mem; | ||
exports.tree_iter = tree_iter; | ||
exports.tree_tryPick = tree_tryPick; | ||
exports.tree_exists = tree_exists; | ||
exports.tree_forall = tree_forall; | ||
exports.tree_mapi = tree_mapi; | ||
exports.tree_foldBack = tree_foldBack; | ||
exports.tree_fold = tree_fold; | ||
exports.tree_mkFromEnumerator = tree_mkFromEnumerator; | ||
exports.tree_ofSeq = tree_ofSeq; | ||
exports.tree_collapseLHS = tree_collapseLHS; | ||
exports.tree_mkIterator = tree_mkIterator; | ||
exports.tree_moveNext = tree_moveNext; | ||
exports.create = create; | ||
@@ -78,3 +48,3 @@ exports.add = add; | ||
var MapTree = function MapTree(caseName, fields) { | ||
var MapTree = exports.MapTree = function MapTree(caseName, fields) { | ||
_classCallCheck(this, MapTree); | ||
@@ -325,3 +295,3 @@ | ||
} | ||
// export function tree_map(f: (v:any) => any, m: MapTree): MapTree { | ||
// function tree_map(f: (v:any) => any, m: MapTree): MapTree { | ||
// return m.Case === "MapOne" ? new MapTree("MapOne", [m.Fields[0], f(m.Fields[1])]) : m.Case === "MapNode" ? (() => { | ||
@@ -356,3 +326,3 @@ // var l2 = tree_map(f, m.Fields[2]); | ||
} | ||
// export function tree_foldFromTo(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any): any { | ||
// function tree_foldFromTo(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any): any { | ||
// if (m.Case === "MapOne") { | ||
@@ -374,6 +344,6 @@ // var cLoKey = comparer.Compare(lo, m.Fields[0]); | ||
// } | ||
// export function tree_foldSection(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any) { | ||
// function tree_foldSection(comparer: IComparer<any>, lo: any, hi: any, f: (k:any, v:any, acc: any) => any, m: MapTree, x: any) { | ||
// return comparer.Compare(lo, hi) === 1 ? x : tree_foldFromTo(comparer, lo, hi, f, m, x); | ||
// } | ||
// export function tree_loop(m: MapTree, acc: any): List<[any,any]> { | ||
// function tree_loop(m: MapTree, acc: any): List<[any,any]> { | ||
// return m.Case === "MapOne" | ||
@@ -385,9 +355,9 @@ // ? new List([m.Fields[0], m.Fields[1]], acc) | ||
// } | ||
// export function tree_toList(m: MapTree) { | ||
// function tree_toList(m: MapTree) { | ||
// return tree_loop(m, new List()); | ||
// } | ||
// export function tree_toArray(m: MapTree) { | ||
// function tree_toArray(m: MapTree) { | ||
// return Array.from(tree_toList(m)); | ||
// } | ||
// export function tree_ofList(comparer: IComparer<any>, l: List<[any,any]>) { | ||
// function tree_ofList(comparer: IComparer<any>, l: List<[any,any]>) { | ||
// return Seq.fold((acc: MapTree, tupledArg: [any, any]) => { | ||
@@ -405,3 +375,3 @@ // return tree_add(comparer, tupledArg[0], tupledArg[1], acc); | ||
} | ||
// export function tree_ofArray(comparer: IComparer<any>, arr: ArrayLike<[any,any]>) { | ||
// function tree_ofArray(comparer: IComparer<any>, arr: ArrayLike<[any,any]>) { | ||
// var res = tree_empty(); | ||
@@ -417,3 +387,3 @@ // for (var i = 0; i <= arr.length - 1; i++) { | ||
} | ||
// export function tree_copyToArray(s: MapTree, arr: ArrayLike<any>, i: number) { | ||
// function tree_copyToArray(s: MapTree, arr: ArrayLike<any>, i: number) { | ||
// tree_iter((x, y) => { arr[i++] = [x, y]; }, s); | ||
@@ -420,0 +390,0 @@ // } |
{ | ||
"name": "fable-core", | ||
"version": "0.7.5-alpha.4", | ||
"version": "0.7.5-alpha.5", | ||
"description": "Fable core lib & bindings for native JS objects, browser and node APIs", | ||
@@ -5,0 +5,0 @@ "main": "Main.js", |
"use strict"; | ||
exports.__esModule = true; | ||
exports.SetTree = undefined; | ||
@@ -64,3 +65,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var SetTree = function SetTree(caseName, fields) { | ||
var SetTree = exports.SetTree = function SetTree(caseName, fields) { | ||
_classCallCheck(this, SetTree); | ||
@@ -812,3 +813,3 @@ | ||
// Pass args as union(s, acc) instead of union(acc, s) | ||
// to discard the comparer of the first empty set | ||
// to discard the comparer of the first empty set | ||
return (0, _Seq.fold)(function (acc, s) { | ||
@@ -815,0 +816,0 @@ return union(s, acc); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4453624
71
9678