diff --git a/jscomp/bsb/bsb_templates.ml b/jscomp/bsb/bsb_templates.ml index e031fcf87f..7acf0dd2d1 100644 --- a/jscomp/bsb/bsb_templates.ml +++ b/jscomp/bsb/bsb_templates.ml @@ -59,8 +59,10 @@ let root = OCamlRes.Res.([ \ ],\n\ \ \"warnings\": {\n\ \ \"error\" : \"+101\"\n\ - \ }\n\ - }") ; + \ },\n\ + \ \"refmt\": 3\n\ + }\n\ + ") ; Dir (".vscode", [ File ("tasks.json", "{\n\ diff --git a/jscomp/others/.depend b/jscomp/others/.depend index 79615d75f3..8d50c497ac 100644 --- a/jscomp/others/.depend +++ b/jscomp/others/.depend @@ -16,69 +16,73 @@ js_option.cmj : js_option.cmi js_console.cmj : js_result.cmj : js_result.cmi js_mapperRt.cmj : js_mapperRt.cmi -bs_Array.cmj : js_math.cmj bs_Array.cmi -bs_internalAVLset.cmj : bs_SortArray.cmj bs_Id.cmj bs_Array.cmj \ - bs_internalAVLset.cmi -bs_internalAVLtree.cmj : bs_SortArray.cmj bs_Id.cmj bs_Array.cmj \ - bs_internalAVLtree.cmi -bs_List.cmj : bs_Array.cmj bs_List.cmi -bs_SortArray.cmj : bs_SortArrayString.cmj bs_SortArrayInt.cmj bs_Array.cmj \ - bs_SortArray.cmi -bs_SortArrayInt.cmj : bs_Array.cmj bs_SortArrayInt.cmi -bs_SortArrayString.cmj : bs_Array.cmj bs_SortArrayString.cmi -bs_Range.cmj : bs_Range.cmi -bs_internalBucketsType.cmj : bs_Array.cmj bs_internalBucketsType.cmi -bs_internalSetBuckets.cmj : bs_internalBucketsType.cmj bs_Array.cmj bs.cmj \ - bs_internalSetBuckets.cmi -bs_internalBuckets.cmj : bs_internalBucketsType.cmj bs_Array.cmj \ - bs_internalBuckets.cmi -bs_HashMap.cmj : bs_internalBucketsType.cmj bs_internalBuckets.cmj bs_Id.cmj \ - bs_HashMapString.cmj bs_HashMapInt.cmj bs_Array.cmj bs_HashMap.cmi -bs_HashSet.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \ - bs_Id.cmj bs_HashSetString.cmj bs_HashSetInt.cmj bs_Array.cmj \ - bs_HashSet.cmi -bs_HashSetString.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \ - bs_Array.cmj bs_HashSetString.cmi -bs_HashSetInt.cmj : bs_internalSetBuckets.cmj bs_internalBucketsType.cmj \ - bs_Array.cmj bs_HashSetInt.cmi -bs_Id.cmj : bs_Id.cmi -bs_MapDict.cmj : bs_internalAVLtree.cmj bs_Id.cmj bs_Array.cmj \ - bs_MapDict.cmi -bs_SetDict.cmj : bs_internalAVLset.cmj bs_Id.cmj bs_Array.cmj bs_SetDict.cmi -bs_Map.cmj : bs_MapString.cmj bs_MapInt.cmj bs_MapDict.cmj bs_Id.cmj \ - bs_Array.cmj bs_Map.cmi -bs_internalMapInt.cmj : bs_internalAVLtree.cmj bs_SortArray.cmj bs_Array.cmj -bs_internalMapString.cmj : bs_internalAVLtree.cmj bs_SortArray.cmj \ - bs_Array.cmj -bs_MapString.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \ - bs_Array.cmj bs_MapString.cmi -bs_MapInt.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj bs_Array.cmj \ - bs_MapInt.cmi -bs_Set.cmj : bs_SetString.cmj bs_SetInt.cmj bs_SetDict.cmj bs_Id.cmj \ - bs_Array.cmj bs_Set.cmi -bs_MutableSet.cmj : bs_internalAVLset.cmj bs_SortArray.cmj \ - bs_MutableSetString.cmj bs_MutableSetInt.cmj bs_Id.cmj bs_Array.cmj \ - bs_MutableSet.cmi -bs_MutableSetInt.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj \ - bs_SortArrayInt.cmj bs_Array.cmj -bs_MutableSetString.cmj : bs_internalSetString.cmj bs_internalAVLset.cmj \ - bs_SortArrayString.cmj bs_Array.cmj bs_MutableSetString.cmi -bs_MutableMap.cmj : bs_internalAVLtree.cmj bs_MutableMapString.cmj \ - bs_MutableMapInt.cmj bs_Id.cmj bs_Array.cmj bs_MutableMap.cmi -bs_MutableMapInt.cmj : bs_internalMapInt.cmj bs_internalAVLtree.cmj \ - bs_Array.cmj bs_MutableMapInt.cmi -bs_MutableMapString.cmj : bs_internalMapString.cmj bs_internalAVLtree.cmj \ - bs_Array.cmj bs_MutableMapString.cmi -bs_internalSetInt.cmj : bs_internalAVLset.cmj bs_SortArrayInt.cmj \ - bs_Array.cmj -bs_internalSetString.cmj : bs_internalAVLset.cmj bs_SortArrayString.cmj \ - bs_Array.cmj -bs_SetInt.cmj : bs_internalSetInt.cmj bs_internalAVLset.cmj bs_Array.cmj \ - bs_SetInt.cmi -bs_SetString.cmj : bs_internalSetString.cmj bs_internalAVLset.cmj \ - bs_Array.cmj bs_SetString.cmi -bs_MutableStack.cmj : bs_MutableStack.cmi -bs_MutableQueue.cmj : bs_Array.cmj bs_MutableQueue.cmi +belt_Array.cmj : js_math.cmj belt_Array.cmi +belt_internalAVLset.cmj : belt_SortArray.cmj belt_Id.cmj belt_Array.cmj \ + belt_internalAVLset.cmi +belt_internalAVLtree.cmj : belt_SortArray.cmj belt_Id.cmj belt_Array.cmj \ + belt_internalAVLtree.cmi +belt_List.cmj : belt_Array.cmj belt_List.cmi +belt_SortArray.cmj : belt_SortArrayString.cmj belt_SortArrayInt.cmj \ + belt_Array.cmj belt_SortArray.cmi +belt_SortArrayInt.cmj : belt_Array.cmj belt_SortArrayInt.cmi +belt_SortArrayString.cmj : belt_Array.cmj belt_SortArrayString.cmi +belt_Range.cmj : belt_Range.cmi +belt_internalBucketsType.cmj : belt_Array.cmj belt_internalBucketsType.cmi +belt_internalSetBuckets.cmj : belt_internalBucketsType.cmj belt_Array.cmj \ + belt_internalSetBuckets.cmi +belt_internalBuckets.cmj : belt_internalBucketsType.cmj belt_Array.cmj \ + belt_internalBuckets.cmi +belt_HashMap.cmj : belt_internalBucketsType.cmj belt_internalBuckets.cmj \ + belt_Id.cmj belt_HashMapString.cmj belt_HashMapInt.cmj belt_Array.cmj \ + belt_HashMap.cmi +belt_HashSet.cmj : belt_internalSetBuckets.cmj belt_internalBucketsType.cmj \ + belt_Id.cmj belt_HashSetString.cmj belt_HashSetInt.cmj belt_Array.cmj \ + belt_HashSet.cmi +belt_HashSetString.cmj : belt_internalSetBuckets.cmj \ + belt_internalBucketsType.cmj belt_Array.cmj belt_HashSetString.cmi +belt_HashSetInt.cmj : belt_internalSetBuckets.cmj \ + belt_internalBucketsType.cmj belt_Array.cmj belt_HashSetInt.cmi +belt_Id.cmj : belt_Id.cmi +belt_MapDict.cmj : belt_internalAVLtree.cmj belt_Id.cmj belt_Array.cmj \ + belt_MapDict.cmi +belt_SetDict.cmj : belt_internalAVLset.cmj belt_Id.cmj belt_Array.cmj \ + belt_SetDict.cmi +belt_Map.cmj : belt_MapString.cmj belt_MapInt.cmj belt_MapDict.cmj \ + belt_Id.cmj belt_Array.cmj belt_Map.cmi +belt_internalMapInt.cmj : belt_internalAVLtree.cmj belt_SortArray.cmj \ + belt_Array.cmj +belt_internalMapString.cmj : belt_internalAVLtree.cmj belt_SortArray.cmj \ + belt_Array.cmj +belt_MapString.cmj : belt_internalMapString.cmj belt_internalAVLtree.cmj \ + belt_Array.cmj belt_MapString.cmi +belt_MapInt.cmj : belt_internalMapInt.cmj belt_internalAVLtree.cmj \ + belt_Array.cmj belt_MapInt.cmi +belt_Set.cmj : belt_SetString.cmj belt_SetInt.cmj belt_SetDict.cmj \ + belt_Id.cmj belt_Array.cmj belt_Set.cmi +belt_MutableSet.cmj : belt_internalAVLset.cmj belt_SortArray.cmj \ + belt_MutableSetString.cmj belt_MutableSetInt.cmj belt_Id.cmj \ + belt_Array.cmj belt_MutableSet.cmi +belt_MutableSetInt.cmj : belt_internalSetInt.cmj belt_internalAVLset.cmj \ + belt_SortArrayInt.cmj belt_Array.cmj belt_MutableSetInt.cmi +belt_MutableSetString.cmj : belt_internalSetString.cmj \ + belt_internalAVLset.cmj belt_SortArrayString.cmj belt_Array.cmj \ + belt_MutableSetString.cmi +belt_MutableMap.cmj : belt_internalAVLtree.cmj belt_MutableMapString.cmj \ + belt_MutableMapInt.cmj belt_Id.cmj belt_Array.cmj belt_MutableMap.cmi +belt_MutableMapInt.cmj : belt_internalMapInt.cmj belt_internalAVLtree.cmj \ + belt_Array.cmj belt_MutableMapInt.cmi +belt_MutableMapString.cmj : belt_internalMapString.cmj \ + belt_internalAVLtree.cmj belt_Array.cmj belt_MutableMapString.cmi +belt_internalSetInt.cmj : belt_internalAVLset.cmj belt_SortArrayInt.cmj \ + belt_Array.cmj +belt_internalSetString.cmj : belt_internalAVLset.cmj \ + belt_SortArrayString.cmj belt_Array.cmj +belt_SetInt.cmj : belt_internalSetInt.cmj belt_internalAVLset.cmj \ + belt_Array.cmj belt_SetInt.cmi +belt_SetString.cmj : belt_internalSetString.cmj belt_internalAVLset.cmj \ + belt_Array.cmj belt_SetString.cmi +belt_MutableStack.cmj : belt_MutableStack.cmi +belt_MutableQueue.cmj : belt_Array.cmj belt_MutableQueue.cmi node_child_process.cmj : node.cmj js_boolean.cmj : js_boolean.cmi js_math.cmj : @@ -87,10 +91,10 @@ js_date.cmj : js_global.cmj : js_cast.cmj : js_cast.cmi js_promise.cmj : -bs_HashMapInt.cmj : bs_internalBucketsType.cmj bs_internalBuckets.cmj \ - bs_Array.cmj bs_HashMapInt.cmi -bs_HashMapString.cmj : bs_internalBucketsType.cmj bs_internalBuckets.cmj \ - bs_Array.cmj bs_HashMapString.cmi +belt_HashMapInt.cmj : belt_internalBucketsType.cmj belt_internalBuckets.cmj \ + belt_Array.cmj belt_HashMapInt.cmi +belt_HashMapString.cmj : belt_internalBucketsType.cmj \ + belt_internalBuckets.cmj belt_Array.cmj belt_HashMapString.cmi node_process.cmi : js_dict.cmi js_re.cmi : js_null_undefined.cmi : @@ -101,41 +105,46 @@ js_list.cmi : js_vector.cmi js_option.cmi : js_result.cmi : js_mapperRt.cmi : -bs_Array.cmi : -bs_internalAVLset.cmi : bs_Id.cmi -bs_internalAVLtree.cmi : bs_Id.cmi -bs_List.cmi : -bs_SortArray.cmi : bs_SortArrayString.cmi bs_SortArrayInt.cmi -bs_SortArrayInt.cmi : -bs_SortArrayString.cmi : -bs_Range.cmi : -bs_internalBucketsType.cmi : -bs_internalSetBuckets.cmi : bs_internalBucketsType.cmi -bs_internalBuckets.cmi : bs_internalBucketsType.cmi -bs_HashMap.cmi : bs_Id.cmi bs_HashMapString.cmi bs_HashMapInt.cmi -bs_HashSet.cmi : bs_Id.cmi bs_HashSetString.cmi bs_HashSetInt.cmi -bs_HashSetString.cmi : -bs_HashSetInt.cmi : -bs_Id.cmi : -bs_MapDict.cmi : bs_Id.cmi -bs_SetDict.cmi : bs_Id.cmi -bs_Map.cmi : bs_MapString.cmi bs_MapInt.cmi bs_MapDict.cmi bs_Id.cmi -bs_MapString.cmi : -bs_MapInt.cmi : -bs_Set.cmi : bs_SetString.cmi bs_SetInt.cmi bs_SetDict.cmi bs_Id.cmi -bs_MutableSet.cmi : bs_MutableSetString.cmi bs_MutableSetInt.cmj bs_Id.cmi -bs_MutableSetString.cmi : -bs_MutableMap.cmi : bs_MutableMapString.cmi bs_MutableMapInt.cmi bs_Id.cmi -bs_MutableMapInt.cmi : -bs_MutableMapString.cmi : -bs_SetInt.cmi : -bs_SetString.cmi : -bs_MutableStack.cmi : -bs_MutableQueue.cmi : +belt_Array.cmi : +belt_internalAVLset.cmi : belt_Id.cmi +belt_internalAVLtree.cmi : belt_Id.cmi +belt_List.cmi : +belt_SortArray.cmi : belt_SortArrayString.cmi belt_SortArrayInt.cmi +belt_SortArrayInt.cmi : +belt_SortArrayString.cmi : +belt_Range.cmi : +belt_internalBucketsType.cmi : +belt_internalSetBuckets.cmi : belt_internalBucketsType.cmi +belt_internalBuckets.cmi : belt_internalBucketsType.cmi +belt_HashMap.cmi : belt_Id.cmi belt_HashMapString.cmi belt_HashMapInt.cmi +belt_HashSet.cmi : belt_Id.cmi belt_HashSetString.cmi belt_HashSetInt.cmi +belt_HashSetString.cmi : +belt_HashSetInt.cmi : +belt_Id.cmi : +belt_MapDict.cmi : belt_Id.cmi +belt_SetDict.cmi : belt_Id.cmi +belt_Map.cmi : belt_MapString.cmi belt_MapInt.cmi belt_MapDict.cmi \ + belt_Id.cmi +belt_MapString.cmi : +belt_MapInt.cmi : +belt_Set.cmi : belt_SetString.cmi belt_SetInt.cmi belt_SetDict.cmi \ + belt_Id.cmi +belt_MutableSet.cmi : belt_MutableSetString.cmi belt_MutableSetInt.cmi \ + belt_Id.cmi +belt_MutableSetInt.cmi : +belt_MutableSetString.cmi : +belt_MutableMap.cmi : belt_MutableMapString.cmi belt_MutableMapInt.cmi \ + belt_Id.cmi +belt_MutableMapInt.cmi : +belt_MutableMapString.cmi : +belt_SetInt.cmi : +belt_SetString.cmi : +belt_MutableStack.cmi : +belt_MutableQueue.cmi : js_boolean.cmi : js_dict.cmi : js_cast.cmi : dom.cmi : dom_storage.cmi dom_storage.cmi : -bs_HashMapInt.cmi : -bs_HashMapString.cmi : +belt_HashMapInt.cmi : +belt_HashMapString.cmi : diff --git a/jscomp/others/Makefile b/jscomp/others/Makefile index 5041306530..ef23b3111b 100644 --- a/jscomp/others/Makefile +++ b/jscomp/others/Makefile @@ -2,7 +2,7 @@ include ../Makefile.shared COMPILER=../../lib/bsc.exe -MAP_FILES= node bs +MAP_FILES= node belt SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string \ js_re js_null_undefined node_buffer js_types js_json js_obj \ @@ -10,54 +10,54 @@ SOURCE_LIST= node_path node_fs node_process dict node_module js_array js_string js_console\ js_result\ js_mapperRt\ - bs_Array\ - bs_internalAVLset\ - bs_internalAVLtree\ - bs_internalMutableAVL\ - bs_List\ - bs_SortArray\ - bs_SortArrayInt\ - bs_SortArrayString\ - bs_Range\ - bs_internalBucketsType\ - bs_internalSetBuckets\ - bs_internalBuckets\ - bs_HashMap\ - bs_HashSet\ - bs_HashSetString\ - bs_HashSetInt\ - bs_Id\ - bs_MapDict\ - bs_SetDict\ - bs_Map\ - bs_internalMapInt\ - bs_internalMapString\ - bs_MapString \ - bs_MapInt\ - bs_internalSet\ - bs_Set\ - bs_MutableSet\ - bs_MutableSetInt\ - bs_MutableSetString\ - bs_MutableMap\ - bs_MutableMapInt\ - bs_MutableMapString\ - bs_internalSetInt\ - bs_internalSetString\ - bs_SetInt\ - bs_SetString\ - bs_MutableStack\ - bs_MutableQueue\ + belt_Array\ + belt_internalAVLset\ + belt_internalAVLtree\ + belt_internalMutableAVL\ + belt_List\ + belt_SortArray\ + belt_SortArrayInt\ + belt_SortArrayString\ + belt_Range\ + belt_internalBucketsType\ + belt_internalSetBuckets\ + belt_internalBuckets\ + belt_HashMap\ + belt_HashSet\ + belt_HashSetString\ + belt_HashSetInt\ + belt_Id\ + belt_MapDict\ + belt_SetDict\ + belt_Map\ + belt_internalMapInt\ + belt_internalMapString\ + belt_MapString \ + belt_MapInt\ + belt_internalSet\ + belt_Set\ + belt_MutableSet\ + belt_MutableSetInt\ + belt_MutableSetString\ + belt_MutableMap\ + belt_MutableMapInt\ + belt_MutableMapString\ + belt_internalSetInt\ + belt_internalSetString\ + belt_SetInt\ + belt_SetString\ + belt_MutableStack\ + belt_MutableQueue\ node_child_process \ js_boolean js_math\ js_dict js_date js_global js_cast js_promise\ dom dom_storage\ - bs_HashMapInt\ - bs_HashMapString\ + belt_HashMapInt\ + belt_HashMapString\ -# bs_Bag\ -# bs_BagM\ -# bs_dyn bs_dyn_lib\ +# belt_Bag\ +# belt_BagM\ +# belt_dyn belt_dyn_lib\ $(addsuffix .cmj, $(SOURCE_LIST)): $(addsuffix .cmj, $(MAP_FILES)) @@ -84,88 +84,88 @@ clean:: rm -f *~ rm -f *.annot rm -f *.rawlambda *.lam *.lambda *.map - rm -rf bs_HashSetString.ml bs_HashSetString.mli bs_HashSetInt.ml bs_HashSetInt.mli \ - bs_HashMapInt.ml bs_HashMapInt.mli bs_HashMapString.ml bs_HashMapString.mli \ - bs_MapInt.ml bs_MapInt.mli bs_MapString.ml bs_MapString.mli \ - bs_internalSetInt.ml bs_internalSetString.ml \ - bs_SetInt.ml bs_SetInt.mli bs_SetString.ml bs_SetString.mli \ - bs_MutableSetInt.ml bs_MutableSetInt.mli bs_MutableSetString.ml bs_MutableSetString.mli\ - bs_SortArrayInt.ml bs_SortArrayInt.mli bs_SortArrayString.ml bs_SortArrayString.mli\ - bs_internalMapInt.ml bs_internalMapInt.mli \ - bs_internalMapIntM.ml bs_internalMapIntM.mli \ - bs_internalMapString.ml bs_internalMapString.mli\ - bs_internalMapStringM.ml bs_internalMapStringM.mli\ - bs_MutableMapString.mli bs_MutableMapString.ml\ - bs_MutableMapInt.mli bs_MutableMapInt.ml + rm -rf belt_HashSetString.ml belt_HashSetString.mli belt_HashSetInt.ml belt_HashSetInt.mli \ + belt_HashMapInt.ml belt_HashMapInt.mli belt_HashMapString.ml belt_HashMapString.mli \ + belt_MapInt.ml belt_MapInt.mli belt_MapString.ml belt_MapString.mli \ + belt_internalSetInt.ml belt_internalSetString.ml \ + belt_SetInt.ml belt_SetInt.mli belt_SetString.ml belt_SetString.mli \ + belt_MutableSetInt.ml belt_MutableSetInt.mli belt_MutableSetString.ml belt_MutableSetString.mli\ + belt_SortArrayInt.ml belt_SortArrayInt.mli belt_SortArrayString.ml belt_SortArrayString.mli\ + belt_internalMapInt.ml belt_internalMapInt.mli \ + belt_internalMapIntM.ml belt_internalMapIntM.mli \ + belt_internalMapString.ml belt_internalMapString.mli\ + belt_internalMapStringM.ml belt_internalMapStringM.mli\ + belt_MutableMapString.mli belt_MutableMapString.ml\ + belt_MutableMapInt.mli belt_MutableMapInt.ml ifndef BS_RELEASE_BUILD -bs_HashSetString.ml: hashset.cppo.ml +belt_HashSetString.ml: hashset.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_HashSetInt.ml: hashset.cppo.ml +belt_HashSetInt.ml: hashset.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_HashSetString.mli: hashset.cppo.mli +belt_HashSetString.mli: hashset.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_HashSetInt.mli: hashset.cppo.mli +belt_HashSetInt.mli: hashset.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_HashMapString.ml: hashmap.cppo.ml +belt_HashMapString.ml: hashmap.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_HashMapInt.ml: hashmap.cppo.ml +belt_HashMapInt.ml: hashmap.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_HashMapString.mli: hashmap.cppo.mli +belt_HashMapString.mli: hashmap.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_HashMapInt.mli: hashmap.cppo.mli +belt_HashMapInt.mli: hashmap.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_MapString.ml: map.cppo.ml +belt_MapString.ml: map.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_MapInt.ml: map.cppo.ml +belt_MapInt.ml: map.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_MapString.mli: map.cppo.mli +belt_MapString.mli: map.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_MapInt.mli: map.cppo.mli +belt_MapInt.mli: map.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_MutableMapString.mli: mapm.cppo.mli +belt_MutableMapString.mli: mapm.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_MutableMapInt.mli: mapm.cppo.mli +belt_MutableMapInt.mli: mapm.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_MutableMapString.ml: mapm.cppo.ml +belt_MutableMapString.ml: mapm.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_MutableMapInt.ml: mapm.cppo.ml +belt_MutableMapInt.ml: mapm.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_internalMapInt.ml : internal_map.cppo.ml +belt_internalMapInt.ml : internal_map.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_internalMapString.ml : internal_map.cppo.ml +belt_internalMapString.ml : internal_map.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_internalSetInt.ml: internal_set.cppo.ml +belt_internalSetInt.ml: internal_set.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_internalSetString.ml: internal_set.cppo.ml +belt_internalSetString.ml: internal_set.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_SetInt.ml: set.cppo.ml +belt_SetInt.ml: set.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_SetString.ml: set.cppo.ml +belt_SetString.ml: set.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_SetInt.mli: set.cppo.mli +belt_SetInt.mli: set.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_SetString.mli: set.cppo.mli +belt_SetString.mli: set.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_MutableSetInt.ml: setm.cppo.ml +belt_MutableSetInt.ml: setm.cppo.ml cppo -D TYPE_INT $^ > $@ -bs_MutableSetString.ml: setm.cppo.ml +belt_MutableSetString.ml: setm.cppo.ml cppo -D TYPE_STRING $^ > $@ -bs_MutabgleSetInt.mli: setm.cppo.mli +belt_MutableSetInt.mli: setm.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_MutableSetString.mli: setm.cppo.mli +belt_MutableSetString.mli: setm.cppo.mli cppo -D TYPE_STRING $^ > $@ -bs_SortArrayInt.ml : sort.cppo.ml +belt_SortArrayInt.ml : sort.cppo.ml cppo -D TYPE_INT $^ >$@ -bs_SortArrayString.ml : sort.cppo.ml +belt_SortArrayString.ml : sort.cppo.ml cppo -D TYPE_STRING $^ >$@ -bs_SortArrayInt.mli : sort.cppo.mli +belt_SortArrayInt.mli : sort.cppo.mli cppo -D TYPE_INT $^ > $@ -bs_SortArrayString.mli : sort.cppo.mli +belt_gSortArrayString.mli : sort.cppo.mli cppo -D TYPE_STRING $^ > $@ endif diff --git a/jscomp/others/bs.ml b/jscomp/others/belt.ml similarity index 74% rename from jscomp/others/bs.ml rename to jscomp/others/belt.ml index 3f1ef7cd08..4db3e36fb9 100644 --- a/jscomp/others/bs.ml +++ b/jscomp/others/belt.ml @@ -70,27 +70,27 @@ {[ type t = int * int module I0 = - (val Bs.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> match compare a0 b0 with | 0 -> compare a1 b1 | c -> c )) - let s0 = Bs.Set.make ~id:(module I0) + let s0 = Belt.Set.make ~id:(module I0) module I1 = - (val Bs.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> match compare a1 b1 with | 0 -> compare a0 b0 | c -> c )) - let s1 = Bs.Set.make ~id:(module I1) + let s1 = Belt.Set.make ~id:(module I1) ]} Here the compiler would infer [s0] and [s1] having different type so that it would not mix. {[ - val s0 : Bs.Set.t ((int * int), I0.identity) - val s1 : Bs.Set.t ((int * int), I1.identity) + val s0 : ((int * int), I0.identity) t + val s1 : ((int * int), I1.identity) t ]} [I0.identity] and [I1.identity] are not the same using our encoding scheme. @@ -98,25 +98,25 @@ {b Collection Hierachy} In general, we provide a generic collection module, but also create specialized - modules for commonly used data type, take {i Bs.Set} for example + modules for commonly used data type, take {i Belt.Set} for example {[ - Bs.Set - Bs.Set.Int - Bs.Set.String + Belt.Set + Belt.Set.Int + Belt.Set.String ]} - The specialized module {i Bs.Set.Int}, {i Bs.Set.String} is in general more + The specialized module {i Belt.Set.Int}, {i Belt.Set.String} is in general more efficient. - Currently, both {i Bs_Set} and {i Bs.Set} are accessible to users for some + Currently, both {i Belt_Set} and {i Belt.Set} are accessible to users for some technical rasons, - we {b strongly recommend} users stick to qualified import, {i Bs.Sort}, we may hide - the internal, {i i.e}, {i Bs_Set} in the future + we {b strongly recommend} users stick to qualified import, {i Belt.Sort}, we may hide + the internal, {i i.e}, {i Belt_Set} in the future *) -(** {!Bs.Id} +(** {!Belt.Id} Provide utiliites to create identified comparators or hashes for data structures used below. @@ -125,110 +125,110 @@ functions so that different data structures with slightly different comparison functions won't mix *) -module Id = Bs_Id +module Id = Belt_Id -(** {!Bs.Array} +(** {!Belt.Array} {b mutable array}: Utililites functions *) -module Array = Bs_Array +module Array = Belt_Array -(** {!Bs.SortArray} +(** {!Belt.SortArray} The toplevel provides some generic sort related utililties. It also has two specialized inner modules - {!Bs.SortArray.Int} and {!Bs.SortArray.String} + {!Belt.SortArray.Int} and {!Belt.SortArray.String} *) -module SortArray = Bs_SortArray +module SortArray = Belt_SortArray -(** {!Bs.MutableQueue} +(** {!Belt.MutableQueue} An FIFO(first in first out) queue data structure *) -module MutableQueue = Bs_MutableQueue +module MutableQueue = Belt_MutableQueue -(** {!Bs.MutableStack} +(** {!Belt.MutableStack} An FILO(first in last out) stack data structure *) -module MutableStack = Bs_MutableStack +module MutableStack = Belt_MutableStack -(** {!Bs.List} +(** {!Belt.List} Utilities for List data type *) -module List = Bs_List +module List = Belt_List -(** {!Bs.Range} +(** {!Belt.Range} Utilities for a closed range [(from, start)] *) -module Range = Bs_Range +module Range = Belt_Range -(** {!Bs.Set} +(** {!Belt.Set} The toplevel provides generic {b immutable} set operations. It also has three specialized inner modules - {!Bs.Set.Int} and {!Bs.Set.String} - {!Bs.Set.Dict}: This module separate date from function + {!Belt.Set.Int} and {!Belt.Set.String} + {!Belt.Set.Dict}: This module separate date from function which is more verbbose but slightly more efficient *) -module Set = Bs_Set +module Set = Belt_Set -(** {!Bs.Map}, +(** {!Belt.Map}, The toplevel provides generic {b immutable} map operations. It also has three specialized inner modules - {!Bs.Map.Int} and {!Bs.Map.String} - {!Bs.Map.Dict}: This module separate date from function + {!Belt.Map.Int} and {!Belt.Map.String} + {!Belt.Map.Dict}: This module separate date from function which is more verbbose but slightly more efficient *) -module Map = Bs_Map +module Map = Belt_Map -(** {!Bs.MutableSet} +(** {!Belt.MutableSet} The toplevel provides generic {b mutable} set operations. It also has two specialized inner modules - {!Bs.MutableSet.Int} and {!Bs.MutableSet.String} + {!Belt.MutableSet.Int} and {!Belt.MutableSet.String} *) -module MutableSet = Bs_MutableSet +module MutableSet = Belt_MutableSet -(** {!Bs.MutableMap} +(** {!Belt.MutableMap} The toplevel provides generic {b mutable} map operations. It also has two specialized inner modules - {!Bs.MutableMap.Int} and {!Bs.MutableMap.String} + {!Belt.MutableMap.Int} and {!Belt.MutableMap.String} *) -module MutableMap = Bs_MutableMap +module MutableMap = Belt_MutableMap -(** {!Bs.HashSet} +(** {!Belt.HashSet} The toplevel provides generic {b mutable} hash set operations. It also has two specialized inner modules - {!Bs.HashSet.Int} and {!Bs.HashSet.String} + {!Belt.HashSet.Int} and {!Belt.HashSet.String} *) -module HashSet = Bs_HashSet +module HashSet = Belt_HashSet -(** {!Bs.HashMap} +(** {!Belt.HashMap} The toplevel provides generic {b mutable} hash map operations. It also has two specialized inner modules - {!Bs.HashMap.Int} and {!Bs.HashMap.String} + {!Belt.HashMap.Int} and {!Belt.HashMap.String} *) -module HashMap = Bs_HashMap +module HashMap = Belt_HashMap diff --git a/jscomp/others/bs_Array.ml b/jscomp/others/belt_Array.ml similarity index 97% rename from jscomp/others/bs_Array.ml rename to jscomp/others/belt_Array.ml index e15235a2f1..8bcff96576 100644 --- a/jscomp/others/bs_Array.ml +++ b/jscomp/others/belt_Array.ml @@ -327,6 +327,17 @@ let reduceReverseU a x f = let reduceReverse a x f = reduceReverseU a x (fun[@bs] a b -> f a b) +let reduceReverse2U a b x f = + let r = ref x in + let len = min (length a) (length b) in + for i = len - 1 downto 0 do + r := f !r (getUnsafe a i) (getUnsafe b i) [@bs] + done; + !r + +let reduceReverse2 a b x f = + reduceReverse2U a b x (fun [@bs] a b c -> f a b c) + let rec everyAux arr i b len = if i = len then true else if b (getUnsafe arr i) [@bs] then diff --git a/jscomp/others/bs_Array.mli b/jscomp/others/belt_Array.mli similarity index 87% rename from jscomp/others/bs_Array.mli rename to jscomp/others/belt_Array.mli index 89b057e309..cdabbf9c3c 100644 --- a/jscomp/others/bs_Array.mli +++ b/jscomp/others/belt_Array.mli @@ -13,14 +13,16 @@ (* Adapted significantly by Authors of BuckleScript *) -(** {!Bs.Array} +(** {!Belt.Array} Utililites for Array functions *) -external length: 'a array -> int = "%array_length" +external length: 'a array -> int = "%array_length" +(** [length xs] return the size of the array *) + external size: 'a array -> int = "%array_length" -(** [size arr] is the same as [length arr] *) +(** {b See} {!length} *) val get: 'a array -> int -> 'a option @@ -38,6 +40,7 @@ external getUnsafe: 'a array -> int -> 'a = "%array_unsafe_get" no bounds checking, this would cause type error if [i] does not stay within range *) + external getUndefined: 'a array -> int -> 'a Js.undefined = "%array_unsafe_get" (** [getUndefined arr i] @@ -117,18 +120,24 @@ val makeBy: int -> (int -> 'a ) -> 'a array return an empty array when [n] is negative return an array of size [n] populated by [f i] start from [0] to [n - 1] + + @example {[ + makeBy 5 (fun i -> i) = [|0;1;2;3;4|] + ]} *) val makeByAndShuffleU: int -> (int -> 'a [@bs]) -> 'a array val makeByAndShuffle: int -> (int -> 'a ) -> 'a array -(** [makeByAndShuffle n f] is semantically equivalent to [makeBy n f] - and return the shuffled array *) +(** [makeByAndShuffle n f] + + Equivalent to [shuffle (makeBy n f)] +*) val zip: 'a array -> 'b array -> ('a * 'b) array (** [zip a b] - stop with the shorter array + Stop with the shorter array @example {[ zip [|1;2] [|1;2;3|] = [| (1,2); (2;2)|] @@ -139,9 +148,11 @@ val zip: 'a array -> 'b array -> ('a * 'b) array val zipByU: 'a array -> 'b array -> ('a -> 'b -> 'c [@bs]) -> 'c array val zipBy: 'a array -> 'b array -> ('a -> 'b -> 'c ) -> 'c array (** - [zipBy a b f] + [zipBy xs ys f] - stops with shorter array + Stops with shorter array + + Equivalent to [map (zip xs ys) (fun (a,b) -> f a b) ] *) val concat: 'a array -> 'a array -> 'a array @@ -181,13 +192,20 @@ val copy: 'a array -> 'a array val fill: 'a array -> offset:int -> len:int -> 'a -> unit (** [fill arr ~offset ~len x] - modifies [arr] in place, + Modifies [arr] in place, storing [x] in elements number [offset] to [offset + len - 1]. [offset] can be negative [fill arr offset:(-1) len:1 ] means fill the last element, if the array does not have enough data, [fill] will ignore it + + @example {[ + + let arr = makeBy 5 (fun i -> i) ;; + fill arr ~offset:2 ~len:2 0 ;; + arr = [|0;1;0;0;4|];; + ]} *) val blit: @@ -208,18 +226,33 @@ val blit: val blitUnsafe: src:'a array -> srcOffset:int -> dst:'a array -> dstOffset:int -> len:int -> unit - +(** + {b Unsafe} blit without bounds checking +*) val forEachU: 'a array -> ('a -> unit [@bs]) -> unit val forEach: 'a array -> ('a -> unit ) -> unit +(** [forEach xs f] + Call f on each element of [xs] from the beginning to end +*) + val mapU: 'a array -> ('a -> 'b [@bs]) -> 'b array val map: 'a array -> ('a -> 'b ) -> 'b array +(** [map xs f ] + @return a new array by calling [f] to element of [xs] from + the beginning to end +*) + val keepU: 'a array -> ('a -> bool [@bs]) -> 'a array val keep: 'a array -> ('a -> bool ) -> 'a array (** [keep xs p ] @return a new array that keep all elements satisfy [p] + + @example {[ + keep [|1;2;3|] (fun x -> x mod 2 = 0) = [|2|] + ]} *) val keepMapU: 'a array -> ('a -> 'b option [@bs]) -> 'b array @@ -267,6 +300,16 @@ val reduceReverse: 'b array -> 'a -> ('a -> 'b -> 'a ) -> 'a ]} *) +val reduceReverse2U: + 'a array -> 'b array -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c +val reduceReverse2: + 'a array -> 'b array -> 'c -> ('c -> 'a -> 'b -> 'c) -> 'c +(** + @example {[ + reduceReverse2 [|1;2;3|] [|1;2|] 0 (fun acc x y -> acc + x + y) = 6 + ]} +*) + val someU: 'a array -> ('a -> bool [@bs]) -> bool val some: 'a array -> ('a -> bool) -> bool (** [some xs p] @@ -305,8 +348,8 @@ val cmpU: 'a array -> 'a array -> ('a -> 'a -> int [@bs]) -> int val cmp: 'a array -> 'a array -> ('a -> 'a -> int ) -> int (** [cmp a b] - - compared by length if [length a <> length b] - - otherwise compare one by one [f ai bi] + - Compared by length if [length a <> length b] + - Otherwise compare one by one [f ai bi] *) val eqU: 'a array -> 'a array -> ('a -> 'a -> bool [@bs]) -> bool @@ -318,4 +361,4 @@ val eq: 'a array -> 'a array -> ('a -> 'a -> bool ) -> bool *) external truncateToLengthUnsafe: 'a array -> int -> unit = "length" [@@bs.set] -(** {b Unsafe} function *) +(** {b Unsafe} *) diff --git a/jscomp/others/bs_HashMap.ml b/jscomp/others/belt_HashMap.ml similarity index 81% rename from jscomp/others/bs_HashMap.ml rename to jscomp/others/belt_HashMap.ml index 761d9f58f8..efd5777da9 100644 --- a/jscomp/others/bs_HashMap.ml +++ b/jscomp/others/belt_HashMap.ml @@ -9,17 +9,18 @@ (* under the terms of the GNU Library General Public License, with *) (* the special exception on linking described in file ../LICENSE. *) (* *) +(* Adapted by Authors of BuckleScript 2017 *) (***********************************************************************) -(** Adapted by Authors of BuckleScript 2017 *) -module N = Bs_internalBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalBuckets +module C = Belt_internalBucketsType +module A = Belt_Array -type ('a, 'id) eq = ('a, 'id) Bs_Id.eq -type ('a, 'id) hash = ('a, 'id) Bs_Id.hash -type ('a, 'id) dict = ('a, 'id) Bs_Id.hashable + +type ('a, 'id) eq = ('a, 'id) Belt_Id.eq +type ('a, 'id) hash = ('a, 'id) Belt_Id.hash +type ('a, 'id) id = ('a, 'id) Belt_Id.hashable type ('a,'b,'id) t = ( ('a, 'id) hash, ('a, 'id) eq, 'a, 'b) N.t @@ -110,8 +111,8 @@ let set0 h key value ~eq ~hash = *) let set h key value = set0 h key value - ~eq:(Bs_Id.getEqInternal (C.eq h)) - ~hash:(Bs_Id.getHashInternal (C.hash h)) + ~eq:(Belt_Id.getEqInternal (C.eq h)) + ~hash:(Belt_Id.getHashInternal (C.hash h)) let rec removeInBucket h h_buckets i key prec bucket ~eq = match C.toOpt bucket with @@ -129,12 +130,12 @@ let rec removeInBucket h h_buckets i key prec bucket ~eq = let remove h key = let h_buckets = C.buckets h in - let i = (Bs_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in + let i = (Belt_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in let bucket = A.getUnsafe h_buckets i in match C.toOpt bucket with | None -> () | Some cell -> - let eq = (Bs_Id.getEqInternal (C.eq h)) in + let eq = (Belt_Id.getEqInternal (C.eq h)) in if eq (N.key cell ) key [@bs] then begin A.setUnsafe h_buckets i (N.next cell); @@ -154,11 +155,11 @@ let rec getAux ~eq key buckets = let get h key = let h_buckets = C.buckets h in - let nid = (Bs_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in + let nid = (Belt_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in match C.toOpt @@ A.getUnsafe h_buckets nid with | None -> None | Some cell1 -> - let eq = Bs_Id.getEqInternal (C.eq h) in + let eq = Belt_Id.getEqInternal (C.eq h) in if eq key (N.key cell1) [@bs] then Some (N.value cell1) else @@ -185,27 +186,27 @@ let rec memInBucket key cell ~eq = let has h key = let h_buckets = C.buckets h in - let nid = (Bs_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in + let nid = (Belt_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in let bucket = A.getUnsafe h_buckets nid in match C.toOpt bucket with | None -> false | Some bucket -> - memInBucket ~eq:(Bs_Id.getEqInternal (C.eq h)) key bucket + memInBucket ~eq:(Belt_Id.getEqInternal (C.eq h)) key bucket -let make (type elt) (type id) initialize_size ~(dict : (elt,id) dict) = - let module M = (val dict) in - C.make ~hash:M.hash ~eq:M.eq initialize_size +let make (type elt) (type identity) ~hintSize ~(id : (elt,identity) id) = + let module M = (val id) in + C.make ~hash:M.hash ~eq:M.eq ~hintSize -let ofArray (type a) (type id) arr ~dict:(dict:(a,id) dict) = - let module M = (val dict) in +let ofArray (type a) (type identity) arr ~id:(id:(a,identity) id) = + let module M = (val id) in let hash, eq = M.hash, M.eq in let len = A.length arr in - let v = C.make ~hash ~eq len in - let eq, hash = Bs_Id.getEqInternal eq, Bs_Id.getHashInternal hash in + let v = C.make ~hash ~eq ~hintSize:len in + let eq, hash = Belt_Id.getEqInternal eq, Belt_Id.getHashInternal hash in for i = 0 to len - 1 do let key,value = (A.getUnsafe arr i) in set0 ~eq ~hash v key value @@ -213,7 +214,7 @@ let ofArray (type a) (type id) arr ~dict:(dict:(a,id) dict) = v let mergeMany h arr = - let hash, eq = Bs_Id.getHashInternal ( C.hash h) , Bs_Id.getEqInternal (C.eq h) in + let hash, eq = Belt_Id.getHashInternal ( C.hash h) , Belt_Id.getEqInternal (C.eq h) in let len = A.length arr in for i = 0 to len - 1 do let key,value = (A.getUnsafe arr i) in @@ -221,5 +222,5 @@ let mergeMany h arr = done -module Int = Bs_HashMapInt -module String = Bs_HashMapString +module Int = Belt_HashMapInt +module String = Belt_HashMapString diff --git a/jscomp/others/bs_HashMap.mli b/jscomp/others/belt_HashMap.mli similarity index 67% rename from jscomp/others/bs_HashMap.mli rename to jscomp/others/belt_HashMap.mli index ea3f913a7d..df4d66b358 100644 --- a/jscomp/others/bs_HashMap.mli +++ b/jscomp/others/belt_HashMap.mli @@ -22,16 +22,72 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +(** A {b mutable} Hash map which allows customized {!hash} behavior. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i HashMaps of ints} initialized with different + {i hash} functions will have different type. + + For example: + {[ + type t = int + module I0 = + (val Belt.Id.hashableU + ~hash:(fun[\@bs] (a : t) -> a & 0xff_ff) + ~eq:(fun[\@bs] a b -> a = b) + ) + let s0 : (_, string,_) t = make ~hintSize:40 ~id:(module I0) + module I1 = + (val Belt.Id.hashableU + ~hash:(fun[\@bs] (a : t) -> a & 0xff) + ~eq:(fun[\@bs] a b -> a = b) + ) + let s1 : (_, string,_) t = make ~hintSize:40 ~id:(module I1) + ]} + + The invariant must be held: for two elements who are {i equal}, + their hashed value should be the same + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : (int, I0.identity) t + val s1 : (int, I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let () = + add s1 0 "3"; + add s1 1 "3" + ]} + + Since this is an mutable data strucure, [s1] will contain two pairs. +*) + + +(** Specalized when key type is [int], more efficient + than the gerneic type *) +module Int = Belt_HashMapInt + + +(** Specalized when key type is [string], more efficient + than the gerneic type *) +module String = Belt_HashMapString + type ('key,'value,'id) t (** The type of hash tables from type ['key] to type ['value]. *) -type ('a, 'id) dict = ('a, 'id) Bs_Id.hashable +type ('a, 'id) id = ('a, 'id) Belt_Id.hashable -val make: int -> dict:('key, 'id) dict -> ('key,'value,'id) t +val make: hintSize:int -> id:('key, 'id) id -> ('key,'value,'id) t (*TODO: allow randomization for security *) val clear: ('key, 'value, 'id ) t -> unit @@ -93,14 +149,9 @@ val size: _ t -> int val toArray: ('key, 'value, 'id ) t -> ('key * 'value) array val keysToArray: ('key, _, _) t -> 'key array val valuesToArray: (_,'value,_) t -> 'value array -val ofArray: ('key * 'value) array -> dict:('key,'id) dict -> ('key, 'value, 'id ) t +val ofArray: ('key * 'value) array -> id:('key,'id) id -> ('key, 'value, 'id ) t val mergeMany: ('key, 'value, 'id ) t -> ('key * 'value) array -> unit val getBucketHistogram: _ t -> int array val logStats: _ t -> unit - -module Int = Bs_HashMapInt -module String = Bs_HashMapString - - diff --git a/jscomp/others/bs_HashMapInt.ml b/jscomp/others/belt_HashMapInt.ml similarity index 97% rename from jscomp/others/bs_HashMapInt.ml rename to jscomp/others/belt_HashMapInt.ml index 8b3bf36f72..40bfe636d5 100644 --- a/jscomp/others/bs_HashMapInt.ml +++ b/jscomp/others/belt_HashMapInt.ml @@ -22,9 +22,9 @@ let hash (s : key) = final_mix (caml_hash_mix_int 0 s) # 33 -module N = Bs_internalBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type 'b t = (unit, unit, key,'b) N.t @@ -170,7 +170,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size let forEachU = N.forEachU diff --git a/jscomp/others/bs_HashMapInt.mli b/jscomp/others/belt_HashMapInt.mli similarity index 96% rename from jscomp/others/bs_HashMapInt.mli rename to jscomp/others/belt_HashMapInt.mli index 591ff8f2f7..30f0b47b3c 100644 --- a/jscomp/others/bs_HashMapInt.mli +++ b/jscomp/others/belt_HashMapInt.mli @@ -6,7 +6,7 @@ type key = int type 'b t -val make: int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit diff --git a/jscomp/others/bs_HashMapString.ml b/jscomp/others/belt_HashMapString.ml similarity index 97% rename from jscomp/others/bs_HashMapString.ml rename to jscomp/others/belt_HashMapString.ml index d2a28a63c1..1a30d38794 100644 --- a/jscomp/others/bs_HashMapString.ml +++ b/jscomp/others/belt_HashMapString.ml @@ -22,9 +22,9 @@ let hash (s : key) = final_mix (caml_hash_mix_string 0 s ) # 33 -module N = Bs_internalBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type 'b t = (unit, unit, key,'b) N.t @@ -170,7 +170,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size let forEachU = N.forEachU diff --git a/jscomp/others/bs_HashMapString.mli b/jscomp/others/belt_HashMapString.mli similarity index 96% rename from jscomp/others/bs_HashMapString.mli rename to jscomp/others/belt_HashMapString.mli index 51ff093e4a..be3fe06942 100644 --- a/jscomp/others/bs_HashMapString.mli +++ b/jscomp/others/belt_HashMapString.mli @@ -6,7 +6,7 @@ type key = string type 'b t -val make: int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit diff --git a/jscomp/others/bs_HashSet.ml b/jscomp/others/belt_HashSet.ml similarity index 81% rename from jscomp/others/bs_HashSet.ml rename to jscomp/others/belt_HashSet.ml index 3716b4fb16..cbca3558c9 100644 --- a/jscomp/others/bs_HashSet.ml +++ b/jscomp/others/belt_HashSet.ml @@ -22,18 +22,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_HashSetInt +module Int = Belt_HashSetInt -module String = Bs_HashSetString +module String = Belt_HashSetString -module N = Bs_internalSetBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalSetBuckets +module C = Belt_internalBucketsType +module A = Belt_Array -type ('a, 'id) eq = ('a, 'id) Bs_Id.eq -type ('a, 'id) hash = ('a, 'id) Bs_Id.hash -type ('a, 'id) dict = ('a, 'id) Bs_Id.hashable +type ('a, 'id) eq = ('a, 'id) Belt_Id.eq +type ('a, 'id) hash = ('a, 'id) Belt_Id.hash +type ('a, 'id) id = ('a, 'id) Belt_Id.hashable type ('a,'id) t = ( ('a, 'id) hash, ('a, 'id) eq, 'a) N.t @@ -43,7 +43,7 @@ let rec copyBucket ~hash ~h_buckets ~ndata_tail old_bucket = match C.toOpt old_bucket with | None -> () | Some cell -> - let nidx = (Bs_Id.getHashInternal hash) (N.key cell) [@bs] land (A.length h_buckets - 1) in + let nidx = (Belt_Id.getHashInternal hash) (N.key cell) [@bs] land (A.length h_buckets - 1) in let v = C.return cell in begin match C.toOpt (A.getUnsafe ndata_tail nidx) with | None -> @@ -77,7 +77,7 @@ let tryDoubleResize ~hash h = let rec removeBucket ~eq h h_buckets i key prec cell = let cell_next = N.next cell in - if (Bs_Id.getEqInternal eq) (N.key cell) key [@bs] + if (Belt_Id.getEqInternal eq) (N.key cell) key [@bs] then begin N.nextSet prec cell_next; @@ -93,13 +93,13 @@ let rec removeBucket ~eq h h_buckets i key prec cell = let remove h key = let eq = C.eq h in let h_buckets = C.buckets h in - let i = (Bs_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in + let i = (Belt_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in let l = A.getUnsafe h_buckets i in match C.toOpt l with | None -> () | Some cell -> let next_cell = N.next cell in - if (Bs_Id.getEqInternal eq) (N.key cell) key [@bs] then + if (Belt_Id.getEqInternal eq) (N.key cell) key [@bs] then begin C.sizeSet h (C.size h - 1) ; A.setUnsafe h_buckets i next_cell @@ -113,7 +113,7 @@ let remove h key = let rec addBucket h key cell ~eq = - if not ((Bs_Id.getEqInternal eq) (N.key cell) key [@bs]) then + if not ((Belt_Id.getEqInternal eq) (N.key cell) key [@bs]) then let n = N.next cell in match C.toOpt n with | None -> @@ -124,7 +124,7 @@ let rec addBucket h key cell ~eq = let add0 h key ~hash ~eq = let h_buckets = C.buckets h in let buckets_len = A.length h_buckets in - let i = (Bs_Id.getHashInternal hash) key [@bs] land (buckets_len - 1) in + let i = (Belt_Id.getHashInternal hash) key [@bs] land (buckets_len - 1) in let l = A.getUnsafe h_buckets i in (match C.toOpt l with | None -> @@ -139,7 +139,7 @@ let add h key = add0 ~hash:(C.hash h) ~eq:(C.eq h) h key let rec memInBucket ~eq key cell = - (Bs_Id.getEqInternal eq) + (Belt_Id.getEqInternal eq) (N.key cell) key [@bs] || (match C.toOpt (N.next cell) with | None -> false @@ -150,7 +150,7 @@ let rec memInBucket ~eq key cell = let has h key = let eq, h_buckets = C.eq h, C.buckets h in - let nid = (Bs_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in + let nid = (Belt_Id.getHashInternal (C.hash h)) key [@bs] land (A.length h_buckets - 1) in let bucket = A.getUnsafe h_buckets nid in match C.toOpt bucket with | None -> false @@ -160,9 +160,9 @@ let has h key = -let make (type elt) (type id) initialize_size ~(dict: (elt, id) dict)= - let module M = (val dict) in - C.make initialize_size ~hash:M.hash ~eq:M.eq +let make (type elt) (type identity) ~hintSize ~(id: (elt, identity) id)= + let module M = (val id) in + C.make ~hintSize ~hash:M.hash ~eq:M.eq let clear = C.clear let size = C.size @@ -176,11 +176,11 @@ let copy = N.copy let getBucketHistogram = N.getBucketHistogram let isEmpty = C.isEmpty -let ofArray (type a) (type id) arr ~(dict:(a,id) dict) = - let module M = (val dict) in +let ofArray (type a) (type identity) arr ~(id:(a,identity) id) = + let module M = (val id) in let eq, hash = M.eq , M.hash in let len = A.length arr in - let v = C.make len ~hash ~eq in + let v = C.make ~hintSize:len ~hash ~eq in for i = 0 to len - 1 do add0 ~eq ~hash v (A.getUnsafe arr i) done ; diff --git a/jscomp/others/bs_HashSet.mli b/jscomp/others/belt_HashSet.mli similarity index 55% rename from jscomp/others/bs_HashSet.mli rename to jscomp/others/belt_HashSet.mli index bbb92b5b55..40adaff244 100644 --- a/jscomp/others/bs_HashSet.mli +++ b/jscomp/others/belt_HashSet.mli @@ -22,21 +22,75 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** specalized when key type is [int], more efficient +(** A {b mutable} Hash set which allows customized {!hash} behavior. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i HashSets of ints} initialized with different + {i hash} functions will have different type. + + For example: + {[ + type t = int + module I0 = + (val Belt.Id.hashableU + ~hash:(fun[\@bs] (a : t) -> a & 0xff_ff) + ~eq:(fun[\@bs] a b -> a = b) + ) + let s0 = make ~id:(module I0) ~hintSize:40 + module I1 = + (val Belt.Id.hashableU + ~hash:(fun[\@bs] (a : t) -> a & 0xff) + ~eq:(fun[\@bs] a b -> a = b) + ) + let s1 = make ~id:(module I1) ~hintSize:40 + ]} + + The invariant must be held: for two elements who are {i equal}, + their hashed value should be the same + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : (int, I0.identity) t + val s1 : (int, I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let () = + add s1 0; + add s1 1 + ]} + + Since this is an mutable data strucure, [s1] will contain two pairs. +*) + + +(** Specalized when key type is [int], more efficient than the gerneic type *) -module Int = Bs_HashSetInt +module Int = Belt_HashSetInt -(** specalized when key type is [string], more efficient +(** Specalized when key type is [string], more efficient than the gerneic type *) -module String = Bs_HashSetString +module String = Belt_HashSetString + +(* TODO: add a poly module + module Poly = Belt_HashSetPoly + challenge: + - generic equal handles JS data structure + - eq/hash consistent +*) type ('a, 'id) t (** The type of hash tables from type ['a] to type ['b]. *) -type ('a, 'id) dict = ('a, 'id) Bs_Id.hashable +type ('a, 'id) id = ('a, 'id) Belt_Id.hashable -val make: int -> dict:('a,'id) dict -> ('a, 'id) t +val make: hintSize:int -> id:('a,'id) id -> ('a, 'id) t val clear: ('a, 'id) t -> unit val isEmpty: _ t -> bool @@ -62,7 +116,7 @@ val logStats: _ t -> unit val toArray: ('a,'id) t -> 'a array -val ofArray: 'a array -> dict:('a,'id) dict -> ('a,'id) t +val ofArray: 'a array -> id:('a,'id) id -> ('a,'id) t val mergeMany: ('a,'id) t -> 'a array -> unit diff --git a/jscomp/others/bs_HashSetInt.ml b/jscomp/others/belt_HashSetInt.ml similarity index 95% rename from jscomp/others/bs_HashSetInt.ml rename to jscomp/others/belt_HashSetInt.ml index 736a8ddd10..07ca3ef888 100644 --- a/jscomp/others/bs_HashSetInt.ml +++ b/jscomp/others/belt_HashSetInt.ml @@ -7,9 +7,9 @@ let hash (s : key) = final_mix (caml_hash_mix_int 0 s) # 20 -module N = Bs_internalSetBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalSetBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type t = (unit, unit, key) N.t @@ -124,7 +124,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size @@ -140,7 +140,7 @@ let isEmpty = C.isEmpty let ofArray arr = let len = A.length arr in - let v = C.make len ~hash:() ~eq:() in + let v = C.make ~hintSize:len ~hash:() ~eq:() in for i = 0 to len - 1 do add v (A.getUnsafe arr i) done ; diff --git a/jscomp/others/belt_HashSetInt.mli b/jscomp/others/belt_HashSetInt.mli new file mode 100644 index 0000000000..9834940665 --- /dev/null +++ b/jscomp/others/belt_HashSetInt.mli @@ -0,0 +1,73 @@ + +# 2 "hashset.cppo.mli" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.HashSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.HashSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.HashSet} +*) + + +# 38 +type key = int + + +# 44 +type t + +val make: hintSize:int -> t + +val clear: t -> unit + +val isEmpty: t -> bool + +val add: t -> key -> unit + +val copy: t -> t + +val has: t -> key -> bool + +val remove: t -> key -> unit + +val forEachU: t -> (key -> unit [@bs]) -> unit +val forEach: t -> (key -> unit) -> unit + +val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c +val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c + +val size: t -> int + +val logStats: t -> unit + +val toArray: t -> key array + +val ofArray: key array -> t + +val mergeMany: t -> key array -> unit + +val getBucketHistogram: t -> int array diff --git a/jscomp/others/bs_HashSetString.ml b/jscomp/others/belt_HashSetString.ml similarity index 95% rename from jscomp/others/bs_HashSetString.ml rename to jscomp/others/belt_HashSetString.ml index 3311c689ed..dd5abe47f0 100644 --- a/jscomp/others/bs_HashSetString.ml +++ b/jscomp/others/belt_HashSetString.ml @@ -8,9 +8,9 @@ let hash (s : key) = # 20 -module N = Bs_internalSetBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalSetBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type t = (unit, unit, key) N.t @@ -125,7 +125,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size @@ -141,7 +141,7 @@ let isEmpty = C.isEmpty let ofArray arr = let len = A.length arr in - let v = C.make len ~hash:() ~eq:() in + let v = C.make ~hintSize:len ~hash:() ~eq:() in for i = 0 to len - 1 do add v (A.getUnsafe arr i) done ; diff --git a/jscomp/others/belt_HashSetString.mli b/jscomp/others/belt_HashSetString.mli new file mode 100644 index 0000000000..d27cf28493 --- /dev/null +++ b/jscomp/others/belt_HashSetString.mli @@ -0,0 +1,73 @@ + +# 2 "hashset.cppo.mli" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.HashSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.HashSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.HashSet} +*) + + +# 36 +type key = string + + +# 44 +type t + +val make: hintSize:int -> t + +val clear: t -> unit + +val isEmpty: t -> bool + +val add: t -> key -> unit + +val copy: t -> t + +val has: t -> key -> bool + +val remove: t -> key -> unit + +val forEachU: t -> (key -> unit [@bs]) -> unit +val forEach: t -> (key -> unit) -> unit + +val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c +val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c + +val size: t -> int + +val logStats: t -> unit + +val toArray: t -> key array + +val ofArray: key array -> t + +val mergeMany: t -> key array -> unit + +val getBucketHistogram: t -> int array diff --git a/jscomp/others/bs_Id.ml b/jscomp/others/belt_Id.ml similarity index 100% rename from jscomp/others/bs_Id.ml rename to jscomp/others/belt_Id.ml diff --git a/jscomp/others/bs_Id.mli b/jscomp/others/belt_Id.mli similarity index 99% rename from jscomp/others/bs_Id.mli rename to jscomp/others/belt_Id.mli index 66d0971228..c5be45141c 100644 --- a/jscomp/others/bs_Id.mli +++ b/jscomp/others/belt_Id.mli @@ -24,7 +24,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** {!Bs.Id} +(** {!Belt.Id} Provide utiliites to create identified comparators or hashes for data structures used below. diff --git a/jscomp/others/bs_List.ml b/jscomp/others/belt_List.ml similarity index 93% rename from jscomp/others/bs_List.ml rename to jscomp/others/belt_List.ml index 82b59fb79e..47426252db 100644 --- a/jscomp/others/bs_List.ml +++ b/jscomp/others/belt_List.ml @@ -61,7 +61,7 @@ type 'a t = 'a list -module A = Bs_Array +module A = Belt_Array external mutableCell : 'a -> 'a t -> 'a t = "#makemutablelist" @@ -403,7 +403,7 @@ let ofArray a = let toArray ( x : _ t) = let len = length x in - let arr = Bs_Array.makeUninitializedUnsafe len in + let arr = Belt_Array.makeUninitializedUnsafe len in fillAux arr 0 x; arr @@ -418,7 +418,7 @@ let rec fillAuxMap arr i x f = (* type json = J.t *) (* let toJson x f = *) (* let len = length x in *) -(* let arr = Bs_Array.makeUninitializedUnsafe len in *) +(* let arr = Belt_Array.makeUninitializedUnsafe len in *) (* fillAuxMap arr 0 x f; *) (* J.array arr *) @@ -430,7 +430,7 @@ let rec fillAuxMap arr i x f = (* let fromJson j f = *) (* match J.decodeArray j with *) (* | Some arr -> *) -(* let len = Bs_Array.length arr in *) +(* let len = Belt_Array.length arr in *) (* if len = 0 then [] *) (* else *) (* let head = (mutableCell (f (A.getUnsafe arr 0) [@bs]) []) in *) @@ -511,11 +511,19 @@ let rec reduceU l accu f = let reduce l accu f = reduceU l accu (fun[@bs] acc x -> f acc x ) -let rec reduceReverseU l accu f = + +let rec reduceReverseUnsafeU l accu f = match l with [] -> accu - | a::l -> f a (reduceReverseU l accu f) [@bs] + | a::l -> f (reduceReverseUnsafeU l accu f) a [@bs] +let reduceReverseU (type a ) (type b) (l : a list) (acc : b) f = + let len = length l in + if len < 1000 then + reduceReverseUnsafeU l acc f + else + A.reduceReverseU (toArray l) acc f + let reduceReverse l accu f = reduceReverseU l accu (fun [@bs] a b -> f a b) @@ -544,13 +552,23 @@ let rec reduce2U l1 l2 accu f = let reduce2 l1 l2 acc f = reduce2U l1 l2 acc (fun[@bs] a b c -> f a b c ) -let rec reduceReverse2U l1 l2 accu f = +let rec reduceReverse2UnsafeU l1 l2 accu f = match (l1, l2) with ([], []) -> accu - | (a1::l1, a2::l2) -> f a1 a2 (reduceReverse2U l1 l2 accu f) [@bs] + | (a1::l1, a2::l2) -> + f (reduceReverse2UnsafeU l1 l2 accu f) a1 a2 [@bs] | _, [] | [], _ -> accu -let reduceReverse2 l1 l2 acc f = reduceReverse2U l1 l2 acc (fun [@bs] a b c -> f a b c) +let reduceReverse2U (type a ) (type b ) (type c) + (l1 : a list) (l2 : b list) (acc : c) f = + let len = length l1 in + if len < 1000 then + reduceReverse2UnsafeU l1 l2 acc f + else + A.reduceReverse2U (toArray l1) (toArray l2) acc f + +let reduceReverse2 l1 l2 acc f = + reduceReverse2U l1 l2 acc (fun [@bs] a b c -> f a b c) let rec everyU xs p = match xs with @@ -573,6 +591,14 @@ let rec every2U l1 l2 p = let every2 l1 l2 p = every2U l1 l2 (fun[@bs] a b -> p a b) +let rec cmpByLength l1 l2 = + match l1, l2 with + | [], [] -> 0 + | _, [] -> 1 + | [], _ -> -1 + | _ :: l1s , _ :: l2s -> + cmpByLength l1s l2s + let rec cmpU l1 l2 p = match (l1, l2) with | [], [] -> 0 @@ -583,9 +609,10 @@ let rec cmpU l1 l2 p = if c = 0 then cmpU l1 l2 p else c - + let cmp l1 l2 f = cmpU l1 l2 (fun [@bs] x y -> f x y) + let rec eqU l1 l2 p = match (l1, l2) with | [], [] -> true diff --git a/jscomp/others/bs_List.mli b/jscomp/others/belt_List.mli similarity index 70% rename from jscomp/others/bs_List.mli rename to jscomp/others/belt_List.mli index 1a25c3bace..6f826cd10c 100644 --- a/jscomp/others/bs_List.mli +++ b/jscomp/others/belt_List.mli @@ -22,9 +22,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** {!Bs.List} +(** {!Belt.List} - Utilities for List data type + Utilities for List data type. + + This module is compatible with original ocaml stdlib. + In general, all functions comes with the original stdlib also + applies to this collection, however, this module provides faster + and stack safer utilities + *) type 'a t = 'a list @@ -32,42 +38,69 @@ type 'a t = 'a list val length: 'a t -> int (** [length l] - return the length of the list [l] + + @return the length of the list [l] *) val size: 'a t -> int -(** [size l] is the same as [length l] *) +(** {b See} {!length} *) val head: 'a t -> 'a option - +(** + @example {[ + head [] = None ;; + head [1;2;3] = Some 1 ;; + ]} +*) val headExn: 'a t -> 'a (** [headExn h] - {b raise} an exception if [h] is emmpty + {b See} {!head} + + {b raise} an exception if [h] is empty + *) val tail: 'a t -> 'a t option +(** @example{[ + tail [] = None ;; + tail [1;2] = Some [2];; + ]} +*) + val tailExn: 'a t -> 'a t (** [tailExn h] + {b See} {!tail} + {b raise} an exception if [h] is empty *) val add: 'a t -> 'a -> 'a t - +(** + @example{[ + add [1] 3 = [3;1];; + ]} +*) val get: 'a t -> int -> 'a option (** [get xs n] return the nth element in [xs], or [None] if [n] is larger than the length + + @example {[ + get [0;3;32] 2 = Some 2 ;; + get [0;3;32] 3 = None;; + ]} *) val getExn: 'a t -> int -> 'a (** [getExn xs n] - return the nth element in [xs], - or {b raise} an exception if [n] is larger than the length + {b See} {!get} + + {b raise} an exception if [n] is larger than the length *) val make: int -> 'a -> 'a t @@ -75,6 +108,10 @@ val make: int -> 'a -> 'a t - return a list of length [n] with each element filled with [v] - return the empty list if [n] is negative + + @example {[ + make 3 1 = [1;1;1] + ]} *) val makeByU: int -> (int -> 'a [@bs]) -> 'a t @@ -91,14 +128,28 @@ val makeBy: int -> (int -> 'a) -> 'a t val drop: 'a t -> int -> 'a t option (** [drop xs n] + return the list obtained by dropping the first [n] elements, or [None] if [xs] has fewer than [n] elements + + @example {[ + drop [1;2;3] 2 = Some [3];; + drop [1;2;3] 3 = Some [];; + drop [1;2;3] 4 = None;; + ]} *) val take: 'a t -> int -> 'a t option (** [take xs n] + return a list with the first [n] elements from [xs], or [None] if [xs] has fewer than [n] elements + + @example {[ + take [1;2;3] 1 = Some [1];; + take [1;2;3] 2 = Some [1;2];; + take [1;2;3] 4 = None;; + ]} *) val splitAt: 'a t -> int -> ('a list * 'a list) option @@ -106,18 +157,31 @@ val splitAt: 'a t -> int -> ('a list * 'a list) option [splitAt xs n] split the list [xs] at position [n] return None when the length of [xs] is less than [n] + + @example{[ + splitAt [0;1;2;3;4] 2 = Some ([0;1], [2;3;4]) + ]} *) val concat: 'a t -> 'a t -> 'a t (** [concat xs ys] - return the list obtained by adding [ys] after [xs] + + @return the list obtained by adding [ys] after [xs] + + @example {[ + concat [1;2;3] [4;5] = [1;2;3;4;5] + ]} *) val concatMany: 'a t array -> 'a t (** [concatMany a] return the list obtained by concatenating in order all the lists in array [a] + + @example {[ + concatMany [| [1;2;3] ; []; [3]; [4] |] = [1;2;3;3;4] + ]} *) val reverseConcat: 'a t -> 'a t -> 'a t @@ -132,35 +196,63 @@ val flatten: 'a t t -> 'a t (** [flatten ls] return the list obtained by concatenating in order all the lists in list [ls] + + @example {[ + flatten [ [1;2;3] ; []; [3]; [4] ] = [1;2;3;3;4] + ]} *) val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t val map: 'a t -> ('a -> 'b) -> 'b t (** [map xs f] + return the list obtained by applying [f] to the element of [xs] + + @example {[ + map [1;2] (fun x-> x + 1) = [3;4] + ]} *) val zip: 'a t -> 'b t -> ('a * 'b) t (** [zip xs ys] - return a list of pairs from the two lists - with the length of the shorter list + + @return a list of pairs from the two lists + with the length of the shorter list + + @example {[ + zip [1;2] [1;2;3] = [(1,1); (2,2)] + ]} *) val zipByU: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t val zipBy: 'a t -> 'b t -> ('a -> 'b -> 'c) -> 'c t (** [zipBy xs ys f] - equivalent to [zip xs ys |> List.map (fun (x,y) -> f x y)] + {b See} {!zip} + + Equivalent to [zip xs ys |> List.map (fun (x,y) -> f x y)] *) val mapWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> 'b t val mapWithIndex: 'a t -> (int -> 'a -> 'b) -> 'b t +(** @example {[ + mapWithIndex [1;2;3] (fun i x -> i + x) = + [0 + 1; 1 + 2; 2 + 3 ] + ]} +*) val ofArray: 'a array -> 'a t - -val toArray: 'a t -> 'a array +(** @example {[ + ofArray [|1;2;3|] = [1;2;3] + ]} +*) +val toArray: 'a t -> 'a array +(** @example {[ + toArray [1;2;3] = [|1;2;3|] + ]} +*) (* type json = Js_json.t *) (* val toJson : 'a t -> ('a -> json [@bs]) -> json *) @@ -168,26 +260,61 @@ val toArray: 'a t -> 'a array val reverse: 'a t -> 'a t - +(** @example {[ + reverse [1;2;3] = [3;2;1] + ]} +*) val mapReverseU: 'a t -> ('a -> 'b [@bs]) -> 'b t val mapReverse: 'a t -> ('a -> 'b) -> 'b t -(** [mapReverse a f] is equivalent to [reverse (map a f)] +(** [mapReverse a f] + + Equivalent to [reverse (map a f)] *) val forEachU: 'a t -> ('a -> 'b [@bs]) -> unit val forEach: 'a t -> ('a -> 'b) -> unit - +(** [forEach xs f ] + @example {[ + let us = ref 0;; + forEach [1;2;3;4] (fun x -> us := !us + x);; + !us = 1 + 2 + 3 + 4;; + ]} +*) + val forEachWithIndexU: 'a t -> (int -> 'a -> 'b [@bs]) -> unit val forEachWithIndex: 'a t -> (int -> 'a -> 'b) -> unit +(** [forEachWithIndex xs f] + @example {[ + let us = ref 0 ;; + forEachWithIndex [1;1;1;1] (fun i x -> us := !us + x + i);; + !us = 0 + 1 + 1 + 1 + 2 + 1 + 3 + 1;; + ]} +*) val reduceU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b val reduce: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b +(** [reduce xs f] -val reduceReverseU: 'a t -> 'b -> ('a -> 'b -> 'b [@bs]) -> 'b -val reduceReverse: 'a t -> 'b -> ('a -> 'b -> 'b) -> 'b + @example {[ + reduce [1;2;3;4] 0 (+) = 10;; + reduce [1;2;3;4] 10 (-) = 0;; + reduce [1;2;3;4] [] add = [4;3;2;1]; + ]} +*) + +val reduceReverseU: 'a t -> 'b -> ('b -> 'a -> 'b [@bs]) -> 'b +val reduceReverse: 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b +(** [reduceReverse xs f] + @example {[ + reduceReverse [1;2;3;4] 0 (+) = 10;; + reduceReverse [1;2;3;4] 10 (-) = 0;; + reduceReverse [1;2;3;4] [] add = [1;2;3;4];; + ]} +*) + val mapReverse2U: 'a t -> 'b t -> ('a -> 'b -> 'c [@bs]) -> 'c t val mapReverse2: 'a t -> 'b t -> ('a -> 'b -> 'c) -> 'c t (** [mapReverse2 xs ys f] @@ -215,9 +342,9 @@ val reduce2: *) val reduceReverse2U: - 'a t -> 'b t -> 'c -> ('a -> 'b -> 'c -> 'c [@bs]) -> 'c + 'a t -> 'b t -> 'c -> ('c -> 'a -> 'b -> 'c [@bs]) -> 'c val reduceReverse2: - 'a t -> 'b t -> 'c -> ('a -> 'b -> 'c -> 'c) -> 'c + 'a t -> 'b t -> 'c -> ('c -> 'a -> 'b -> 'c) -> 'c (** [reduceReverse2 xs ys init f ] @@ -264,14 +391,26 @@ val some2: 'a t -> 'b t -> ('a -> 'b -> bool) -> bool (some2 [2;3] [1;4] (fun x y -> x > y)) = true;; ]} *) + +val cmpByLength: 'a t -> 'a t -> int +(** [cmpByLength l1 l2] + + Compare two lists solely by length +*) + val cmpU: 'a t -> 'a t -> ('a -> 'a -> int [@bs]) -> int val cmp: 'a t -> 'a t -> ('a -> 'a -> int) -> int (** [cmp xs ys cmpElem] compare lists [xs] and [ys] using [cmpElem] to compare elements @example {[ - cmp [1;2;3] [1;2;3] compare = 0 + cmp [1;2;3] [1;2;3] compare = 0;; + cmp [1;2;3] [0;1;2;3] compare = 1 ;;] ]} + + {b Attention}: The total ordering of List is different from Array, + for Array, we compare the length first and one by one later, while + for lists, we just compare one by one *) @@ -290,11 +429,19 @@ val eq: 'a t -> 'a t -> ('a -> 'a -> bool) -> bool val hasU: 'a t -> 'b -> ('a -> 'b -> bool [@bs]) -> bool val has: 'a t -> 'b -> ('a -> 'b -> bool) -> bool - +(** @example {[ + has [1;2;3] 2 (=) = true;; + has [1;2;3] 4 (=) = false;; + ]} +*) val getByU: 'a t -> ('a -> bool [@bs]) -> 'a option val getBy: 'a t -> ('a -> bool) -> 'a option - +(** @example {[ + getBy [1;4;3;2] (fun x -> x mod 2 = 0) = Some 4 + ]} +*) + val keepU: 'a t -> ('a -> bool [@bs]) -> 'a t val keep: 'a t -> ('a -> bool) -> 'a t (** [keep xs p] @@ -306,7 +453,14 @@ val keep: 'a t -> ('a -> bool) -> 'a t *) val keepMapU: 'a t -> ('a -> 'b option [@bs]) -> 'b t val keepMap: 'a t -> ('a -> 'b option) -> 'b t +(** [keepMap xs f] + @example {[ + keepMap [1;2;3;4] (fun x -> if x mod 2 = 0 then Some (-x ) else None) + = + [-2;-4] + ]} +*) val partitionU: 'a t -> ('a -> bool [@bs]) -> 'a t * 'a t val partition: 'a t -> ('a -> bool) -> 'a t * 'a t (** [partition xs p] @@ -317,7 +471,12 @@ val partition: 'a t -> ('a -> bool) -> 'a t * 'a t ]} *) val unzip: ('a * 'b) t -> 'a t * 'b t +(** [unzip xs] + @example {[ + unzip [(1,2) ; (3,4)] = ([1;3], [2;4]) + ]} +*) val getAssocU: ('a * 'c) t -> 'b -> ('a -> 'b -> bool [@bs]) -> 'c option val getAssoc: ('a * 'c) t -> 'b -> ('a -> 'b -> bool) -> 'c option (** [getAssoc xs k eq] diff --git a/jscomp/others/bs_Map.ml b/jscomp/others/belt_Map.ml similarity index 95% rename from jscomp/others/bs_Map.ml rename to jscomp/others/belt_Map.ml index 1b01a321d0..0d83e387ea 100644 --- a/jscomp/others/bs_Map.ml +++ b/jscomp/others/belt_Map.ml @@ -15,21 +15,21 @@ (** specalized when key type is [int], more efficient than the gerneic type *) -module Int = Bs_MapInt +module Int = Belt_MapInt (** specalized when key type is [string], more efficient than the gerneic type *) -module String = Bs_MapString +module String = Belt_MapString (** seprate function from data, a more verbsoe but slightly more efficient *) -module Dict = Bs_MapDict +module Dict = Belt_MapDict -module N = Bs_MapDict -module A = Bs_Array +module N = Belt_MapDict +module A = Belt_Array -type ('key, 'id ) id = ('key, 'id) Bs_Id.comparable -type ('key, 'id ) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id ) id = ('key, 'id) Belt_Id.comparable +type ('key, 'id ) cmp = ('key, 'id) Belt_Id.cmp module S = struct type ('k,'v,'id) t = { cmp: ('k,'id) cmp; diff --git a/jscomp/others/bs_Map.mli b/jscomp/others/belt_Map.mli similarity index 70% rename from jscomp/others/bs_Map.mli rename to jscomp/others/belt_Map.mli index 7dca36992a..5c4467c4f5 100644 --- a/jscomp/others/bs_Map.mli +++ b/jscomp/others/belt_Map.mli @@ -12,48 +12,121 @@ (* Adapted by authors of BuckleScript without using functors *) (***********************************************************************) +(** A {i immutable} sorted map module which allows customize {i compare} behavior. + + The implementation uses balanced binary trees, and therefore searching + and insertion take time logarithmic in the size of the map. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i Map of int keys} initialized with different + {i compare} functions will have different type. + + For example: + {[ + type t = int * int + module I0 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match Pervasives.compare a0 b0 with + | 0 -> Pervasives.compare a1 b1 + | c -> c + )) + let s0 : (_, string, _) t = make ~id:(module I0) (* value is of type string *) + module I1 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match compare a1 b1 with + | 0 -> compare a0 b0 + | c -> c + )) + let s1 : (_, string, _) t = make ~id:(module I1) + ]} + + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : ((int * int), string, I0.identity) t + val s1 : ((int * int), string, I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let s2 = add s1 (0,0) "a" + let s3 = add s2 (1,1) "b" + ]} + + Since this is an immutable data strucure, [s1] will be an empty map + while [s2] will contain one pair, [s3] will contain two. + + The [merge s0 s3 callback] will result in a type error, since their identity mismatch +*) + + (** Specalized when key type is [int], more efficient - than the gerneic type + than the gerneic type, its compare behavior is fixed using the built-in comparison *) -module Int = Bs_MapInt +module Int = Belt_MapInt + (** specalized when key type is [string], more efficient - than the gerneic type *) -module String = Bs_MapString + than the gerneic type, its compare behavior is fixed using the built-in comparison *) +module String = Belt_MapString -(** Seprate function from data, a more verbsoe but slightly - more efficient +(** This module seprate identity from data, it is a bit more verbsoe but slightly + more efficient due to the fact that there is no need to pack identity and data back + after each operation *) -module Dict = Bs_MapDict +module Dict = Belt_MapDict + +type ('key,'value,'identity) t +(** [('key, 'identity) t] -type ('k,'v,'id) t + ['key] is the element type + + ['identity] the identity of the collection +*) + + +type ('key, 'id ) id = ('key, 'id) Belt_Id.comparable +(** The identity needed for making an empty map*) -type ('key, 'id ) id = ('key, 'id) Bs_Id.comparable -(** The data associated with a comparison function *) (* How we retain soundness: The only way to create a value of type [_ t] from scratch - is through [empty] which requires [_ Bs_Id.t] - The only way to create [_ Bs_Id.t] is using [Bs_Id.Make] which + is through [empty] which requires [_ Belt_Id.t] + The only way to create [_ Belt_Id.t] is using [Belt_Id.Make] which will create a fresh type [id] per module Generic operations over tree without [cmp] are still exported (for efficient reasons) so that [data] does not need be boxed and unboxed. The soundness is guaranteed in two aspects: - When create a value of [_ t] it needs both [_ Bs_Id.t] and [_ t0]. - [_ Bs_Id.t] is an abstract type. Note [add0] requires [_ Bs_Id.cmp] which - is also an abstract type which can only come from [_ Bs_Id.t] + When create a value of [_ t] it needs both [_ Belt_Id.t] and [_ t0]. + [_ Belt_Id.t] is an abstract type. Note [add0] requires [_ Belt_Id.cmp] which + is also an abstract type which can only come from [_ Belt_Id.t] When destructing a value of [_ t], the ['id] parameter is threaded. *) -(* should not export [Bs_Id.compare]. - should only export [Bs_Id.t] or [Bs_Id.cmp] instead *) +(* should not export [Belt_Id.compare]. + should only export [Belt_Id.t] or [Belt_Id.cmp] instead *) + + +val make: id:('k, 'id) id -> ('k, 'a, 'id) t +(** [make ~id] + + @example {[ + module IntCmp = (val IntCmp.comparable ~cmp:(fun (x:int) y -> Pervasives.comapre x y)) + let s = make ~id:(module IntCmp) + ]} + +*) + -val make: id:('k, 'id) id -> ('k, 'a, 'id) t val isEmpty: _ t -> bool val has: ('k, 'a, 'id) t -> 'k -> bool @@ -141,7 +214,7 @@ val set: in [m], its previous binding disappears. *) val updateU: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option [@bs]) -> ('k, 'a, 'id) t val update: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option) -> ('k, 'a, 'id) t -val merge: +val mergeMany: ('k, 'a, 'id) t -> ('k * 'a) array -> ('k, 'a, 'id) t val mergeU: @@ -159,10 +232,6 @@ val merge: value, is determined with the function [f]. *) -val mergeMany: - ('a, 'b, 'id) t -> - ('a * 'b) array -> - ('a, 'b, 'id) t val keepU: ('k, 'a, 'id) t -> @@ -214,7 +283,7 @@ val mapWithKey: ('k, 'a, 'id) t -> ('k -> 'a -> 'b) -> ('k, 'b, 'id) t val getId: ('a, 'b, 'c) t -> ('a, 'c) id -val getData: ('a, 'b, 'c) t -> ('a, 'b, 'c) Bs_MapDict.t +val getData: ('a, 'b, 'c) t -> ('a, 'b, 'c) Belt_MapDict.t -val packIdData: id:('a, 'b) id -> data:('a, 'c, 'b) Bs_MapDict.t -> ('a, 'c, 'b) t +val packIdData: id:('a, 'b) id -> data:('a, 'c, 'b) Belt_MapDict.t -> ('a, 'c, 'b) t diff --git a/jscomp/others/bs_MapDict.ml b/jscomp/others/belt_MapDict.ml similarity index 96% rename from jscomp/others/bs_MapDict.ml rename to jscomp/others/belt_MapDict.ml index e5a21c7634..8a239ff48c 100644 --- a/jscomp/others/bs_MapDict.ml +++ b/jscomp/others/belt_MapDict.ml @@ -22,12 +22,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array type ('key, 'a, 'id) t = ('key, 'a) N.t -type ('key, 'id) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) cmp = ('key, 'id) Belt_Id.cmp let empty = N.empty let ofArray = N.ofArray @@ -81,7 +81,7 @@ let rec set (t : _ t) newK newD ~cmp = | None -> N.singleton newK newD | Some n -> let k= N.key n in - let c = (Bs_Id.getCmpInternal cmp) newK k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) newK k [@bs] in if c = 0 then N.return (N.updateValue n newD) else @@ -100,7 +100,7 @@ let rec updateU (t : _ t) newK f ~cmp : _ t = end | Some n -> let k= N.key n in - let c = (Bs_Id.getCmpInternal cmp) newK k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) newK k [@bs] in if c = 0 then match f (Some (N.value n)) [@bs] with | None -> @@ -148,7 +148,7 @@ let update t newK f ~cmp = let rec removeAux0 n x ~cmp = let l,v,r = N.(left n, key n, right n ) in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then match N.toOpt l, N.toOpt r with | None, _ -> r @@ -189,7 +189,7 @@ let mergeMany h arr ~cmp = let rec splitAuxPivot n x pres ~cmp = let l,v,d,r = N.(left n , key n, value n, right n) in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then begin pres := Some d; (l, r) diff --git a/jscomp/others/bs_MapDict.mli b/jscomp/others/belt_MapDict.mli similarity index 99% rename from jscomp/others/bs_MapDict.mli rename to jscomp/others/belt_MapDict.mli index 863c6a09ef..5fdd64cd42 100644 --- a/jscomp/others/bs_MapDict.mli +++ b/jscomp/others/belt_MapDict.mli @@ -24,7 +24,7 @@ type ('key, 'value, 'id) t -type ('key, 'id) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) cmp = ('key, 'id) Belt_Id.cmp val empty: ('k, 'v, 'id) t diff --git a/jscomp/others/bs_MapInt.ml b/jscomp/others/belt_MapInt.ml similarity index 97% rename from jscomp/others/bs_MapInt.ml rename to jscomp/others/belt_MapInt.ml index d3fbcaff12..585cd2b479 100644 --- a/jscomp/others/bs_MapInt.ml +++ b/jscomp/others/belt_MapInt.ml @@ -1,10 +1,10 @@ # 5 "map.cppo.ml" type key = int -module I = Bs_internalMapInt +module I = Belt_internalMapInt # 11 -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array type 'a t = (key, 'a) N.t diff --git a/jscomp/others/bs_MapInt.mli b/jscomp/others/belt_MapInt.mli similarity index 100% rename from jscomp/others/bs_MapInt.mli rename to jscomp/others/belt_MapInt.mli diff --git a/jscomp/others/bs_MapString.ml b/jscomp/others/belt_MapString.ml similarity index 97% rename from jscomp/others/bs_MapString.ml rename to jscomp/others/belt_MapString.ml index aca5b99805..5ec9786c3e 100644 --- a/jscomp/others/bs_MapString.ml +++ b/jscomp/others/belt_MapString.ml @@ -1,10 +1,10 @@ # 2 "map.cppo.ml" type key = string -module I = Bs_internalMapString +module I = Belt_internalMapString # 11 -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array type 'a t = (key, 'a) N.t diff --git a/jscomp/others/bs_MapString.mli b/jscomp/others/belt_MapString.mli similarity index 100% rename from jscomp/others/bs_MapString.mli rename to jscomp/others/belt_MapString.mli diff --git a/jscomp/others/bs_MutableMap.ml b/jscomp/others/belt_MutableMap.ml similarity index 91% rename from jscomp/others/bs_MutableMap.ml rename to jscomp/others/belt_MutableMap.ml index 8e9bf3685e..2a802a557b 100644 --- a/jscomp/others/bs_MutableMap.ml +++ b/jscomp/others/belt_MutableMap.ml @@ -23,15 +23,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_MutableMapInt -module String = Bs_MutableMapString +module Int = Belt_MutableMapInt +module String = Belt_MutableMapString -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array -type ('key, 'id) dict = ('key, 'id) Bs_Id.comparable -type ('key, 'id ) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) id = ('key, 'id) Belt_Id.comparable +type ('key, 'id ) cmp = ('key, 'id) Belt_Id.cmp module S = struct type ('k, 'v, 'id) t = { @@ -44,7 +44,7 @@ type ('k, 'v, 'id) t = ('k, 'v, 'id) S.t let rec removeMutateAux nt x ~cmp = let k = N.key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then let l,r = N.(left nt, right nt) in match N.(toOpt l, toOpt r) with @@ -108,7 +108,7 @@ let rec updateDone t x f ~cmp = | None -> t) | Some nt -> let k = N.key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then begin match f (Some (N.value nt)) [@bs] with | None -> @@ -142,8 +142,8 @@ let updateU t x f = S.dataSet t newRoot let update t x f = updateU t x (fun [@bs] a -> f a) -let make (type elt) (type id) ~(dict : (elt,id) dict) = - let module M = (val dict) in +let make (type elt) (type identity) ~(id : (elt,identity) id) = + let module M = (val id) in S.t ~cmp:M.cmp ~data:N.empty let clear m = S.dataSet m N.empty @@ -180,8 +180,8 @@ let keysToArray d = let valuesToArray d = N.valuesToArray (S.data d) -let ofSortedArrayUnsafe (type elt) (type id) ~(dict : (elt,id) dict) xs : _ t = - let module M = (val dict) in +let ofSortedArrayUnsafe (type elt) (type identity) ~(id : (elt,identity) id) xs : _ t = + let module M = (val id) in S.t ~data:(N.ofSortedArrayUnsafe xs) ~cmp:M.cmp let checkInvariantInternal d = @@ -216,8 +216,8 @@ let getExn m x = let has m x = N.has ~cmp:(S.cmp m) (S.data m) x -let ofArray (type k) (type id) data ~(dict : (k,id) dict)= - let module M = (val dict ) in +let ofArray (type k) (type identity) data ~(id : (k,identity) id)= + let module M = (val id ) in let cmp = M.cmp in S.t ~cmp ~data:(N.ofArray ~cmp data) diff --git a/jscomp/others/bs_MutableMap.mli b/jscomp/others/belt_MutableMap.mli similarity index 76% rename from jscomp/others/bs_MutableMap.mli rename to jscomp/others/belt_MutableMap.mli index 97b024449d..514d1d7282 100644 --- a/jscomp/others/bs_MutableMap.mli +++ b/jscomp/others/belt_MutableMap.mli @@ -23,15 +23,67 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_MutableMapInt +(** A {b mutable} sorted map module which allows customize {i compare} behavior. + + The implementation uses balanced binary trees, and therefore searching + and insertion take time logarithmic in the size of the map. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i Sets of ints} initialized with different + {i compare} functions will have different type. + + For example: + {[ + type t = int * int + module I0 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match Pervasives.compare a0 b0 with + | 0 -> Pervasives.compare a1 b1 + | c -> c + )) + let s0 : (_, string,_) t = make ~id:(module I0) + module I1 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match compare a1 b1 with + | 0 -> compare a0 b0 + | c -> c + )) + let s1 : (_, string, _) t = make ~id:(module I1) + ]} + + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : ((int * int), string, I0.identity) t + val s1 : ((int * int), string, I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let () = + add s1 (0,0) "a"; + add s1 (1,1) "b" + ]} + + Since this is an mutable data strucure, [s1] will contain two pairs. -module String = Bs_MutableMapString +*) + + + +module Int = Belt_MutableMapInt + +module String = Belt_MutableMapString type ('k,'v,'id) t -type ('key, 'id) dict = ('key, 'id) Bs_Id.comparable +type ('key, 'id) id = ('key, 'id) Belt_Id.comparable -val make: dict:('k, 'id) dict -> ('k, 'a, 'id) t +val make: id:('k, 'id) id -> ('k, 'a, 'id) t val clear: _ t -> unit val isEmpty: _ t -> bool val has: ('k, _, _) t -> 'k -> bool @@ -88,7 +140,7 @@ val size: ('k, 'a, 'id) t -> int val toList: ('k, 'a, 'id) t -> ('k * 'a) list (** In increasing order*) val toArray: ('k, 'a, 'id) t -> ('k * 'a) array -val ofArray: ('k * 'a) array -> dict:('k,'id) dict -> ('k,'a,'id) t +val ofArray: ('k * 'a) array -> id:('k,'id) id -> ('k,'a,'id) t val keysToArray: ('k, _, _) t -> 'k array val valuesToArray: (_, 'a, _) t -> 'a array val minKey: ('k, _, _) t -> 'k option diff --git a/jscomp/others/bs_MutableMapInt.ml b/jscomp/others/belt_MutableMapInt.ml similarity index 96% rename from jscomp/others/bs_MutableMapInt.ml rename to jscomp/others/belt_MutableMapInt.ml index 7d02254ae3..6f84a3825d 100644 --- a/jscomp/others/bs_MutableMapInt.ml +++ b/jscomp/others/belt_MutableMapInt.ml @@ -1,9 +1,9 @@ # 2 "mapm.cppo.ml" -module I = Bs_internalMapInt +module I = Belt_internalMapInt type key = int # 10 -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array @@ -98,7 +98,7 @@ let rec updateDone t (x : key) f = | None -> t) | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if k = x then begin match f (Some (N.value nt)) [@bs] with | None -> diff --git a/jscomp/others/bs_MutableMapInt.mli b/jscomp/others/belt_MutableMapInt.mli similarity index 100% rename from jscomp/others/bs_MutableMapInt.mli rename to jscomp/others/belt_MutableMapInt.mli diff --git a/jscomp/others/bs_MutableMapString.ml b/jscomp/others/belt_MutableMapString.ml similarity index 96% rename from jscomp/others/bs_MutableMapString.ml rename to jscomp/others/belt_MutableMapString.ml index 8f60d43970..3e87d34d25 100644 --- a/jscomp/others/bs_MutableMapString.ml +++ b/jscomp/others/belt_MutableMapString.ml @@ -1,9 +1,9 @@ # 5 "mapm.cppo.ml" -module I = Bs_internalMapString +module I = Belt_internalMapString type key = string # 10 -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array @@ -98,7 +98,7 @@ let rec updateDone t (x : key) f = | None -> t) | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if k = x then begin match f (Some (N.value nt)) [@bs] with | None -> diff --git a/jscomp/others/bs_MutableMapString.mli b/jscomp/others/belt_MutableMapString.mli similarity index 100% rename from jscomp/others/bs_MutableMapString.mli rename to jscomp/others/belt_MutableMapString.mli diff --git a/jscomp/others/bs_MutableQueue.ml b/jscomp/others/belt_MutableQueue.ml similarity index 98% rename from jscomp/others/bs_MutableQueue.ml rename to jscomp/others/belt_MutableQueue.ml index 52d60166e3..fcdd542fe5 100644 --- a/jscomp/others/bs_MutableQueue.ml +++ b/jscomp/others/belt_MutableQueue.ml @@ -14,7 +14,7 @@ (* *) (**************************************************************************) (* Adapted significantly by BuckleScript Authors *) -module A = Bs_Array +module A = Belt_Array type 'a node = { content: 'a; @@ -71,7 +71,7 @@ let peekUndefined q = let peekExn q = match Js.nullToOption (first q ) with - | None -> [%assert "Bs.Queue.Empty"] + | None -> [%assert "Belt.Queue.Empty"] | Some v -> content v let pop q = @@ -92,7 +92,7 @@ let pop q = let popExn q = match Js.nullToOption (first q ) with - | None -> [%assert "Bs.Queue.Empty"] + | None -> [%assert "Empty"] | Some x -> let next = next x in if Js.Null.test next then diff --git a/jscomp/others/bs_MutableQueue.mli b/jscomp/others/belt_MutableQueue.mli similarity index 100% rename from jscomp/others/bs_MutableQueue.mli rename to jscomp/others/belt_MutableQueue.mli diff --git a/jscomp/others/bs_MutableSet.ml b/jscomp/others/belt_MutableSet.ml similarity index 90% rename from jscomp/others/bs_MutableSet.ml rename to jscomp/others/belt_MutableSet.ml index 3a8956e565..57c61c56b1 100644 --- a/jscomp/others/bs_MutableSet.ml +++ b/jscomp/others/belt_MutableSet.ml @@ -23,16 +23,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_MutableSetInt -module String = Bs_MutableSetString +module Int = Belt_MutableSetInt +module String = Belt_MutableSetString -module N = Bs_internalAVLset -module A = Bs_Array -module Sort = Bs_SortArray +module N = Belt_internalAVLset +module A = Belt_Array +module Sort = Belt_SortArray -type ('k, 'id) dict = ('k, 'id) Bs_Id.comparable -type ('key, 'id ) cmp = ('key, 'id) Bs_Id.cmp +type ('k, 'id) id = ('k, 'id) Belt_Id.comparable +type ('key, 'id ) cmp = ('key, 'id) Belt_Id.cmp module S = struct type ('elt,'id) t = @@ -77,7 +77,7 @@ let remove d v = match N.toOpt oldRoot with | None -> () | Some oldRoot2 -> - let newRoot = remove0 ~cmp:(Bs_Id.getCmpInternal (S.cmp d)) oldRoot2 v in + let newRoot = remove0 ~cmp:(Belt_Id.getCmpInternal (S.cmp d)) oldRoot2 v in if newRoot != oldRoot then S.dataSet d newRoot @@ -99,12 +99,12 @@ let removeMany d xs = let len = A.length xs in S.dataSet d (removeMany0 nt xs 0 len - ~cmp:(Bs_Id.getCmpInternal (S.cmp d))) + ~cmp:(Belt_Id.getCmpInternal (S.cmp d))) let rec removeCheck0 nt x removed ~cmp= let k = N.key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then let () = removed := true in let l,r = N.(left nt, right nt) in @@ -167,7 +167,7 @@ let rec addCheck0 t x added ~cmp = let addCheck m e = let oldRoot = S.data m in let added = ref false in - let newRoot = addCheck0 ~cmp:(Bs_Id.getCmpInternal (S.cmp m)) oldRoot e added in + let newRoot = addCheck0 ~cmp:(Belt_Id.getCmpInternal (S.cmp m)) oldRoot e added in if newRoot != oldRoot then S.dataSet m newRoot; !added @@ -189,8 +189,8 @@ let mergeMany d xs = S.dataSet d (addArrayMutate (S.data d) xs ~cmp:(S.cmp d)) -let make (type elt) (type id) ~(dict : (elt, id) dict) = - let module M = (val dict) in +let make (type elt) (type identity) ~(id : (elt, identity) id) = + let module M = (val id) in S.t ~cmp:M.cmp ~data:N.empty let isEmpty d = @@ -220,16 +220,16 @@ let toList d = let toArray d = N.toArray (S.data d) -let ofSortedArrayUnsafe (type elt) (type id) xs ~(dict : (elt,id) dict) : _ t = - let module M = (val dict) in +let ofSortedArrayUnsafe (type elt) (type identity) xs ~(id : (elt,identity) id) : _ t = + let module M = (val id) in S.t ~data:(N.ofSortedArrayUnsafe xs) ~cmp:M.cmp let checkInvariantInternal d = N.checkInvariantInternal (S.data d) -let ofArray (type elt) (type id) data ~(dict : (elt,id) dict) = - let module M = (val dict) in +let ofArray (type elt) (type identity) data ~(id : (elt,identity) id) = + let module M = (val id) in let cmp = M.cmp in S.t ~cmp ~data:(N.ofArray ~cmp data) @@ -253,7 +253,7 @@ let getExn d x = let split d key = let arr = N.toArray (S.data d) in let cmp = S.cmp d in - let i = Sort.binarySearchByU arr key (Bs_Id.getCmpInternal cmp) in + let i = Sort.binarySearchByU arr key (Belt_Id.getCmpInternal cmp) in let len = A.length arr in if i < 0 then let next = - i -1 in @@ -301,7 +301,7 @@ let intersect a b : _ t = let tmp = A.makeUninitializedUnsafe totalSize in ignore @@ N.fillArray dataa0 0 tmp ; ignore @@ N.fillArray datab0 sizea tmp; - let p = Bs_Id.getCmpInternal cmp in + let p = Belt_Id.getCmpInternal cmp in if (p (A.getUnsafe tmp (sizea - 1)) (A.getUnsafe tmp sizea) [@bs] < 0) || @@ -330,7 +330,7 @@ let diff a b : _ t = let tmp = A.makeUninitializedUnsafe totalSize in ignore @@ N.fillArray dataa0 0 tmp ; ignore @@ N.fillArray datab0 sizea tmp; - let p = Bs_Id.getCmpInternal cmp in + let p = Belt_Id.getCmpInternal cmp in if (p (A.getUnsafe tmp (sizea - 1)) (A.getUnsafe tmp sizea) [@bs] < 0) || @@ -357,7 +357,7 @@ let union a b = let tmp = A.makeUninitializedUnsafe totalSize in ignore @@ N.fillArray dataa0 0 tmp ; ignore @@ N.fillArray datab0 sizea tmp ; - let p = (Bs_Id.getCmpInternal cmp) in + let p = (Belt_Id.getCmpInternal cmp) in if p (A.getUnsafe tmp (sizea - 1)) (A.getUnsafe tmp sizea) [@bs] < 0 then diff --git a/jscomp/others/bs_MutableSet.mli b/jscomp/others/belt_MutableSet.mli similarity index 72% rename from jscomp/others/bs_MutableSet.mli rename to jscomp/others/belt_MutableSet.mli index 37602f555c..6a2f27f99a 100644 --- a/jscomp/others/bs_MutableSet.mli +++ b/jscomp/others/belt_MutableSet.mli @@ -23,23 +23,74 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** specalized when key type is [int], more efficient +(** A {i mutable} sorted set module which allows customize {i compare} behavior. + + The implementation uses balanced binary trees, and therefore searching + and insertion take time logarithmic in the size of the map. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i Sets of ints} initialized with different + {i compare} functions will have different type. + + For example: + {[ + type t = int * int + module I0 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match Pervasives.compare a0 b0 with + | 0 -> Pervasives.compare a1 b1 + | c -> c + )) + let s0 = make ~id:(module I0) + module I1 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match compare a1 b1 with + | 0 -> compare a0 b0 + | c -> c + )) + let s1 = make ~id:(module I1) + ]} + + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : ((int * int), I0.identity) t + val s1 : ((int * int), I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let () = + add s1 (0,0); + add s1 (1,1) + ]} + + Since this is an mutable data strucure, [s1] will contain two pairs. + +*) + + +(** Specalized when key type is [int], more efficient than the gerneic type *) -module Int = Bs_MutableSetInt +module Int = Belt_MutableSetInt -(** specalized when key type is [string], more efficient +(** Specalized when key type is [string], more efficient than the gerneic type *) -module String = Bs_MutableSetString +module String = Belt_MutableSetString type ('k,'id) t -type ('k, 'id) dict = ('k, 'id) Bs_Id.comparable +type ('k, 'id) id = ('k, 'id) Belt_Id.comparable -val make: dict:('elt, 'id) dict -> ('elt, 'id) t +val make: id:('elt, 'id) id -> ('elt, 'id) t -val ofArray: 'k array -> dict:('k, 'id) dict -> ('k, 'id) t -val ofSortedArrayUnsafe: 'elt array -> dict:('elt, 'id) dict -> ('elt,'id) t +val ofArray: 'k array -> id:('k, 'id) id -> ('k, 'id) t +val ofSortedArrayUnsafe: 'elt array -> id:('elt, 'id) id -> ('elt,'id) t val copy: ('k, 'id) t -> ('k, 'id) t val isEmpty: _ t -> bool val has: ('elt, _) t -> 'elt -> bool @@ -133,7 +184,7 @@ val checkInvariantInternal: _ t -> bool (* [add0] was not exposed for various reasons: 1. such api is dangerious - [ cmp: ('elt,'id) Bs_Cmp.cmp -> + [ cmp: ('elt,'id) Belt_Cmp.cmp -> ('elt, 'id) t0 -> 'elt -> ('elt, 'id) t0] 2. It is not really significantly more *) diff --git a/jscomp/others/bs_MutableSetInt.ml b/jscomp/others/belt_MutableSetInt.ml similarity index 81% rename from jscomp/others/bs_MutableSetInt.ml rename to jscomp/others/belt_MutableSetInt.ml index 7beead5da8..adbb46bbab 100644 --- a/jscomp/others/bs_MutableSetInt.ml +++ b/jscomp/others/belt_MutableSetInt.ml @@ -1,17 +1,48 @@ -# 2 "setm.cppo.ml" -module I = Bs_internalSetInt -module S = Bs_SortArrayInt -# 10 -module N = Bs_internalAVLset -module A = Bs_Array +# 1 "setm.cppo.ml" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) +*) + +# 31 +module I = Belt_internalSetInt +module S = Belt_SortArrayInt +# 39 +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt - +(** The type of the set elements. *) + type t = { mutable data : I.t } [@@bs.deriving abstract] - +(** The type of sets. *) let rec remove0 nt (x : elt)= diff --git a/jscomp/others/belt_MutableSetInt.mli b/jscomp/others/belt_MutableSetInt.mli new file mode 100644 index 0000000000..5b1588eedd --- /dev/null +++ b/jscomp/others/belt_MutableSetInt.mli @@ -0,0 +1,119 @@ +# 1 "setm.cppo.mli" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + + +# 37 +type elt = int +# 41 +(** The type of the set elements. *) + + +type t +(** The type of sets. *) + +val make: unit -> t + +val ofArray: elt array -> t +val ofSortedArrayUnsafe: elt array -> t +val copy: t -> t +val isEmpty: t -> bool +val has: t -> elt -> bool + +val add: t -> elt -> unit +val addCheck: t -> elt -> bool +val mergeMany: t -> elt array -> unit +val remove: t -> elt -> unit +val removeCheck: t -> elt -> bool +val removeMany: t -> elt array -> unit + +val union: t -> t -> t +val intersect: t -> t -> t +val diff: t -> t -> t +val subset: t -> t -> bool + +val cmp: t -> t -> int +val eq: t -> t -> bool + + +val forEachU: t -> (elt -> unit [@bs]) -> unit +val forEach: t -> (elt -> unit ) -> unit +(** In increasing order*) + +val reduceU: t -> 'a -> ('a -> elt -> 'a [@bs]) -> 'a +val reduce: t -> 'a -> ('a -> elt -> 'a ) -> 'a +(** Iterate in increasing order. *) + +val everyU: t -> (elt -> bool [@bs]) -> bool +val every: t -> (elt -> bool) -> bool +(** [every p s] checks if all elements of the set + satisfy the predicate [p]. Order unspecified. *) + +val someU: t -> (elt -> bool [@bs]) -> bool +val some: t -> (elt -> bool) -> bool +(** [some p s] checks if at least one element of + the set satisfies the predicate [p]. Oder unspecified. *) + +val keepU: t -> (elt -> bool [@bs]) -> t +val keep: t -> (elt -> bool) -> t +(** [keep s p] returns a fresh copy of the set of all elements in [s] + that satisfy predicate [p]. *) + +val partitionU: t -> (elt -> bool [@bs]) -> t * t +val partition: t -> (elt -> bool) -> t * t +(** [partition s p] returns a fresh copy pair of sets [(s1, s2)], where + [s1] is the set of all the elements of [s] that satisfy the + predicate [p], and [s2] is the set of all the elements of + [s] that do not satisfy [p]. *) + +val size: t -> int +val toList: t -> elt list + (** In increasing order with respect *) +val toArray: t -> elt array + + +val minimum: t -> elt option +val minUndefined: t -> elt Js.undefined +val maximum: t -> elt option +val maxUndefined: t -> elt Js.undefined + +val get: t -> elt -> elt option +val getUndefined: t -> elt -> elt Js.undefined +val getExn: t -> elt -> elt +val split: t -> elt -> (t * t) * bool +(** + [split s key] return a fresh copy of each +*) + +val checkInvariantInternal: t -> bool + + diff --git a/jscomp/others/bs_MutableSetString.ml b/jscomp/others/belt_MutableSetString.ml similarity index 81% rename from jscomp/others/bs_MutableSetString.ml rename to jscomp/others/belt_MutableSetString.ml index bec2914ba5..fcfb26c2cf 100644 --- a/jscomp/others/bs_MutableSetString.ml +++ b/jscomp/others/belt_MutableSetString.ml @@ -1,17 +1,48 @@ -# 5 "setm.cppo.ml" -module I = Bs_internalSetString -module S = Bs_SortArrayString -# 10 -module N = Bs_internalAVLset -module A = Bs_Array +# 1 "setm.cppo.ml" +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) +*) + +# 34 +module I = Belt_internalSetString +module S = Belt_SortArrayString +# 39 +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt - +(** The type of the set elements. *) + type t = { mutable data : I.t } [@@bs.deriving abstract] - +(** The type of sets. *) let rec remove0 nt (x : elt)= diff --git a/jscomp/others/bs_MutableSetString.mli b/jscomp/others/belt_MutableSetString.mli similarity index 90% rename from jscomp/others/bs_MutableSetString.mli rename to jscomp/others/belt_MutableSetString.mli index 9f643aa61a..aec855c89a 100644 --- a/jscomp/others/bs_MutableSetString.mli +++ b/jscomp/others/belt_MutableSetString.mli @@ -23,11 +23,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -# 26 +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + + +# 35 type elt = string +# 41 +(** The type of the set elements. *) + -# 33 type t +(** The type of sets. *) + val make: unit -> t val ofArray: elt array -> t diff --git a/jscomp/others/bs_MutableStack.ml b/jscomp/others/belt_MutableStack.ml similarity index 100% rename from jscomp/others/bs_MutableStack.ml rename to jscomp/others/belt_MutableStack.ml diff --git a/jscomp/others/bs_MutableStack.mli b/jscomp/others/belt_MutableStack.mli similarity index 100% rename from jscomp/others/bs_MutableStack.mli rename to jscomp/others/belt_MutableStack.mli diff --git a/jscomp/others/bs_Range.ml b/jscomp/others/belt_Range.ml similarity index 100% rename from jscomp/others/bs_Range.ml rename to jscomp/others/belt_Range.ml diff --git a/jscomp/others/bs_Range.mli b/jscomp/others/belt_Range.mli similarity index 84% rename from jscomp/others/bs_Range.mli rename to jscomp/others/belt_Range.mli index 80a8d1fa72..1a4b49ffc3 100644 --- a/jscomp/others/bs_Range.mli +++ b/jscomp/others/belt_Range.mli @@ -31,37 +31,37 @@ val forEachU: int -> int -> (int -> unit [@bs]) -> unit val forEach: int -> int -> (int -> unit ) -> unit (** [forEach start finish action] - equivalent to [Bs.Array.(forEach (range start finish) action)] + equivalent to [Belt.Array.(forEach (range start finish) action)] *) val everyU: int -> int -> (int -> bool [@bs]) -> bool val every: int -> int -> (int -> bool ) -> bool (** [every start finish p] - equivalent to [Bs.Array.(every (range start finish) p )] + equivalent to [Belt.Array.(every (range start finish) p )] *) val everyByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool val everyBy: int -> int -> step:int -> (int -> bool ) -> bool (** [everyBy start finish ~step p] - {b See} {!Bs_Array.rangeBy} + {b See} {!Belt_Array.rangeBy} - equivalent to [Bs.Array.(every (rangeBy start finish ~step) p)] + equivalent to [Belt.Array.(every (rangeBy start finish ~step) p)] *) val someU: int -> int -> (int -> bool [@bs]) -> bool val some: int -> int -> (int -> bool ) -> bool (** [some start finish p] - equivalent to [Bs.Array.(some (range start finish) p)] + equivalent to [Belt.Array.(some (range start finish) p)] *) val someByU: int -> int -> step:int -> (int -> bool [@bs]) -> bool val someBy: int -> int -> step:int -> (int -> bool ) -> bool (** [someBy start finish ~step p] - {b See} {!Bs_Array.rangeBy} + {b See} {!Belt_Array.rangeBy} - equivalent to [Bs.Array.(some (rangeBy start finish ~step) p)] + equivalent to [Belt.Array.(some (rangeBy start finish ~step) p)] *) diff --git a/jscomp/others/bs_Set.ml b/jscomp/others/belt_Set.ml similarity index 87% rename from jscomp/others/bs_Set.ml rename to jscomp/others/belt_Set.ml index df61f53b6a..52b6712aa5 100644 --- a/jscomp/others/bs_Set.ml +++ b/jscomp/others/belt_Set.ml @@ -22,15 +22,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_SetInt -module String = Bs_SetString -module Dict = Bs_SetDict +module Int = Belt_SetInt +module String = Belt_SetString +module Dict = Belt_SetDict -module A = Bs_Array +module A = Belt_Array -type ('key, 'id) dict = ('key, 'id) Bs_Id.comparable -type ('key, 'id ) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) id = ('key, 'id) Belt_Id.comparable +type ('key, 'id ) cmp = ('key, 'id) Belt_Id.cmp module S = struct type ('k,'id) t = { @@ -41,8 +41,8 @@ end type ('k, 'id) t = ('k, 'id) S.t -let ofArray (type elt) (type id) data ~(dict : (elt,id) dict) = - let module M = (val dict ) in +let ofArray (type elt) (type identity) data ~(id : (elt,identity) id) = + let module M = (val id ) in let cmp = M.cmp in S.t ~cmp ~data:(Dict.ofArray ~cmp data) @@ -88,8 +88,8 @@ let split m e = let (l, r), b = Dict.split ~cmp (S.data m) e in (S.t ~cmp ~data:l, S.t ~cmp ~data:r), b -let make (type elt) (type id) ~(dict : (elt, id) dict) = - let module M = (val dict) in +let make (type elt) (type identity) ~(id : (elt, identity) id) = + let module M = (val id) in S.t ~cmp:M.cmp ~data:Dict.empty let isEmpty m = Dict.isEmpty (S.data m) @@ -145,8 +145,8 @@ let getExn m e = let has m e = Dict.has ~cmp:(S.cmp m) (S.data m) e -let ofSortedArrayUnsafe (type elt) (type id) xs ~(dict : (elt,id) dict ) = - let module M = (val dict) in +let ofSortedArrayUnsafe (type elt) (type identity) xs ~(id : (elt,identity) id ) = + let module M = (val id) in S.t ~cmp:M.cmp ~data:(Dict.ofSortedArrayUnsafe xs) @@ -154,7 +154,7 @@ let ofSortedArrayUnsafe (type elt) (type id) xs ~(dict : (elt,id) dict ) = let getData = S.data -let getDict (type elt) (type identity) (m : (elt,identity) t) : (elt, identity) dict = +let getDict (type elt) (type identity) (m : (elt,identity) t) : (elt, identity) id = let module T = struct type nonrec identity = identity type nonrec t = elt @@ -162,8 +162,8 @@ let getDict (type elt) (type identity) (m : (elt,identity) t) : (elt, identity) end in (module T) -let packDictData (type elt) (type id) ~(dict : (elt, id) dict) ~data = - let module M = (val dict) in +let packDictData (type elt) (type identity) ~(id : (elt, identity) id) ~data = + let module M = (val id) in S.t ~cmp:M.cmp ~data let checkInvariantInternal d = Dict.checkInvariantInternal (S.data d) diff --git a/jscomp/others/bs_Set.mli b/jscomp/others/belt_Set.mli similarity index 58% rename from jscomp/others/bs_Set.mli rename to jscomp/others/belt_Set.mli index ace6d6bca8..7ee9f0f431 100644 --- a/jscomp/others/bs_Set.mli +++ b/jscomp/others/belt_Set.mli @@ -22,30 +22,110 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** specalized when key type is [int], more efficient - than the gerneic type +(** A {i immutable} sorted set module which allows customize {i compare} behavior. + + The implementation uses balanced binary trees, and therefore searching + and insertion take time logarithmic in the size of the map. + + All data are parameterized by not its only type but also a unique identity in + the time of initialization, so that two {i Sets of ints} initialized with different + {i compare} functions will have different type. + + For example: + {[ + type t = int * int + module I0 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match Pervasives.compare a0 b0 with + | 0 -> Pervasives.compare a1 b1 + | c -> c + )) + let s0 = make ~id:(module I0) + module I1 = + (val Belt.Id.comparableU ~cmp:(fun[\@bs] ((a0,a1) : t) ((b0,b1) : t) -> + match compare a1 b1 with + | 0 -> compare a0 b0 + | c -> c + )) + let s1 = make ~id:(module I1) + ]} + + + Here the compiler would infer [s0] and [s1] having different type so that + it would not mix. + + {[ + val s0 : ((int * int), I0.identity) t + val s1 : ((int * int), I1.identity) t + ]} + + We can add elements to the collection: + + {[ + + let s2 = add s1 (0,0) + let s3 = add s2 (1,1) + ]} + + Since this is an immutable data strucure, [s1] will be an empty set + while [s2] will contain one element, [s3] will contain two. + + The [union s0 s3] will result in a type error, since their identity mismatch *) -module Int = Bs_SetInt -(** specalized when key type is [string], more efficient - than the gerneic type *) -module String = Bs_SetString +(** Specalized when key type is [int], more efficient + than the gerneic type, its compare behavior is fixed using the built-in comparison +*) +module Int = Belt_SetInt -(** seprate function from data, a more verbsoe but slightly - more efficient +(** Specalized when key type is [string], more efficient + than the gerneic type, its compare behavior is fixed using the built-in comparison *) -module Dict = Bs_SetDict +module String = Belt_SetString -type ('k,'id) t -type ('key, 'id) dict = ('key, 'id) Bs_Id.comparable - -val make: dict:('elt, 'id) dict -> ('elt, 'id) t +(** This module seprate identity from data, it is a bit more verbsoe but slightly + more efficient due to the fact that there is no need to pack identity and data back + after each operation +*) +module Dict = Belt_SetDict + + +type ('key,'identity) t +(** [('key, 'identity) t] + + ['key] is the element type + + ['identity] the identity of the collection +*) + + +type ('key, 'id) id = ('key, 'id) Belt_Id.comparable +(** The identity needed for making an empty set +*) + +val make: id:('elt, 'id) id -> ('elt, 'id) t +(** [make ~id] + + @example {[ + module IntCmp = (val IntCmp.comparable ~cmp:(fun (x:int) y -> Pervasives.comapre x y)) + let s = make ~id:(module IntCmp) + ]} + +*) + + +val ofArray: 'k array -> id:('k, 'id) id -> ('k, 'id) t + +val ofSortedArrayUnsafe: 'elt array -> id:('elt, 'id) id -> ('elt,'id) t +(** [ofSortedArrayUnsafe xs ~id] + + The same as {!ofArray} except it is after assuming the array is already sorted + + {b unsafe} assuming the input is sorted +*) -val ofArray: 'k array -> dict:('k, 'id) dict -> ('k, 'id) t -val ofSortedArrayUnsafe: 'elt array -> dict:('elt, 'id) dict -> ('elt,'id) t - val isEmpty: _ t -> bool val has: ('elt, 'id) t -> 'elt -> bool @@ -53,6 +133,7 @@ val has: ('elt, 'id) t -> 'elt -> bool val add: ('elt, 'id) t -> 'elt -> ('elt, 'id) t (** [add s x] If [x] was already in [s], [s] is returned unchanged. *) + val mergeMany: ('elt, 'id) t -> 'elt array -> ('elt, 'id) t val remove: ('elt, 'id) t -> 'elt -> ('elt, 'id) t @@ -70,6 +151,7 @@ val subset: ('elt, 'id) t -> ('elt, 'id) t -> bool val cmp: ('elt, 'id) t -> ('elt, 'id) t -> int (** Total ordering between sets. Can be used as the ordering function for doing sets of sets. *) + val eq: ('elt, 'id) t -> ('elt, 'id) t -> bool val forEachU: ('elt, 'id) t -> ('elt -> unit [@bs]) -> unit @@ -120,7 +202,11 @@ val getUndefined: ('elt, 'id) t -> 'elt -> 'elt Js.undefined val getExn: ('elt, 'id) t -> 'elt -> 'elt val split: ('elt, 'id) t -> 'elt -> (('elt, 'id) t * ('elt, 'id) t) * bool - +(** [split set ele] + + @return a tuple [((smaller, larger), present)], + [present] is true when [ele] exist in [set] +*) val checkInvariantInternal: _ t -> bool (****************************************************************************) @@ -129,7 +215,7 @@ val checkInvariantInternal: _ t -> bool More API will be exposed by needs *) -val getData: ('k,'id) t -> ('k,'id) Bs_SetDict.t -val getDict: ('k,'id) t -> ('k,'id) dict -val packDictData: dict:('k, 'id) dict -> data:('k, 'id) Bs_SetDict.t -> ('k, 'id) t +val getData: ('k,'id) t -> ('k,'id) Belt_SetDict.t +val getDict: ('k,'id) t -> ('k,'id) id +val packDictData: id:('k, 'id) id -> data:('k, 'id) Belt_SetDict.t -> ('k, 'id) t diff --git a/jscomp/others/bs_SetDict.ml b/jscomp/others/belt_SetDict.ml similarity index 95% rename from jscomp/others/bs_SetDict.ml rename to jscomp/others/belt_SetDict.ml index 86ac201678..f6792b5ef9 100644 --- a/jscomp/others/bs_SetDict.ml +++ b/jscomp/others/belt_SetDict.ml @@ -22,12 +22,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type ('k,'id) t = 'k N.t -type ('key, 'id) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) cmp = ('key, 'id) Belt_Id.cmp (* here we relies on reference transparence @@ -39,7 +39,7 @@ let rec add (t : _ t) x ~cmp : _ t = | None -> N.singleton x | Some nt -> let k = N.key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then t else let l,r = N.(left nt, right nt) in @@ -57,7 +57,7 @@ let rec remove (t : _ t) x ~cmp : _ t = None -> t | Some n -> let l,v,r = N.(left n , key n, right n) in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then match N.toOpt l, N.toOpt r with | (None, _) -> r @@ -96,7 +96,7 @@ let removeMany h arr ~cmp = let rec splitAuxNoPivot ~cmp (n : _ N.node) x : _ * _ = let l,v,r = N.(left n , key n, right n) in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then l,r else if c < 0 then @@ -116,7 +116,7 @@ let rec splitAuxNoPivot ~cmp (n : _ N.node) x : _ * _ = let rec splitAuxPivot ~cmp (n : _ N.node) x pres : _ * _ = let l,v,r = N.(left n , key n, right n) in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then begin pres := true; diff --git a/jscomp/others/bs_SetDict.mli b/jscomp/others/belt_SetDict.mli similarity index 99% rename from jscomp/others/bs_SetDict.mli rename to jscomp/others/belt_SetDict.mli index d5c9504633..439b610eda 100644 --- a/jscomp/others/bs_SetDict.mli +++ b/jscomp/others/belt_SetDict.mli @@ -24,7 +24,7 @@ type ('key, 'id) t -type ('key, 'id) cmp = ('key, 'id) Bs_Id.cmp +type ('key, 'id) cmp = ('key, 'id) Belt_Id.cmp val empty: ('elt, 'id) t diff --git a/jscomp/others/bs_SetInt.ml b/jscomp/others/belt_SetInt.ml similarity index 98% rename from jscomp/others/bs_SetInt.ml rename to jscomp/others/belt_SetInt.ml index ffd756e508..80c3edf09d 100644 --- a/jscomp/others/bs_SetInt.ml +++ b/jscomp/others/belt_SetInt.ml @@ -1,8 +1,8 @@ # 2 "set.cppo.ml" -module I = Bs_internalSetInt +module I = Belt_internalSetInt # 8 -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt type t = I.t diff --git a/jscomp/others/bs_SetInt.mli b/jscomp/others/belt_SetInt.mli similarity index 93% rename from jscomp/others/bs_SetInt.mli rename to jscomp/others/belt_SetInt.mli index 837173d43d..8ec2ddd443 100644 --- a/jscomp/others/bs_SetInt.mli +++ b/jscomp/others/belt_SetInt.mli @@ -23,9 +23,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -# 28 +(** This module is {!Belt.Set} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_Set} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + +# 35 type elt = int -# 32 +# 39 (** The type of the set elements. *) diff --git a/jscomp/others/bs_SetString.ml b/jscomp/others/belt_SetString.ml similarity index 98% rename from jscomp/others/bs_SetString.ml rename to jscomp/others/belt_SetString.ml index a3282ff2e7..e6fbee9838 100644 --- a/jscomp/others/bs_SetString.ml +++ b/jscomp/others/belt_SetString.ml @@ -1,8 +1,8 @@ # 4 "set.cppo.ml" -module I = Bs_internalSetString +module I = Belt_internalSetString # 8 -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt type t = I.t diff --git a/jscomp/others/bs_SetString.mli b/jscomp/others/belt_SetString.mli similarity index 93% rename from jscomp/others/bs_SetString.mli rename to jscomp/others/belt_SetString.mli index 487f91c9a1..2ac3eb3f2f 100644 --- a/jscomp/others/bs_SetString.mli +++ b/jscomp/others/belt_SetString.mli @@ -23,9 +23,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -# 26 +(** This module is {!Belt.Set} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_Set} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + +# 33 type elt = string -# 32 +# 39 (** The type of the set elements. *) diff --git a/jscomp/others/bs_SortArray.ml b/jscomp/others/belt_SortArray.ml similarity index 98% rename from jscomp/others/bs_SortArray.ml rename to jscomp/others/belt_SortArray.ml index 6bdf601758..d441a43087 100644 --- a/jscomp/others/bs_SortArray.ml +++ b/jscomp/others/belt_SortArray.ml @@ -24,11 +24,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module Int = Bs_SortArrayInt +module Int = Belt_SortArrayInt -module String = Bs_SortArrayString +module String = Belt_SortArrayString -module A = Bs_Array +module A = Belt_Array let rec sortedLengthAuxMore xs prec acc len lt = if acc >= len then acc @@ -269,7 +269,7 @@ let stableSortInPlaceByU a cmp = else begin let l1 = l / 2 in let l2 = l - l1 in - let t = Bs_Array.makeUninitializedUnsafe l2 in + let t = Belt_Array.makeUninitializedUnsafe l2 in sortTo a l1 t 0 l2 cmp; sortTo a 0 a l2 l1 cmp; merge a l2 l1 t 0 l2 a 0 cmp; diff --git a/jscomp/others/bs_SortArray.mli b/jscomp/others/belt_SortArray.mli similarity index 98% rename from jscomp/others/bs_SortArray.mli rename to jscomp/others/belt_SortArray.mli index 9e96ede547..41e0f212e0 100644 --- a/jscomp/others/bs_SortArray.mli +++ b/jscomp/others/belt_SortArray.mli @@ -25,11 +25,11 @@ (** A module for Array sort relevant utiliites *) -module Int = Bs_SortArrayInt +module Int = Belt_SortArrayInt (** Specalized when key type is [int], more efficient than the gerneic type *) -module String = Bs_SortArrayString +module String = Belt_SortArrayString (** Specalized when key type is [string], more efficient than the gerneic type *) diff --git a/jscomp/others/bs_SortArrayInt.ml b/jscomp/others/belt_SortArrayInt.ml similarity index 98% rename from jscomp/others/bs_SortArrayInt.ml rename to jscomp/others/belt_SortArrayInt.ml index 05ddac1e9c..c2fe530ae1 100644 --- a/jscomp/others/bs_SortArrayInt.ml +++ b/jscomp/others/belt_SortArrayInt.ml @@ -2,7 +2,7 @@ type element = int # 9 -module A = Bs_Array +module A = Belt_Array let rec sortedLengthAuxMore (xs : element array) prec acc len = if acc >= len then acc @@ -224,7 +224,7 @@ let stableSortInPlace (a : element array) = else begin let l1 = l / 2 in let l2 = l - l1 in - let t = Bs_Array.makeUninitializedUnsafe l2 in + let t = Belt_Array.makeUninitializedUnsafe l2 in sortTo a l1 t 0 l2 ; sortTo a 0 a l2 l1 ; merge a l2 l1 t 0 l2 a 0 ; diff --git a/jscomp/others/bs_SortArrayInt.mli b/jscomp/others/belt_SortArrayInt.mli similarity index 89% rename from jscomp/others/bs_SortArrayInt.mli rename to jscomp/others/belt_SortArrayInt.mli index 11bf3a5f37..cba854f4b0 100644 --- a/jscomp/others/bs_SortArrayInt.mli +++ b/jscomp/others/belt_SortArrayInt.mli @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** This is a specialized module for {!Bs_SortArray}, the docs in that module also +(** This is a specialized module for {!Belt_SortArray}, the docs in that module also applies here, except the comparator is fixed and inlined *) @@ -35,7 +35,7 @@ type element = int # 39 val strictlySortedLength: element array -> int (** - The same as {!Bs_SortArray.strictlySortedLength } except the comparator is fixed + The same as {!Belt_SortArray.strictlySortedLength } except the comparator is fixed @return [+n] means increasing order [-n] means negative order *) @@ -45,11 +45,11 @@ val isSorted: element array -> bool val stableSortInPlace: element array -> unit (** - The same as {!Bs_SortArray.stableSortInPlaceBy} except the comparator is fixed + The same as {!Belt_SortArray.stableSortInPlaceBy} except the comparator is fixed *) val stableSort: element array -> element array -(** The same as {!Bs_SortArray.stableSortBy} except the comparator is fixed *) +(** The same as {!Belt_SortArray.stableSortBy} except the comparator is fixed *) val binarySearch: element array -> element -> int (** diff --git a/jscomp/others/bs_SortArrayString.ml b/jscomp/others/belt_SortArrayString.ml similarity index 98% rename from jscomp/others/bs_SortArrayString.ml rename to jscomp/others/belt_SortArrayString.ml index d9117b2865..3c184ff57c 100644 --- a/jscomp/others/bs_SortArrayString.ml +++ b/jscomp/others/belt_SortArrayString.ml @@ -2,7 +2,7 @@ type element = string # 9 -module A = Bs_Array +module A = Belt_Array let rec sortedLengthAuxMore (xs : element array) prec acc len = if acc >= len then acc @@ -224,7 +224,7 @@ let stableSortInPlace (a : element array) = else begin let l1 = l / 2 in let l2 = l - l1 in - let t = Bs_Array.makeUninitializedUnsafe l2 in + let t = Belt_Array.makeUninitializedUnsafe l2 in sortTo a l1 t 0 l2 ; sortTo a 0 a l2 l1 ; merge a l2 l1 t 0 l2 a 0 ; diff --git a/jscomp/others/bs_SortArrayString.mli b/jscomp/others/belt_SortArrayString.mli similarity index 89% rename from jscomp/others/bs_SortArrayString.mli rename to jscomp/others/belt_SortArrayString.mli index 276f52f2af..a5d156166c 100644 --- a/jscomp/others/bs_SortArrayString.mli +++ b/jscomp/others/belt_SortArrayString.mli @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** This is a specialized module for {!Bs_SortArray}, the docs in that module also +(** This is a specialized module for {!Belt_SortArray}, the docs in that module also applies here, except the comparator is fixed and inlined *) @@ -35,7 +35,7 @@ type element = string # 39 val strictlySortedLength: element array -> int (** - The same as {!Bs_SortArray.strictlySortedLength } except the comparator is fixed + The same as {!Belt_SortArray.strictlySortedLength } except the comparator is fixed @return [+n] means increasing order [-n] means negative order *) @@ -45,11 +45,11 @@ val isSorted: element array -> bool val stableSortInPlace: element array -> unit (** - The same as {!Bs_SortArray.stableSortInPlaceBy} except the comparator is fixed + The same as {!Belt_SortArray.stableSortInPlaceBy} except the comparator is fixed *) val stableSort: element array -> element array -(** The same as {!Bs_SortArray.stableSortBy} except the comparator is fixed *) +(** The same as {!Belt_SortArray.stableSortBy} except the comparator is fixed *) val binarySearch: element array -> element -> int (** diff --git a/jscomp/others/bs_internalAVLset.ml b/jscomp/others/belt_internalAVLset.ml similarity index 96% rename from jscomp/others/bs_internalAVLset.ml rename to jscomp/others/belt_internalAVLset.ml index 882fa74735..d36d3f309d 100644 --- a/jscomp/others/bs_internalAVLset.ml +++ b/jscomp/others/belt_internalAVLset.ml @@ -33,15 +33,15 @@ type 'elt node = { and 'elt t = 'elt node Js.null [@@bs.deriving abstract] -module A = Bs_Array -module S = Bs_SortArray +module A = Belt_Array +module S = Belt_SortArray external toOpt : 'a Js.null -> 'a option = "#null_to_opt" external return : 'a -> 'a Js.null = "%identity" external empty : 'a Js.null = "#null" external unsafeCoerce : 'a Js.null -> 'a = "%identity" -type ('a, 'b) cmp = ('a, 'b) Bs_Id.cmp +type ('a, 'b) cmp = ('a, 'b) Belt_Id.cmp (* Sets are represented by balanced binary trees (the heights of the children differ by at most 2 *) @@ -474,14 +474,14 @@ let rec has (t: _ t) x ~cmp = | None -> false | Some n -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in c = 0 || has ~cmp (if c < 0 then left n else right n) x let rec compareAux e1 e2 ~cmp = match e1,e2 with | h1::t1, h2::t2 -> - let c = (Bs_Id.getCmpInternal cmp) (key h1) (key h2) [@bs] in + let c = (Belt_Id.getCmpInternal cmp) (key h1) (key h2) [@bs] in if c = 0 then compareAux ~cmp (stackAllLeft (right h1) t1) @@ -507,7 +507,7 @@ let rec subset (s1 : _ t) (s2 : _ t) ~cmp = | Some t1 , Some t2 -> let l1,v1,r1 = (left t1, key t1, right t1) in let l2,v2,r2 = (left t2, key t2, right t2) in - let c = (Bs_Id.getCmpInternal cmp) v1 v2 [@bs] in + let c = (Belt_Id.getCmpInternal cmp) v1 v2 [@bs] in if c = 0 then subset ~cmp l1 l2 && subset ~cmp r1 r2 else if c < 0 then @@ -522,7 +522,7 @@ let rec get (n : _ t) x ~cmp = None -> None | Some t (* Node(l, v, r, _) *) -> let v = key t in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then Some v else get ~cmp (if c < 0 then left t else right t) x @@ -532,7 +532,7 @@ let rec getUndefined (n : _ t) x ~cmp = None -> Js.Undefined.empty | Some t (* Node(l, v, r, _) *) -> let v = key t in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then Js.Undefined.return v else getUndefined ~cmp (if c < 0 then left t else right t) x @@ -541,7 +541,7 @@ let rec getExn (n : _ t) x ~cmp = None -> [%assert "getExn0"] | Some t (* Node(l, v, r, _) *) -> let v = key t in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then v else getExn ~cmp (if c < 0 then left t else right t) x @@ -621,7 +621,7 @@ let rec addMutate ~cmp (t : _ t) x = | None -> singleton x | Some nt -> let k = key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then t else let l, r = (left nt, right nt) in @@ -639,7 +639,7 @@ let ofArray (xs : _ array) ~cmp = if len = 0 then empty else let next = ref (S.strictlySortedLengthU xs - (fun [@bs] x y -> (Bs_Id.getCmpInternal cmp) x y [@bs] < 0)) in + (fun [@bs] x y -> (Belt_Id.getCmpInternal cmp) x y [@bs] < 0)) in let result = ref (if !next >= 0 then ofSortedArrayAux xs 0 !next diff --git a/jscomp/others/bs_internalAVLset.mli b/jscomp/others/belt_internalAVLset.mli similarity index 99% rename from jscomp/others/bs_internalAVLset.mli rename to jscomp/others/belt_internalAVLset.mli index a24f591586..509229adea 100644 --- a/jscomp/others/bs_internalAVLset.mli +++ b/jscomp/others/belt_internalAVLset.mli @@ -37,7 +37,7 @@ and 'elt node = private { h : int } [@@bs.deriving abstract] -type ('a, 'b) cmp = ('a, 'b) Bs_Id.cmp +type ('a, 'b) cmp = ('a, 'b) Belt_Id.cmp (* TODO: node is used in [subset] *) external toOpt : 'a Js.null -> 'a option = "#null_to_opt" external return : 'a -> 'a Js.null = "%identity" diff --git a/jscomp/others/bs_internalAVLtree.ml b/jscomp/others/belt_internalAVLtree.ml similarity index 97% rename from jscomp/others/bs_internalAVLtree.ml rename to jscomp/others/belt_internalAVLtree.ml index 22343c2a97..b0d59a530e 100644 --- a/jscomp/others/bs_internalAVLtree.ml +++ b/jscomp/others/belt_internalAVLtree.ml @@ -23,10 +23,10 @@ type ('k, 'v) node = { and ('key, 'a) t = ('key, 'a) node Js.null [@@bs.deriving abstract] -type ('k, 'id) cmp = ('k, 'id) Bs_Id.cmp +type ('k, 'id) cmp = ('k, 'id) Belt_Id.cmp -module A = Bs_Array -module S = Bs_SortArray +module A = Belt_Array +module S = Belt_SortArray external toOpt : 'a Js.null -> 'a option = "#null_to_opt" external return : 'a -> 'a Js.null = "%identity" external empty : 'a Js.null = "#null" @@ -538,7 +538,7 @@ let ofSortedArrayUnsafe arr = let rec compareAux e1 e2 ~kcmp ~vcmp = match e1,e2 with | h1::t1, h2::t2 -> - let c = (Bs_Id.getCmpInternal kcmp) (key h1) (key h2) [@bs] in + let c = (Belt_Id.getCmpInternal kcmp) (key h1) (key h2) [@bs] in if c = 0 then let cx = vcmp (value h1) (value h2) [@bs] in if cx = 0 then @@ -552,7 +552,7 @@ let rec compareAux e1 e2 ~kcmp ~vcmp = let rec eqAux e1 e2 ~kcmp ~veq = match e1,e2 with | h1::t1, h2::t2 -> - if (Bs_Id.getCmpInternal kcmp) (key h1) (key h2) [@bs] = 0 && + if (Belt_Id.getCmpInternal kcmp) (key h1) (key h2) [@bs] = 0 && veq (value h1) (value h2) [@bs] then eqAux ~kcmp ~veq ( stackAllLeft (right h1) t1 ) (stackAllLeft (right h2) t2) @@ -582,7 +582,7 @@ let rec get n x ~cmp = None -> None | Some n (* Node(l, v, d, r, _) *) -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then Some (value n) else get ~cmp (if c < 0 then left n else right n) x @@ -591,7 +591,7 @@ let rec getUndefined n x ~cmp = | None -> Js.undefined | Some n -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then Js.Undefined.return (value n ) else getUndefined ~cmp (if c < 0 then left n else right n) x @@ -601,7 +601,7 @@ let rec getExn n x ~cmp = [%assert "getExn0"] | Some n (* Node(l, v, d, r, _)*) -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then value n else getExn ~cmp (if c < 0 then left n else right n) x @@ -611,7 +611,7 @@ let rec getWithDefault n x def ~cmp = def | Some n (* Node(l, v, d, r, _)*) -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in if c = 0 then value n else getWithDefault ~cmp (if c < 0 then left n else right n) x def @@ -621,7 +621,7 @@ let rec has n x ~cmp = false | Some n (* Node(l, v, d, r, _) *) -> let v = key n in - let c = (Bs_Id.getCmpInternal cmp) x v [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x v [@bs] in c = 0 || has ~cmp (if c < 0 then left n else right n) x @@ -700,7 +700,7 @@ let rec updateMutate (t : _ t) x data ~cmp = | None -> singleton x data | Some nt -> let k = key nt in - let c = (Bs_Id.getCmpInternal cmp) x k [@bs] in + let c = (Belt_Id.getCmpInternal cmp) x k [@bs] in if c = 0 then begin valueSet nt data; return nt @@ -722,7 +722,7 @@ let ofArray (xs : _ array) ~cmp = let next = ref (S.strictlySortedLengthU xs (fun[@bs] (x0,_) (y0,_) -> - (Bs_Id.getCmpInternal cmp) x0 y0 [@bs] < 0 + (Belt_Id.getCmpInternal cmp) x0 y0 [@bs] < 0 )) in let result = ref ( diff --git a/jscomp/others/bs_internalAVLtree.mli b/jscomp/others/belt_internalAVLtree.mli similarity index 99% rename from jscomp/others/bs_internalAVLtree.mli rename to jscomp/others/belt_internalAVLtree.mli index 5a22a53729..28f51ef5c6 100644 --- a/jscomp/others/bs_internalAVLtree.mli +++ b/jscomp/others/belt_internalAVLtree.mli @@ -39,7 +39,7 @@ external toOpt : 'a Js.null -> 'a option = "#null_to_opt" external return : 'a -> 'a Js.null = "%identity" external empty : 'a Js.null = "#null" -type ('k, 'id) cmp = ('k, 'id) Bs_Id.cmp +type ('k, 'id) cmp = ('k, 'id) Belt_Id.cmp val copy : ('k, 'v) t -> ('k, 'v) t val create : diff --git a/jscomp/others/bs_internalBuckets.ml b/jscomp/others/belt_internalBuckets.ml similarity index 99% rename from jscomp/others/bs_internalBuckets.ml rename to jscomp/others/belt_internalBuckets.ml index 2f647c751f..bfa6f7d1bd 100644 --- a/jscomp/others/bs_internalBuckets.ml +++ b/jscomp/others/belt_internalBuckets.ml @@ -18,7 +18,7 @@ (* We do dynamic hashing, and resize the table and rehash the elements when buckets become too long. *) -module C = Bs_internalBucketsType +module C = Belt_internalBucketsType (* TODO: the current implementation relies on the fact that bucket empty value is [undefined] in both places, @@ -33,7 +33,7 @@ type ('a,'b) bucket = { and ('hash, 'eq, 'a, 'b) t = ('hash, 'eq, ('a,'b) bucket) C.container [@@bs.deriving abstract] -module A = Bs_Array +module A = Belt_Array let rec copy ( x : _ t) : _ t= diff --git a/jscomp/others/bs_internalBuckets.mli b/jscomp/others/belt_internalBuckets.mli similarity index 98% rename from jscomp/others/bs_internalBuckets.mli rename to jscomp/others/belt_internalBuckets.mli index 4d025f89fd..9276cd9f78 100644 --- a/jscomp/others/bs_internalBuckets.mli +++ b/jscomp/others/belt_internalBuckets.mli @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module C = Bs_internalBucketsType +module C = Belt_internalBucketsType type ('a,'b) bucket = { mutable key : 'a; diff --git a/jscomp/others/bs_internalBucketsType.ml b/jscomp/others/belt_internalBucketsType.ml similarity index 94% rename from jscomp/others/bs_internalBucketsType.ml rename to jscomp/others/belt_internalBucketsType.ml index 6267f81d0c..a50003489a 100644 --- a/jscomp/others/bs_internalBucketsType.ml +++ b/jscomp/others/belt_internalBucketsType.ml @@ -31,7 +31,7 @@ type ('hash, 'eq, 'c) container = } [@@bs.deriving abstract] -module A = Bs_Array +module A = Belt_Array external toOpt : 'a opt -> 'a option = "#undefined_to_opt" external return : 'a -> 'a opt = "%identity" @@ -41,8 +41,8 @@ let rec power_2_above x n = else if x * 2 < x then x (* overflow *) else power_2_above (x * 2) n -let make ~hash ~eq initialSize = - let s = power_2_above 16 initialSize in +let make ~hash ~eq ~hintSize = + let s = power_2_above 16 hintSize in container ~size:0 ~buckets:(A.makeUninitialized s) @@ -57,4 +57,4 @@ let clear h = A.setUnsafe h_buckets i emptyOpt done -let isEmpty h = size h = 0 \ No newline at end of file +let isEmpty h = size h = 0 diff --git a/jscomp/others/bs_internalBucketsType.mli b/jscomp/others/belt_internalBucketsType.mli similarity index 99% rename from jscomp/others/bs_internalBucketsType.mli rename to jscomp/others/belt_internalBucketsType.mli index 3f3774a199..46322e4a57 100644 --- a/jscomp/others/bs_internalBucketsType.mli +++ b/jscomp/others/belt_internalBucketsType.mli @@ -38,7 +38,7 @@ val emptyOpt : 'a Js.undefined val make : hash:'hash -> eq:'eq -> - int -> + hintSize:int -> ('hash, 'eq, _) container val clear : _ container -> unit diff --git a/jscomp/others/bs_internalMapInt.ml b/jscomp/others/belt_internalMapInt.ml similarity index 97% rename from jscomp/others/bs_internalMapInt.ml rename to jscomp/others/belt_internalMapInt.ml index 1fed86fe34..db73c78902 100644 --- a/jscomp/others/bs_internalMapInt.ml +++ b/jscomp/others/belt_internalMapInt.ml @@ -2,9 +2,9 @@ type key = int # 9 -module N = Bs_internalAVLtree -module A = Bs_Array -module S = Bs_SortArray +module N = Belt_internalAVLtree +module A = Belt_Array +module S = Belt_SortArray @@ -179,7 +179,7 @@ let rec addMutate (t : _ t) x data : _ t = | None -> N.singleton x data | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if x = k then begin N.keySet nt x; N.valueSet nt data; diff --git a/jscomp/others/bs_internalMapString.ml b/jscomp/others/belt_internalMapString.ml similarity index 97% rename from jscomp/others/bs_internalMapString.ml rename to jscomp/others/belt_internalMapString.ml index a44265de49..85171528bc 100644 --- a/jscomp/others/bs_internalMapString.ml +++ b/jscomp/others/belt_internalMapString.ml @@ -2,9 +2,9 @@ type key = string # 9 -module N = Bs_internalAVLtree -module A = Bs_Array -module S = Bs_SortArray +module N = Belt_internalAVLtree +module A = Belt_Array +module S = Belt_SortArray @@ -179,7 +179,7 @@ let rec addMutate (t : _ t) x data : _ t = | None -> N.singleton x data | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if x = k then begin N.keySet nt x; N.valueSet nt data; diff --git a/jscomp/others/bs_internalMutableAVLMap.ml b/jscomp/others/belt_internalMutableAVLMap.ml similarity index 100% rename from jscomp/others/bs_internalMutableAVLMap.ml rename to jscomp/others/belt_internalMutableAVLMap.ml diff --git a/jscomp/others/bs_internalSetBuckets.ml b/jscomp/others/belt_internalSetBuckets.ml similarity index 97% rename from jscomp/others/bs_internalSetBuckets.ml rename to jscomp/others/belt_internalSetBuckets.ml index 31e1ee4116..44ddf51d70 100644 --- a/jscomp/others/bs_internalSetBuckets.ml +++ b/jscomp/others/belt_internalSetBuckets.ml @@ -24,7 +24,7 @@ (* We do dynamic hashing, and resize the table and rehash the elements when buckets become too long. *) -module C = Bs_internalBucketsType +module C = Belt_internalBucketsType (* TODO: the current implementation relies on the fact that bucket empty value is [undefined] in both places, @@ -38,7 +38,7 @@ type 'a bucket = { and ('hash, 'eq, 'a) t = ('hash, 'eq, 'a bucket) C.container [@@bs.deriving abstract] -module A = Bs_Array +module A = Belt_Array let rec copy ( x : _ t) : _ t= C.container @@ -102,7 +102,7 @@ let rec fillArray i arr cell = let toArray h = let d = C.buckets h in let current = ref 0 in - let arr = Bs.Array.makeUninitializedUnsafe (C.size h) in + let arr = A.makeUninitializedUnsafe (C.size h) in for i = 0 to A.length d - 1 do let cell = A.getUnsafe d i in match C.toOpt cell with diff --git a/jscomp/others/bs_internalSetBuckets.mli b/jscomp/others/belt_internalSetBuckets.mli similarity index 98% rename from jscomp/others/bs_internalSetBuckets.mli rename to jscomp/others/belt_internalSetBuckets.mli index 082f46c4ea..aabea01ec0 100644 --- a/jscomp/others/bs_internalSetBuckets.mli +++ b/jscomp/others/belt_internalSetBuckets.mli @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -module C = Bs_internalBucketsType +module C = Belt_internalBucketsType type 'a bucket = { mutable key : 'a; diff --git a/jscomp/others/bs_internalSetInt.ml b/jscomp/others/belt_internalSetInt.ml similarity index 97% rename from jscomp/others/bs_internalSetInt.ml rename to jscomp/others/belt_internalSetInt.ml index 237fa548af..b34265f0a9 100644 --- a/jscomp/others/bs_internalSetInt.ml +++ b/jscomp/others/belt_internalSetInt.ml @@ -1,11 +1,11 @@ # 5 "internal_set.cppo.ml" type elt = int -module S = Bs_SortArrayInt +module S = Belt_SortArrayInt # 12 -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type t = elt N.t diff --git a/jscomp/others/bs_internalSetString.ml b/jscomp/others/belt_internalSetString.ml similarity index 97% rename from jscomp/others/bs_internalSetString.ml rename to jscomp/others/belt_internalSetString.ml index 89bea5efeb..dbf6a91ff9 100644 --- a/jscomp/others/bs_internalSetString.ml +++ b/jscomp/others/belt_internalSetString.ml @@ -1,11 +1,11 @@ # 2 "internal_set.cppo.ml" type elt = string -module S = Bs_SortArrayString +module S = Belt_SortArrayString # 12 -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type t = elt N.t diff --git a/jscomp/others/bs_HashSetInt.mli b/jscomp/others/bs_HashSetInt.mli deleted file mode 100644 index 3ce72a9fa7..0000000000 --- a/jscomp/others/bs_HashSetInt.mli +++ /dev/null @@ -1,37 +0,0 @@ -# 4 "hashset.cppo.mli" -type key = int - - -# 10 -type t -val make: int -> t - -val clear: t -> unit - -val isEmpty: t -> bool - -val add: t -> key -> unit - -val copy: t -> t - -val has: t -> key -> bool - -val remove: t -> key -> unit - -val forEachU: t -> (key -> unit [@bs]) -> unit -val forEach: t -> (key -> unit) -> unit - -val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c -val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c - -val size: t -> int - -val logStats: t -> unit - -val toArray: t -> key array - -val ofArray: key array -> t - -val mergeMany: t -> key array -> unit - -val getBucketHistogram: t -> int array diff --git a/jscomp/others/bs_HashSetString.mli b/jscomp/others/bs_HashSetString.mli deleted file mode 100644 index 68a94d5f69..0000000000 --- a/jscomp/others/bs_HashSetString.mli +++ /dev/null @@ -1,37 +0,0 @@ -# 2 "hashset.cppo.mli" -type key = string - - -# 10 -type t -val make: int -> t - -val clear: t -> unit - -val isEmpty: t -> bool - -val add: t -> key -> unit - -val copy: t -> t - -val has: t -> key -> bool - -val remove: t -> key -> unit - -val forEachU: t -> (key -> unit [@bs]) -> unit -val forEach: t -> (key -> unit) -> unit - -val reduceU: t -> 'c -> ( 'c -> key -> 'c [@bs]) -> 'c -val reduce: t -> 'c -> ( 'c -> key -> 'c) -> 'c - -val size: t -> int - -val logStats: t -> unit - -val toArray: t -> key array - -val ofArray: key array -> t - -val mergeMany: t -> key array -> unit - -val getBucketHistogram: t -> int array diff --git a/jscomp/others/hashmap.cppo.ml b/jscomp/others/hashmap.cppo.ml index 4b50e554d3..28a6c69d78 100644 --- a/jscomp/others/hashmap.cppo.ml +++ b/jscomp/others/hashmap.cppo.ml @@ -30,9 +30,9 @@ let hash (s : key) = [%error "unknown type"] #endif -module N = Bs_internalBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type 'b t = (unit, unit, key,'b) N.t @@ -178,7 +178,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size let forEachU = N.forEachU diff --git a/jscomp/others/hashmap.cppo.mli b/jscomp/others/hashmap.cppo.mli index 6469014911..57a023d1da 100644 --- a/jscomp/others/hashmap.cppo.mli +++ b/jscomp/others/hashmap.cppo.mli @@ -10,7 +10,7 @@ type key = int type 'b t -val make: int -> 'b t +val make: hintSize:int -> 'b t val clear: 'b t -> unit diff --git a/jscomp/others/hashset.cppo.ml b/jscomp/others/hashset.cppo.ml index 5d38ec847e..12d35ffa24 100644 --- a/jscomp/others/hashset.cppo.ml +++ b/jscomp/others/hashset.cppo.ml @@ -17,9 +17,9 @@ let hash (s : key) = [%error "unknown type"] #endif -module N = Bs_internalSetBuckets -module C = Bs_internalBucketsType -module A = Bs_Array +module N = Belt_internalSetBuckets +module C = Belt_internalBucketsType +module A = Belt_Array type t = (unit, unit, key) N.t @@ -134,7 +134,7 @@ let has h key = memInBucket key bucket -let make size = C.make size ~hash:() ~eq:() +let make ~hintSize = C.make ~hintSize ~hash:() ~eq:() let clear = C.clear let size = C.size @@ -150,7 +150,7 @@ let isEmpty = C.isEmpty let ofArray arr = let len = A.length arr in - let v = C.make len ~hash:() ~eq:() in + let v = C.make ~hintSize:len ~hash:() ~eq:() in for i = 0 to len - 1 do add v (A.getUnsafe arr i) done ; diff --git a/jscomp/others/hashset.cppo.mli b/jscomp/others/hashset.cppo.mli index 33e6ad7084..b737255e05 100644 --- a/jscomp/others/hashset.cppo.mli +++ b/jscomp/others/hashset.cppo.mli @@ -1,3 +1,37 @@ + +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.HashSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.HashSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.HashSet} +*) + + #ifdef TYPE_STRING type key = string #elif defined TYPE_INT @@ -8,7 +42,8 @@ type key = int type t -val make: int -> t + +val make: hintSize:int -> t val clear: t -> unit diff --git a/jscomp/others/internal_map.cppo.ml b/jscomp/others/internal_map.cppo.ml index c67762fecb..dfd8949a15 100644 --- a/jscomp/others/internal_map.cppo.ml +++ b/jscomp/others/internal_map.cppo.ml @@ -6,9 +6,9 @@ type key = int [%error "unknown type"] #endif -module N = Bs_internalAVLtree -module A = Bs_Array -module S = Bs_SortArray +module N = Belt_internalAVLtree +module A = Belt_Array +module S = Belt_SortArray @@ -183,7 +183,7 @@ let rec addMutate (t : _ t) x data : _ t = | None -> N.singleton x data | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if x = k then begin N.keySet nt x; N.valueSet nt data; diff --git a/jscomp/others/internal_set.cppo.ml b/jscomp/others/internal_set.cppo.ml index 00323d5343..a3d673029c 100644 --- a/jscomp/others/internal_set.cppo.ml +++ b/jscomp/others/internal_set.cppo.ml @@ -1,16 +1,16 @@ #ifdef TYPE_STRING type elt = string -module S = Bs_SortArrayString +module S = Belt_SortArrayString #elif defined TYPE_INT type elt = int -module S = Bs_SortArrayInt +module S = Belt_SortArrayInt #else [%error "unknown type"] #endif -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type t = elt N.t diff --git a/jscomp/others/intro.txt b/jscomp/others/intro.txt index 41ba942138..2998223443 100644 --- a/jscomp/others/intro.txt +++ b/jscomp/others/intro.txt @@ -17,9 +17,9 @@ For example |> Js.log ]} -{!Bs} +{!Belt} -This BuckleScript stdandard library. +This BuckleScript standard library ({b beta}). BuckleScript also shipped the vanilla OCaml standard library. @see OCaml standard library diff --git a/jscomp/others/js_option.ml b/jscomp/others/js_option.ml index 5baa29b2c7..7148a557a3 100644 --- a/jscomp/others/js_option.ml +++ b/jscomp/others/js_option.ml @@ -42,7 +42,7 @@ let isNone = function let getExn x = match x with - | None -> Js_exn.raiseError "Bs_option.getExn" + | None -> Js_exn.raiseError "getExn" | Some x -> x let equal eq a b = diff --git a/jscomp/others/map.cppo.ml b/jscomp/others/map.cppo.ml index d8a768e199..1e2451cdfc 100644 --- a/jscomp/others/map.cppo.ml +++ b/jscomp/others/map.cppo.ml @@ -1,15 +1,15 @@ #ifdef TYPE_STRING type key = string -module I = Bs_internalMapString +module I = Belt_internalMapString #elif defined TYPE_INT type key = int -module I = Bs_internalMapInt +module I = Belt_internalMapInt #else [%error "unknown type"] #endif -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array type 'a t = (key, 'a) N.t diff --git a/jscomp/others/mapm.cppo.ml b/jscomp/others/mapm.cppo.ml index e0b6723600..0a3d424e58 100644 --- a/jscomp/others/mapm.cppo.ml +++ b/jscomp/others/mapm.cppo.ml @@ -1,14 +1,14 @@ #ifdef TYPE_INT -module I = Bs_internalMapInt +module I = Belt_internalMapInt type key = int #elif defined TYPE_STRING -module I = Bs_internalMapString +module I = Belt_internalMapString type key = string #else [%error "unknown type"] #endif -module N = Bs_internalAVLtree -module A = Bs_Array +module N = Belt_internalAVLtree +module A = Belt_Array @@ -103,7 +103,7 @@ let rec updateDone t (x : key) f = | None -> t) | Some nt -> let k = N.key nt in - (* let c = (Bs_Cmp.getCmpInternal cmp) x k [@bs] in *) + (* let c = (Belt_Cmp.getCmpInternal cmp) x k [@bs] in *) if k = x then begin match f (Some (N.value nt)) [@bs] with | None -> diff --git a/jscomp/others/set.cppo.ml b/jscomp/others/set.cppo.ml index c16f6806a3..c4c417463c 100644 --- a/jscomp/others/set.cppo.ml +++ b/jscomp/others/set.cppo.ml @@ -1,12 +1,12 @@ #ifdef TYPE_INT -module I = Bs_internalSetInt +module I = Belt_internalSetInt #elif defined TYPE_STRING -module I = Bs_internalSetString +module I = Belt_internalSetString #else [%error "unknown type"] #endif -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt type t = I.t diff --git a/jscomp/others/set.cppo.mli b/jscomp/others/set.cppo.mli index 82a4578094..a3250669ae 100644 --- a/jscomp/others/set.cppo.mli +++ b/jscomp/others/set.cppo.mli @@ -22,13 +22,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +(** This module is {!Belt.Set} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_Set} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + #ifdef TYPE_STRING type elt = string #elif defined TYPE_INT type elt = int #else [%error "unknown type"] -#endif +#endif (** The type of the set elements. *) diff --git a/jscomp/others/setm.cppo.ml b/jscomp/others/setm.cppo.ml index bc804150b3..0fd93de734 100644 --- a/jscomp/others/setm.cppo.ml +++ b/jscomp/others/setm.cppo.ml @@ -1,22 +1,52 @@ +(* Copyright (C) 2017 Authors of BuckleScript + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * In addition to the permissions granted to you by the LGPL, you may combine + * or link a "work that uses the Library" with a publicly distributed version + * of this file to produce a combined library or application, then distribute + * that combined work under the terms of your choosing, with no requirement + * to comply with the obligations normally placed on you by section 4 of the + * LGPL version 3 (or the corresponding section of a later version of the LGPL + * should you choose to use a later version). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) + +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + It is more efficient in general, the API is the same with {!Belt_MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) +*) + #ifdef TYPE_INT -module I = Bs_internalSetInt -module S = Bs_SortArrayInt +module I = Belt_internalSetInt +module S = Belt_SortArrayInt #elif defined TYPE_STRING -module I = Bs_internalSetString -module S = Bs_SortArrayString +module I = Belt_internalSetString +module S = Belt_SortArrayString #else [%error "unknown type"] #endif -module N = Bs_internalAVLset -module A = Bs_Array +module N = Belt_internalAVLset +module A = Belt_Array type elt = I.elt - +(** The type of the set elements. *) + type t = { mutable data : I.t } [@@bs.deriving abstract] - +(** The type of sets. *) let rec remove0 nt (x : elt)= diff --git a/jscomp/others/setm.cppo.mli b/jscomp/others/setm.cppo.mli index 7ab5235b1f..dfab6c5167 100644 --- a/jscomp/others/setm.cppo.mli +++ b/jscomp/others/setm.cppo.mli @@ -22,6 +22,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) +(** This module is {!Belt.MutableSet} specialized with key type to be a primitive type. + + It is more efficient in general, the API is the same with {!Belt.MutableSet} except its key type is fixed, + and identity is not needed(using the built-in one) + + {b See} {!Belt.MutableSet} +*) + + #ifdef TYPE_STRING type elt = string #elif defined TYPE_INT @@ -29,8 +38,12 @@ type elt = int #else [%error "unknown type"] #endif +(** The type of the set elements. *) + type t +(** The type of sets. *) + val make: unit -> t val ofArray: elt array -> t diff --git a/jscomp/others/sort.cppo.ml b/jscomp/others/sort.cppo.ml index 5996910d3d..eaecbfb994 100644 --- a/jscomp/others/sort.cppo.ml +++ b/jscomp/others/sort.cppo.ml @@ -6,7 +6,7 @@ type element = string [%error "unknown type"] #endif -module A = Bs_Array +module A = Belt_Array let rec sortedLengthAuxMore (xs : element array) prec acc len = if acc >= len then acc @@ -228,7 +228,7 @@ let stableSortInPlace (a : element array) = else begin let l1 = l / 2 in let l2 = l - l1 in - let t = Bs_Array.makeUninitializedUnsafe l2 in + let t = Belt_Array.makeUninitializedUnsafe l2 in sortTo a l1 t 0 l2 ; sortTo a 0 a l2 l1 ; merge a l2 l1 t 0 l2 a 0 ; diff --git a/jscomp/others/sort.cppo.mli b/jscomp/others/sort.cppo.mli index 4ef544275c..187e07d722 100644 --- a/jscomp/others/sort.cppo.mli +++ b/jscomp/others/sort.cppo.mli @@ -24,7 +24,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -(** This is a specialized module for {!Bs_SortArray}, the docs in that module also +(** This is a specialized module for {!Belt_SortArray}, the docs in that module also applies here, except the comparator is fixed and inlined *) @@ -38,7 +38,7 @@ type element = string val strictlySortedLength: element array -> int (** - The same as {!Bs_SortArray.strictlySortedLength } except the comparator is fixed + The same as {!Belt_SortArray.strictlySortedLength } except the comparator is fixed @return [+n] means increasing order [-n] means negative order *) @@ -48,11 +48,11 @@ val isSorted: element array -> bool val stableSortInPlace: element array -> unit (** - The same as {!Bs_SortArray.stableSortInPlaceBy} except the comparator is fixed + The same as {!Belt_SortArray.stableSortInPlaceBy} except the comparator is fixed *) val stableSort: element array -> element array -(** The same as {!Bs_SortArray.stableSortBy} except the comparator is fixed *) +(** The same as {!Belt_SortArray.stableSortBy} except the comparator is fixed *) val binarySearch: element array -> element -> int (** diff --git a/jscomp/release.sh b/jscomp/release.sh index 223ea327c9..d4890d9420 100755 --- a/jscomp/release.sh +++ b/jscomp/release.sh @@ -1,5 +1,6 @@ #!/bin/sh set -e +rm ../lib/js/*.js git clean -dfx . ../lib make clean make themes diff --git a/jscomp/stdlib/camlinternalOO.ml b/jscomp/stdlib/camlinternalOO.ml index a41db22d53..1c387e1df4 100644 --- a/jscomp/stdlib/camlinternalOO.ml +++ b/jscomp/stdlib/camlinternalOO.ml @@ -87,7 +87,7 @@ let public_method_label s : tag = module Vars = #if BS then - Bs.Map.String + Belt.Map.String #else Map.Make(struct type t = string let compare (x:t) y = compare x y end) #end @@ -95,14 +95,14 @@ type vars = int Vars.t module Meths = #if BS then - Bs.Map.String + Belt.Map.String #else Map.Make(struct type t = string let compare (x:t) y = compare x y end) #end type meths = label Meths.t module Labs = #if BS then - Bs.Map.Int + Belt.Map.Int #else Map.Make(struct type t = label let compare (x:t) y = compare x y end) #end diff --git a/jscomp/test/.depend b/jscomp/test/.depend index 6699b98d0f..9443bc82ed 100644 --- a/jscomp/test/.depend +++ b/jscomp/test/.depend @@ -61,7 +61,7 @@ arith_parser.cmj : ../stdlib/parsing.cmj ../stdlib/obj.cmj \ ../stdlib/lexing.cmj arith_syntax.cmj arith_syntax.cmj : arity_deopt.cmj : mt.cmj -array_data_util.cmj : ../others/bs_Array.cmj +array_data_util.cmj : ../others/belt.cmj array_safe_get.cmj : ../stdlib/array.cmj array_subtle_test.cmj : mt.cmj ../runtime/js.cmj ../stdlib/array.cmj array_test.cmj : ../stdlib/pervasives.cmj mt.cmj ../stdlib/list.cmj \ @@ -86,46 +86,42 @@ big_polyvar_test.cmj : bigarray_test.cmj : ../stdlib/int32.cmj ../stdlib/complex.cmj \ ../stdlib/bigarray.cmj boolean_test.cmj : test_bool_equal.cmj mt.cmj -bs_MapInt_test.cmj : ../runtime/js.cmj ../others/bs.cmj +bs_MapInt_test.cmj : ../runtime/js.cmj ../others/belt.cmj bs_abstract_test.cmj : ../runtime/js.cmj bs_abstract_test.cmi -bs_array_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj +bs_array_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj bs_auto_uncurry.cmj : ../runtime/js.cmj bs_auto_uncurry_test.cmj : mt.cmj ../others/js_array.cmj ../runtime/js.cmj -bs_hashmap_test.cmj : mt.cmj ../stdlib/hashtbl.cmj ../others/bs.cmj \ +bs_hashmap_test.cmj : mt.cmj ../stdlib/hashtbl.cmj ../others/belt.cmj \ array_data_util.cmj -bs_hashset_int_test.cmj : mt.cmj ../others/bs_Array.cmj ../others/bs.cmj \ - array_data_util.cmj -bs_hashtbl_string_test.cmj : ../stdlib/hashtbl.cmj ../others/bs.cmj +bs_hashset_int_test.cmj : mt.cmj ../others/belt.cmj array_data_util.cmj +bs_hashtbl_string_test.cmj : ../stdlib/hashtbl.cmj ../others/belt.cmj bs_ignore_effect.cmj : mt.cmj bs_ignore_test.cmj : ../runtime/js.cmj -bs_list_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj -bs_map_set_dict_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs_Array.cmj \ - ../others/bs.cmj array_data_util.cmj -bs_map_test.cmj : mt.cmj ../others/bs.cmj +bs_list_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj +bs_map_set_dict_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj \ + array_data_util.cmj +bs_map_test.cmj : mt.cmj ../others/belt.cmj bs_min_max_test.cmj : ../stdlib/pervasives.cmj mt.cmj -bs_mutable_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj \ +bs_mutable_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj \ array_data_util.cmj ../stdlib/array.cmj bs_node_string_buffer_test.cmj : ../others/node.cmj ../runtime/js.cmj -bs_poly_map_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs_Array.cmj \ - ../others/bs.cmj array_data_util.cmj -bs_poly_mutable_map_test.cmj : mt.cmj ../others/bs_Array.cmj \ - ../others/bs.cmj array_data_util.cmj -bs_poly_mutable_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj \ +bs_poly_map_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj \ array_data_util.cmj -bs_poly_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj \ +bs_poly_mutable_map_test.cmj : mt.cmj ../others/belt.cmj array_data_util.cmj +bs_poly_mutable_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj \ + array_data_util.cmj +bs_poly_set_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj \ array_data_util.cmj bs_qualified.cmj : ../runtime/js.cmj -bs_queue_test.cmj : mt.cmj ../runtime/js.cmj ../others/bs.cmj +bs_queue_test.cmj : mt.cmj ../runtime/js.cmj ../others/belt.cmj bs_rbset_int_bench.cmj : rbset.cmj bs_rest_test.cmj : -bs_set_bench.cmj : ../others/bs.cmj +bs_set_bench.cmj : ../others/belt.cmj bs_set_int_test.cmj : mt.cmj ../stdlib/list.cmj ../runtime/js.cmj \ - ../others/bs_Array.cmj ../others/bs.cmj array_data_util.cmj \ - ../stdlib/array.cmj -bs_sort_test.cmj : mt.cmj ../others/bs_Range.cmj ../others/bs_Array.cmj \ - ../others/bs.cmj array_data_util.cmj + ../others/belt.cmj array_data_util.cmj ../stdlib/array.cmj +bs_sort_test.cmj : mt.cmj ../others/belt.cmj array_data_util.cmj bs_splice_partial.cmj : ../runtime/js.cmj -bs_stack_test.cmj : ../runtime/js.cmj ../others/bs.cmj +bs_stack_test.cmj : ../runtime/js.cmj ../others/belt.cmj bs_string_test.cmj : mt.cmj ../runtime/js.cmj bs_unwrap_test.cmj : ../runtime/js.cmj buffer_test.cmj : ../stdlib/string.cmj mt.cmj ../stdlib/bytes.cmj \ @@ -305,7 +301,7 @@ gpr_1946_test.cmj : ../stdlib/obj.cmj ../runtime/js.cmj gpr_2250_test.cmj : mt.cmj gpr_2316_test.cmj : mt.cmj ../runtime/js.cmj gpr_2474.cmj : -gpr_2487.cmj : ../others/bs.cmj +gpr_2487.cmj : ../others/belt.cmj gpr_405_test.cmj : ../stdlib/hashtbl.cmj gpr_405_test.cmi gpr_441.cmj : gpr_459_test.cmj : mt.cmj @@ -329,8 +325,7 @@ hashtbl_test.cmj : mt.cmj ../stdlib/moreLabels.cmj ../stdlib/list.cmj \ hello.foo.cmj : ../runtime/js.cmj http_types.cmj : ../runtime/js.cmj ignore_test.cmj : mt.cmj ../runtime/js.cmj -imm_map_bench.cmj : ../runtime/js.cmj ../others/bs_Array.cmj \ - ../others/bs.cmj +imm_map_bench.cmj : ../runtime/js.cmj ../others/belt.cmj include_side_effect.cmj : side_effect.cmj include_side_effect_free.cmj : side_effect_free.cmj infer_type_test.cmj : ../runtime/js.cmj infer_type_test.cmi @@ -537,7 +532,7 @@ sexpm_test.cmj : sexpm.cmj mt.cmj ../runtime/js.cmj ../stdlib/format.cmj shift_test.cmj : ../stdlib/nativeint.cmj side_effect.cmj : ../runtime/js.cmj side_effect_free.cmj : -simple_derive_test.cmj : ../runtime/js.cmj ../others/bs.cmj \ +simple_derive_test.cmj : ../runtime/js.cmj ../others/belt.cmj \ simple_derive_test.cmi simple_derive_use.cmj : simple_derive_test.cmj simple_derive_use.cmi simple_lexer_test.cmj : ../stdlib/string.cmj mt.cmj ../stdlib/lexing.cmj diff --git a/jscomp/test/array_data_util.js b/jscomp/test/array_data_util.js index 7d96df2e59..c2cdedf743 100644 --- a/jscomp/test/array_data_util.js +++ b/jscomp/test/array_data_util.js @@ -1,18 +1,18 @@ 'use strict'; -var Bs_Array = require("../../lib/js/bs_Array.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); function range(i, j) { - return Bs_Array.makeBy((j - i | 0) + 1 | 0, (function (k) { + return Belt_Array.makeBy((j - i | 0) + 1 | 0, (function (k) { return k + i | 0; })); } function randomRange(i, j) { - var v = Bs_Array.makeBy((j - i | 0) + 1 | 0, (function (k) { + var v = Belt_Array.makeBy((j - i | 0) + 1 | 0, (function (k) { return k + i | 0; })); - Bs_Array.shuffleInPlace(v); + Belt_Array.shuffleInPlace(v); return v; } diff --git a/jscomp/test/array_data_util.ml b/jscomp/test/array_data_util.ml index 599e2fc289..60b9abcc1c 100644 --- a/jscomp/test/array_data_util.ml +++ b/jscomp/test/array_data_util.ml @@ -1,5 +1,5 @@ -module A = Bs_Array +module A = Belt.Array (* []*) let range i j = diff --git a/jscomp/test/bs_MapInt_test.js b/jscomp/test/bs_MapInt_test.js index 7f53b81313..3b1c86a5f8 100644 --- a/jscomp/test/bs_MapInt_test.js +++ b/jscomp/test/bs_MapInt_test.js @@ -1,6 +1,6 @@ 'use strict'; -var Bs_MapInt = require("../../lib/js/bs_MapInt.js"); +var Belt_MapInt = require("../../lib/js/belt_MapInt.js"); function should(b) { if (b) { @@ -11,17 +11,17 @@ function should(b) { } function test() { - var m = Bs_MapInt.empty; + var m = Belt_MapInt.empty; for(var i = 0; i <= 999999; ++i){ - m = Bs_MapInt.set(m, i, i); + m = Belt_MapInt.set(m, i, i); } for(var i$1 = 0; i$1 <= 999999; ++i$1){ - should(+(Bs_MapInt.get(m, i$1) !== /* None */0)); + should(+(Belt_MapInt.get(m, i$1) !== /* None */0)); } for(var i$2 = 0; i$2 <= 999999; ++i$2){ - m = Bs_MapInt.remove(m, i$2); + m = Belt_MapInt.remove(m, i$2); } - return should(Bs_MapInt.isEmpty(m)); + return should(Belt_MapInt.isEmpty(m)); } test(/* () */0); diff --git a/jscomp/test/bs_MapInt_test.ml b/jscomp/test/bs_MapInt_test.ml index 93c09273b6..0c5c29af29 100644 --- a/jscomp/test/bs_MapInt_test.ml +++ b/jscomp/test/bs_MapInt_test.ml @@ -1,7 +1,7 @@ let should b = if not b then Js.Exn.raiseError "IMPOSSIBLE" -module M = Bs.Map.Int +module M = Belt.Map.Int let test () = let m = ref M.empty in let count = 100_0000 - 1 in diff --git a/jscomp/test/bs_array_test.js b/jscomp/test/bs_array_test.js index f70827e468..def03267ac 100644 --- a/jscomp/test/bs_array_test.js +++ b/jscomp/test/bs_array_test.js @@ -2,12 +2,13 @@ var Mt = require("./mt.js"); var Block = require("../../lib/js/block.js"); -var Bs_List = require("../../lib/js/bs_List.js"); var Js_list = require("../../lib/js/js_list.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); +var Belt_List = require("../../lib/js/belt_List.js"); var Js_vector = require("../../lib/js/js_vector.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); var Caml_array = require("../../lib/js/caml_array.js"); +var Caml_primitive = require("../../lib/js/caml_primitive.js"); var suites = [/* [] */0]; @@ -51,11 +52,45 @@ console.log(/* int array */[ return x + y | 0; }), 0)); +var v = /* int array */[ + 1, + 2 +]; + +eq("File \"bs_array_test.ml\", line 24, characters 5-12", /* tuple */[ + Belt_Array.get(v, 0), + Belt_Array.get(v, 1), + Belt_Array.get(v, 2), + Belt_Array.get(v, 3), + Belt_Array.get(v, -1) + ], /* tuple */[ + /* Some */[1], + /* Some */[2], + /* None */0, + /* None */0, + /* None */0 + ]); + +b("File \"bs_array_test.ml\", line 28, characters 4-11", 1 - Belt_Array.set(/* int array */[ + 1, + 2 + ], 2, 0)); + +b("File \"bs_array_test.ml\", line 29, characters 4-11", Belt_Array.set(/* int array */[ + 1, + 2 + ], 0, 0)); + +b("File \"bs_array_test.ml\", line 30, characters 4-11", Belt_Array.set(/* int array */[ + 1, + 2 + ], 1, 0)); + function id(x) { - return eq("File \"bs_array_test.ml\", line 24, characters 5-12", Js_vector.toList(Js_list.toVector(x)), x); + return eq("File \"bs_array_test.ml\", line 34, characters 5-12", Js_vector.toList(Js_list.toVector(x)), x); } -eq("File \"bs_array_test.ml\", line 28, characters 5-12", Js_list.toVector(/* :: */[ +eq("File \"bs_array_test.ml\", line 38, characters 5-12", Js_list.toVector(/* :: */[ 1, /* :: */[ 2, @@ -70,7 +105,7 @@ eq("File \"bs_array_test.ml\", line 28, characters 5-12", Js_list.toVector(/* :: 3 ]); -eq("File \"bs_array_test.ml\", line 29, characters 6-13", Js_vector.map((function (x) { +eq("File \"bs_array_test.ml\", line 39, characters 6-13", Js_vector.map((function (x) { return x + 1 | 0; }), /* int array */[ 1, @@ -82,7 +117,7 @@ eq("File \"bs_array_test.ml\", line 29, characters 6-13", Js_vector.map((functio 4 ]); -eq("File \"bs_array_test.ml\", line 32, characters 5-12", Caml_array.caml_make_vect(5, 3), /* array */[ +eq("File \"bs_array_test.ml\", line 42, characters 5-12", Caml_array.caml_make_vect(5, 3), /* array */[ 3, 3, 3, @@ -94,7 +129,7 @@ var a = Js_vector.init(5, (function (i) { return i + 1 | 0; })); -eq("File \"bs_array_test.ml\", line 34, characters 5-12", (Js_vector.filterInPlace((function (j) { +eq("File \"bs_array_test.ml\", line 44, characters 5-12", (Js_vector.filterInPlace((function (j) { return +(j % 2 === 0); }), a), a), /* int array */[ 2, @@ -105,7 +140,7 @@ var a$1 = Js_vector.init(5, (function (i) { return i + 1 | 0; })); -eq("File \"bs_array_test.ml\", line 41, characters 5-12", (Js_vector.filterInPlace((function (j) { +eq("File \"bs_array_test.ml\", line 51, characters 5-12", (Js_vector.filterInPlace((function (j) { return +(j % 2 !== 0); }), a$1), a$1), /* int array */[ 1, @@ -113,7 +148,7 @@ eq("File \"bs_array_test.ml\", line 41, characters 5-12", (Js_vector.filterInPla 5 ]); -eq("File \"bs_array_test.ml\", line 48, characters 5-12", Js_list.toVector(/* :: */[ +eq("File \"bs_array_test.ml\", line 58, characters 5-12", Js_list.toVector(/* :: */[ 1, /* :: */[ 2, @@ -128,7 +163,7 @@ eq("File \"bs_array_test.ml\", line 48, characters 5-12", Js_list.toVector(/* :: 3 ]); -eq("File \"bs_array_test.ml\", line 50, characters 5-12", Js_list.toVector(/* :: */[ +eq("File \"bs_array_test.ml\", line 60, characters 5-12", Js_list.toVector(/* :: */[ 1, /* [] */0 ]), /* int array */[1]); @@ -165,35 +200,35 @@ function add(x, y) { return x + y | 0; } -var v = Bs_Array.makeBy(3000, (function (i) { +var v$1 = Belt_Array.makeBy(3000, (function (i) { return i; })); -var u = Bs_Array.shuffle(v); +var u = Belt_Array.shuffle(v$1); -neq("File \"bs_array_test.ml\", line 61, characters 6-13", u, v); +neq("File \"bs_array_test.ml\", line 71, characters 6-13", u, v$1); -eq("File \"bs_array_test.ml\", line 63, characters 5-12", Bs_Array.reduce(u, 0, add), Bs_Array.reduce(v, 0, add)); +eq("File \"bs_array_test.ml\", line 73, characters 5-12", Belt_Array.reduce(u, 0, add), Belt_Array.reduce(v$1, 0, add)); -b("File \"bs_array_test.ml\", line 68, characters 4-11", Caml_obj.caml_equal(Bs_Array.range(0, 3), /* int array */[ +b("File \"bs_array_test.ml\", line 78, characters 4-11", Caml_obj.caml_equal(Belt_Array.range(0, 3), /* int array */[ 0, 1, 2, 3 ])); -b("File \"bs_array_test.ml\", line 69, characters 4-11", Caml_obj.caml_equal(Bs_Array.range(3, 0), /* int array */[])); +b("File \"bs_array_test.ml\", line 79, characters 4-11", Caml_obj.caml_equal(Belt_Array.range(3, 0), /* int array */[])); -b("File \"bs_array_test.ml\", line 70, characters 4-11", Caml_obj.caml_equal(Bs_Array.range(3, 3), /* int array */[3])); +b("File \"bs_array_test.ml\", line 80, characters 4-11", Caml_obj.caml_equal(Belt_Array.range(3, 3), /* int array */[3])); -b("File \"bs_array_test.ml\", line 72, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(0, 10, 3), /* int array */[ +b("File \"bs_array_test.ml\", line 82, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(0, 10, 3), /* int array */[ 0, 3, 6, 9 ])); -b("File \"bs_array_test.ml\", line 73, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(0, 12, 3), /* array */[ +b("File \"bs_array_test.ml\", line 83, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(0, 12, 3), /* array */[ 0, 3, 6, @@ -201,28 +236,28 @@ b("File \"bs_array_test.ml\", line 73, characters 4-11", Caml_obj.caml_equal(Bs_ 12 ])); -b("File \"bs_array_test.ml\", line 74, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(33, 0, 1), /* int array */[])); +b("File \"bs_array_test.ml\", line 84, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(33, 0, 1), /* int array */[])); -b("File \"bs_array_test.ml\", line 75, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(33, 0, -1), /* int array */[])); +b("File \"bs_array_test.ml\", line 85, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(33, 0, -1), /* int array */[])); -b("File \"bs_array_test.ml\", line 76, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(3, 12, -1), /* int array */[])); +b("File \"bs_array_test.ml\", line 86, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(3, 12, -1), /* int array */[])); -b("File \"bs_array_test.ml\", line 77, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(3, 3, 0), /* int array */[])); +b("File \"bs_array_test.ml\", line 87, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(3, 3, 0), /* int array */[])); -b("File \"bs_array_test.ml\", line 78, characters 4-11", Caml_obj.caml_equal(Bs_Array.rangeBy(3, 3, 1), /* int array */[3])); +b("File \"bs_array_test.ml\", line 88, characters 4-11", Caml_obj.caml_equal(Belt_Array.rangeBy(3, 3, 1), /* int array */[3])); -eq("File \"bs_array_test.ml\", line 83, characters 5-12", Bs_Array.reduceReverse(/* int array */[], 100, (function (prim, prim$1) { +eq("File \"bs_array_test.ml\", line 93, characters 5-12", Belt_Array.reduceReverse(/* int array */[], 100, (function (prim, prim$1) { return prim - prim$1 | 0; })), 100); -eq("File \"bs_array_test.ml\", line 84, characters 5-12", Bs_Array.reduceReverse(/* int array */[ +eq("File \"bs_array_test.ml\", line 94, characters 5-12", Belt_Array.reduceReverse(/* int array */[ 1, 2 ], 100, (function (prim, prim$1) { return prim - prim$1 | 0; })), 97); -eq("File \"bs_array_test.ml\", line 85, characters 5-12", Bs_Array.reduceReverse(/* int array */[ +eq("File \"bs_array_test.ml\", line 95, characters 5-12", Belt_Array.reduceReverse(/* int array */[ 1, 2, 3, @@ -231,13 +266,24 @@ eq("File \"bs_array_test.ml\", line 85, characters 5-12", Bs_Array.reduceReverse return prim - prim$1 | 0; })), 90); +b("File \"bs_array_test.ml\", line 96, characters 4-11", +(Belt_Array.reduceReverse2(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 1, + 2 + ], 0, (function (acc, x, y) { + return (acc + x | 0) + y | 0; + })) === 6)); + function addone(x) { return x + 1 | 0; } function makeMatrixExn(sx, sy, init) { if (!(sx >= 0 && sy >= 0)) { - throw new Error("File \"bs_array_test.ml\", line 90, characters 4-10"); + throw new Error("File \"bs_array_test.ml\", line 102, characters 4-10"); } var res = new Array(sx); for(var x = 0 ,x_finish = sx - 1 | 0; x <= x_finish; ++x){ @@ -250,11 +296,11 @@ function makeMatrixExn(sx, sy, init) { return res; } -eq("File \"bs_array_test.ml\", line 102, characters 5-12", Bs_Array.makeBy(0, (function () { +eq("File \"bs_array_test.ml\", line 114, characters 5-12", Belt_Array.makeBy(0, (function () { return 1; })), /* int array */[]); -eq("File \"bs_array_test.ml\", line 103, characters 5-12", Bs_Array.makeBy(3, (function (i) { +eq("File \"bs_array_test.ml\", line 115, characters 5-12", Belt_Array.makeBy(3, (function (i) { return i; })), /* int array */[ 0, @@ -262,7 +308,7 @@ eq("File \"bs_array_test.ml\", line 103, characters 5-12", Bs_Array.makeBy(3, (f 2 ]); -eq("File \"bs_array_test.ml\", line 104, characters 5-12", makeMatrixExn(3, 4, 1), /* array */[ +eq("File \"bs_array_test.ml\", line 116, characters 5-12", makeMatrixExn(3, 4, 1), /* array */[ /* int array */[ 1, 1, @@ -283,25 +329,25 @@ eq("File \"bs_array_test.ml\", line 104, characters 5-12", makeMatrixExn(3, 4, 1 ] ]); -eq("File \"bs_array_test.ml\", line 107, characters 5-12", makeMatrixExn(3, 0, 0), /* array */[ +eq("File \"bs_array_test.ml\", line 119, characters 5-12", makeMatrixExn(3, 0, 0), /* array */[ /* int array */[], /* int array */[], /* int array */[] ]); -eq("File \"bs_array_test.ml\", line 108, characters 5-12", makeMatrixExn(0, 3, 1), /* array */[]); +eq("File \"bs_array_test.ml\", line 120, characters 5-12", makeMatrixExn(0, 3, 1), /* array */[]); -eq("File \"bs_array_test.ml\", line 109, characters 5-12", makeMatrixExn(1, 1, 1), /* array */[/* int array */[1]]); +eq("File \"bs_array_test.ml\", line 121, characters 5-12", makeMatrixExn(1, 1, 1), /* array */[/* int array */[1]]); -eq("File \"bs_array_test.ml\", line 110, characters 5-12", Bs_Array.copy(/* array */[]), /* array */[]); +eq("File \"bs_array_test.ml\", line 122, characters 5-12", Belt_Array.copy(/* array */[]), /* array */[]); -eq("File \"bs_array_test.ml\", line 111, characters 5-12", Bs_Array.map(/* int array */[], (function (prim) { +eq("File \"bs_array_test.ml\", line 123, characters 5-12", Belt_Array.map(/* int array */[], (function (prim) { return prim + 1 | 0; })), /* int array */[]); -eq("File \"bs_array_test.ml\", line 112, characters 5-12", Bs_Array.mapWithIndex(/* int array */[], add), /* int array */[]); +eq("File \"bs_array_test.ml\", line 124, characters 5-12", Belt_Array.mapWithIndex(/* int array */[], add), /* int array */[]); -eq("File \"bs_array_test.ml\", line 113, characters 5-12", Bs_Array.mapWithIndex(/* int array */[ +eq("File \"bs_array_test.ml\", line 125, characters 5-12", Belt_Array.mapWithIndex(/* int array */[ 1, 2, 3 @@ -311,14 +357,14 @@ eq("File \"bs_array_test.ml\", line 113, characters 5-12", Bs_Array.mapWithIndex 5 ]); -eq("File \"bs_array_test.ml\", line 114, characters 5-12", Bs_List.ofArray(/* array */[]), /* [] */0); +eq("File \"bs_array_test.ml\", line 126, characters 5-12", Belt_List.ofArray(/* array */[]), /* [] */0); -eq("File \"bs_array_test.ml\", line 115, characters 5-12", Bs_List.ofArray(/* int array */[1]), /* :: */[ +eq("File \"bs_array_test.ml\", line 127, characters 5-12", Belt_List.ofArray(/* int array */[1]), /* :: */[ 1, /* [] */0 ]); -eq("File \"bs_array_test.ml\", line 116, characters 5-12", Bs_List.ofArray(/* int array */[ +eq("File \"bs_array_test.ml\", line 128, characters 5-12", Belt_List.ofArray(/* int array */[ 1, 2, 3 @@ -333,7 +379,7 @@ eq("File \"bs_array_test.ml\", line 116, characters 5-12", Bs_List.ofArray(/* in ] ]); -eq("File \"bs_array_test.ml\", line 117, characters 5-12", Bs_Array.map(/* int array */[ +eq("File \"bs_array_test.ml\", line 129, characters 5-12", Belt_Array.map(/* int array */[ 1, 2, 3 @@ -345,14 +391,14 @@ eq("File \"bs_array_test.ml\", line 117, characters 5-12", Bs_Array.map(/* int a 4 ]); -eq("File \"bs_array_test.ml\", line 118, characters 5-12", Bs_List.toArray(/* [] */0), /* array */[]); +eq("File \"bs_array_test.ml\", line 130, characters 5-12", Belt_List.toArray(/* [] */0), /* array */[]); -eq("File \"bs_array_test.ml\", line 119, characters 5-12", Bs_List.toArray(/* :: */[ +eq("File \"bs_array_test.ml\", line 131, characters 5-12", Belt_List.toArray(/* :: */[ 1, /* [] */0 ]), /* int array */[1]); -eq("File \"bs_array_test.ml\", line 120, characters 5-12", Bs_List.toArray(/* :: */[ +eq("File \"bs_array_test.ml\", line 132, characters 5-12", Belt_List.toArray(/* :: */[ 1, /* :: */[ 2, @@ -363,7 +409,7 @@ eq("File \"bs_array_test.ml\", line 120, characters 5-12", Bs_List.toArray(/* :: 2 ]); -eq("File \"bs_array_test.ml\", line 121, characters 5-12", Bs_List.toArray(/* :: */[ +eq("File \"bs_array_test.ml\", line 133, characters 5-12", Belt_List.toArray(/* :: */[ 1, /* :: */[ 2, @@ -378,19 +424,19 @@ eq("File \"bs_array_test.ml\", line 121, characters 5-12", Bs_List.toArray(/* :: 3 ]); -var v$1 = Bs_Array.makeBy(10, (function (i) { +var v$2 = Belt_Array.makeBy(10, (function (i) { return i; })); -var v0 = Bs_Array.keep(v$1, (function (x) { +var v0 = Belt_Array.keep(v$2, (function (x) { return +(x % 2 === 0); })); -var v1 = Bs_Array.keep(v$1, (function (x) { +var v1 = Belt_Array.keep(v$2, (function (x) { return +(x % 3 === 0); })); -var v2 = Bs_Array.keepMap(v$1, (function (x) { +var v2 = Belt_Array.keepMap(v$2, (function (x) { if (x % 2) { return /* None */0; } else { @@ -398,7 +444,7 @@ var v2 = Bs_Array.keepMap(v$1, (function (x) { } })); -eq("File \"bs_array_test.ml\", line 128, characters 5-12", v0, /* array */[ +eq("File \"bs_array_test.ml\", line 140, characters 5-12", v0, /* array */[ 0, 2, 4, @@ -406,14 +452,14 @@ eq("File \"bs_array_test.ml\", line 128, characters 5-12", v0, /* array */[ 8 ]); -eq("File \"bs_array_test.ml\", line 129, characters 5-12", v1, /* int array */[ +eq("File \"bs_array_test.ml\", line 141, characters 5-12", v1, /* int array */[ 0, 3, 6, 9 ]); -eq("File \"bs_array_test.ml\", line 130, characters 5-12", v2, /* array */[ +eq("File \"bs_array_test.ml\", line 142, characters 5-12", v2, /* array */[ 1, 3, 5, @@ -429,12 +475,12 @@ var a$2 = /* array */[ 5 ]; -eq("File \"bs_array_test.ml\", line 134, characters 5-12", Bs_Array.slice(a$2, 0, 2), /* int array */[ +eq("File \"bs_array_test.ml\", line 146, characters 5-12", Belt_Array.slice(a$2, 0, 2), /* int array */[ 1, 2 ]); -eq("File \"bs_array_test.ml\", line 135, characters 5-12", Bs_Array.slice(a$2, 0, 5), /* array */[ +eq("File \"bs_array_test.ml\", line 147, characters 5-12", Belt_Array.slice(a$2, 0, 5), /* array */[ 1, 2, 3, @@ -442,7 +488,7 @@ eq("File \"bs_array_test.ml\", line 135, characters 5-12", Bs_Array.slice(a$2, 0 5 ]); -eq("File \"bs_array_test.ml\", line 136, characters 5-12", Bs_Array.slice(a$2, 0, 15), /* array */[ +eq("File \"bs_array_test.ml\", line 148, characters 5-12", Belt_Array.slice(a$2, 0, 15), /* array */[ 1, 2, 3, @@ -450,40 +496,40 @@ eq("File \"bs_array_test.ml\", line 136, characters 5-12", Bs_Array.slice(a$2, 0 5 ]); -eq("File \"bs_array_test.ml\", line 137, characters 5-12", Bs_Array.slice(a$2, 5, 1), /* int array */[]); +eq("File \"bs_array_test.ml\", line 149, characters 5-12", Belt_Array.slice(a$2, 5, 1), /* int array */[]); -eq("File \"bs_array_test.ml\", line 138, characters 5-12", Bs_Array.slice(a$2, 4, 1), /* int array */[5]); +eq("File \"bs_array_test.ml\", line 150, characters 5-12", Belt_Array.slice(a$2, 4, 1), /* int array */[5]); -eq("File \"bs_array_test.ml\", line 139, characters 5-12", Bs_Array.slice(a$2, -1, 1), /* int array */[5]); +eq("File \"bs_array_test.ml\", line 151, characters 5-12", Belt_Array.slice(a$2, -1, 1), /* int array */[5]); -eq("File \"bs_array_test.ml\", line 140, characters 5-12", Bs_Array.slice(a$2, -1, 2), /* int array */[5]); +eq("File \"bs_array_test.ml\", line 152, characters 5-12", Belt_Array.slice(a$2, -1, 2), /* int array */[5]); -eq("File \"bs_array_test.ml\", line 141, characters 5-12", Bs_Array.slice(a$2, -2, 1), /* int array */[4]); +eq("File \"bs_array_test.ml\", line 153, characters 5-12", Belt_Array.slice(a$2, -2, 1), /* int array */[4]); -eq("File \"bs_array_test.ml\", line 142, characters 5-12", Bs_Array.slice(a$2, -2, 2), /* int array */[ +eq("File \"bs_array_test.ml\", line 154, characters 5-12", Belt_Array.slice(a$2, -2, 2), /* int array */[ 4, 5 ]); -eq("File \"bs_array_test.ml\", line 143, characters 5-12", Bs_Array.slice(a$2, -2, 3), /* int array */[ +eq("File \"bs_array_test.ml\", line 155, characters 5-12", Belt_Array.slice(a$2, -2, 3), /* int array */[ 4, 5 ]); -eq("File \"bs_array_test.ml\", line 144, characters 5-12", Bs_Array.slice(a$2, -10, 3), /* int array */[ +eq("File \"bs_array_test.ml\", line 156, characters 5-12", Belt_Array.slice(a$2, -10, 3), /* int array */[ 1, 2, 3 ]); -eq("File \"bs_array_test.ml\", line 145, characters 5-12", Bs_Array.slice(a$2, -10, 4), /* int array */[ +eq("File \"bs_array_test.ml\", line 157, characters 5-12", Belt_Array.slice(a$2, -10, 4), /* int array */[ 1, 2, 3, 4 ]); -eq("File \"bs_array_test.ml\", line 146, characters 5-12", Bs_Array.slice(a$2, -10, 5), /* array */[ +eq("File \"bs_array_test.ml\", line 158, characters 5-12", Belt_Array.slice(a$2, -10, 5), /* array */[ 1, 2, 3, @@ -491,7 +537,7 @@ eq("File \"bs_array_test.ml\", line 146, characters 5-12", Bs_Array.slice(a$2, - 5 ]); -eq("File \"bs_array_test.ml\", line 147, characters 5-12", Bs_Array.slice(a$2, -10, 6), /* array */[ +eq("File \"bs_array_test.ml\", line 159, characters 5-12", Belt_Array.slice(a$2, -10, 6), /* array */[ 1, 2, 3, @@ -499,17 +545,17 @@ eq("File \"bs_array_test.ml\", line 147, characters 5-12", Bs_Array.slice(a$2, - 5 ]); -eq("File \"bs_array_test.ml\", line 148, characters 5-12", Bs_Array.slice(a$2, 0, 0), /* int array */[]); +eq("File \"bs_array_test.ml\", line 160, characters 5-12", Belt_Array.slice(a$2, 0, 0), /* int array */[]); -eq("File \"bs_array_test.ml\", line 149, characters 5-12", Bs_Array.slice(a$2, 0, -1), /* int array */[]); +eq("File \"bs_array_test.ml\", line 161, characters 5-12", Belt_Array.slice(a$2, 0, -1), /* int array */[]); -var a$3 = Bs_Array.makeBy(10, (function (x) { +var a$3 = Belt_Array.makeBy(10, (function (x) { return x; })); -Bs_Array.fill(a$3, 0, 3, 0); +Belt_Array.fill(a$3, 0, 3, 0); -eq("File \"bs_array_test.ml\", line 154, characters 6-13", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 166, characters 6-13", Belt_Array.copy(a$3), /* array */[ 0, 0, 0, @@ -522,9 +568,9 @@ eq("File \"bs_array_test.ml\", line 154, characters 6-13", Bs_Array.copy(a$3), / 9 ]); -Bs_Array.fill(a$3, 2, 8, 1); +Belt_Array.fill(a$3, 2, 8, 1); -eq("File \"bs_array_test.ml\", line 156, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 168, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -537,9 +583,9 @@ eq("File \"bs_array_test.ml\", line 156, characters 5-12", Bs_Array.copy(a$3), / 1 ]); -Bs_Array.fill(a$3, 8, 1, 9); +Belt_Array.fill(a$3, 8, 1, 9); -eq("File \"bs_array_test.ml\", line 158, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 170, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -552,9 +598,9 @@ eq("File \"bs_array_test.ml\", line 158, characters 5-12", Bs_Array.copy(a$3), / 1 ]); -Bs_Array.fill(a$3, 8, 2, 9); +Belt_Array.fill(a$3, 8, 2, 9); -eq("File \"bs_array_test.ml\", line 160, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 172, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -567,9 +613,9 @@ eq("File \"bs_array_test.ml\", line 160, characters 5-12", Bs_Array.copy(a$3), / 9 ]); -Bs_Array.fill(a$3, 8, 3, 12); +Belt_Array.fill(a$3, 8, 3, 12); -eq("File \"bs_array_test.ml\", line 162, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 174, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -582,9 +628,9 @@ eq("File \"bs_array_test.ml\", line 162, characters 5-12", Bs_Array.copy(a$3), / 12 ]); -Bs_Array.fill(a$3, -2, 3, 11); +Belt_Array.fill(a$3, -2, 3, 11); -eq("File \"bs_array_test.ml\", line 164, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 176, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -597,9 +643,9 @@ eq("File \"bs_array_test.ml\", line 164, characters 5-12", Bs_Array.copy(a$3), / 11 ]); -Bs_Array.fill(a$3, -3, 3, 10); +Belt_Array.fill(a$3, -3, 3, 10); -eq("File \"bs_array_test.ml\", line 166, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 178, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -612,9 +658,9 @@ eq("File \"bs_array_test.ml\", line 166, characters 5-12", Bs_Array.copy(a$3), / 10 ]); -Bs_Array.fill(a$3, -3, 1, 7); +Belt_Array.fill(a$3, -3, 1, 7); -eq("File \"bs_array_test.ml\", line 168, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 180, characters 5-12", Belt_Array.copy(a$3), /* array */[ 0, 0, 1, @@ -627,9 +673,9 @@ eq("File \"bs_array_test.ml\", line 168, characters 5-12", Bs_Array.copy(a$3), / 10 ]); -Bs_Array.fill(a$3, -13, 1, 7); +Belt_Array.fill(a$3, -13, 1, 7); -eq("File \"bs_array_test.ml\", line 170, characters 5-12", Bs_Array.copy(a$3), /* array */[ +eq("File \"bs_array_test.ml\", line 182, characters 5-12", Belt_Array.copy(a$3), /* array */[ 7, 0, 1, @@ -642,23 +688,23 @@ eq("File \"bs_array_test.ml\", line 170, characters 5-12", Bs_Array.copy(a$3), / 10 ]); -Bs_Array.fill(a$3, -13, 12, 7); +Belt_Array.fill(a$3, -13, 12, 7); -eq("File \"bs_array_test.ml\", line 172, characters 5-12", Bs_Array.copy(a$3), Bs_Array.make(10, 7)); +eq("File \"bs_array_test.ml\", line 184, characters 5-12", Belt_Array.copy(a$3), Belt_Array.make(10, 7)); -Bs_Array.fill(a$3, 0, -1, 2); +Belt_Array.fill(a$3, 0, -1, 2); -eq("File \"bs_array_test.ml\", line 174, characters 5-12", Bs_Array.copy(a$3), Bs_Array.make(10, 7)); +eq("File \"bs_array_test.ml\", line 186, characters 5-12", Belt_Array.copy(a$3), Belt_Array.make(10, 7)); -var a0 = Bs_Array.makeBy(10, (function (x) { +var a0 = Belt_Array.makeBy(10, (function (x) { return x; })); -var b0 = Bs_Array.make(10, 3); +var b0 = Belt_Array.make(10, 3); -Bs_Array.blit(a0, 1, b0, 2, 5); +Belt_Array.blit(a0, 1, b0, 2, 5); -eq("File \"bs_array_test.ml\", line 180, characters 5-12", Bs_Array.copy(b0), /* array */[ +eq("File \"bs_array_test.ml\", line 192, characters 5-12", Belt_Array.copy(b0), /* array */[ 3, 3, 1, @@ -671,9 +717,9 @@ eq("File \"bs_array_test.ml\", line 180, characters 5-12", Bs_Array.copy(b0), /* 3 ]); -Bs_Array.blit(a0, -1, b0, 2, 5); +Belt_Array.blit(a0, -1, b0, 2, 5); -eq("File \"bs_array_test.ml\", line 183, characters 5-12", Bs_Array.copy(b0), /* array */[ +eq("File \"bs_array_test.ml\", line 195, characters 5-12", Belt_Array.copy(b0), /* array */[ 3, 3, 9, @@ -686,9 +732,9 @@ eq("File \"bs_array_test.ml\", line 183, characters 5-12", Bs_Array.copy(b0), /* 3 ]); -Bs_Array.blit(a0, -1, b0, -2, 5); +Belt_Array.blit(a0, -1, b0, -2, 5); -eq("File \"bs_array_test.ml\", line 186, characters 5-12", Bs_Array.copy(b0), /* array */[ +eq("File \"bs_array_test.ml\", line 198, characters 5-12", Belt_Array.copy(b0), /* array */[ 3, 3, 9, @@ -701,9 +747,9 @@ eq("File \"bs_array_test.ml\", line 186, characters 5-12", Bs_Array.copy(b0), /* 3 ]); -Bs_Array.blit(a0, -2, b0, -2, 2); +Belt_Array.blit(a0, -2, b0, -2, 2); -eq("File \"bs_array_test.ml\", line 189, characters 5-12", Bs_Array.copy(b0), /* array */[ +eq("File \"bs_array_test.ml\", line 201, characters 5-12", Belt_Array.copy(b0), /* array */[ 3, 3, 9, @@ -716,21 +762,21 @@ eq("File \"bs_array_test.ml\", line 189, characters 5-12", Bs_Array.copy(b0), /* 9 ]); -Bs_Array.blit(a0, -11, b0, -11, 100); +Belt_Array.blit(a0, -11, b0, -11, 100); -eq("File \"bs_array_test.ml\", line 192, characters 5-12", Bs_Array.copy(b0), a0); +eq("File \"bs_array_test.ml\", line 204, characters 5-12", Belt_Array.copy(b0), a0); -Bs_Array.blit(a0, -11, b0, -11, 2); +Belt_Array.blit(a0, -11, b0, -11, 2); -eq("File \"bs_array_test.ml\", line 194, characters 5-12", Bs_Array.copy(b0), a0); +eq("File \"bs_array_test.ml\", line 206, characters 5-12", Belt_Array.copy(b0), a0); -var aa = Bs_Array.makeBy(10, (function (x) { +var aa = Belt_Array.makeBy(10, (function (x) { return x; })); -Bs_Array.blit(aa, -1, aa, 1, 2); +Belt_Array.blit(aa, -1, aa, 1, 2); -eq("File \"bs_array_test.ml\", line 197, characters 5-12", Bs_Array.copy(aa), /* array */[ +eq("File \"bs_array_test.ml\", line 209, characters 5-12", Belt_Array.copy(aa), /* array */[ 0, 9, 2, @@ -743,9 +789,9 @@ eq("File \"bs_array_test.ml\", line 197, characters 5-12", Bs_Array.copy(aa), /* 9 ]); -Bs_Array.blit(aa, -2, aa, 1, 2); +Belt_Array.blit(aa, -2, aa, 1, 2); -eq("File \"bs_array_test.ml\", line 199, characters 5-12", Bs_Array.copy(aa), /* array */[ +eq("File \"bs_array_test.ml\", line 211, characters 5-12", Belt_Array.copy(aa), /* array */[ 0, 8, 9, @@ -758,9 +804,9 @@ eq("File \"bs_array_test.ml\", line 199, characters 5-12", Bs_Array.copy(aa), /* 9 ]); -Bs_Array.blit(aa, -5, aa, 4, 3); +Belt_Array.blit(aa, -5, aa, 4, 3); -eq("File \"bs_array_test.ml\", line 201, characters 5-12", Bs_Array.copy(aa), /* array */[ +eq("File \"bs_array_test.ml\", line 213, characters 5-12", Belt_Array.copy(aa), /* array */[ 0, 8, 9, @@ -773,9 +819,9 @@ eq("File \"bs_array_test.ml\", line 201, characters 5-12", Bs_Array.copy(aa), /* 9 ]); -Bs_Array.blit(aa, 4, aa, 5, 3); +Belt_Array.blit(aa, 4, aa, 5, 3); -eq("File \"bs_array_test.ml\", line 203, characters 5-12", Bs_Array.copy(aa), /* array */[ +eq("File \"bs_array_test.ml\", line 215, characters 5-12", Belt_Array.copy(aa), /* array */[ 0, 8, 9, @@ -788,27 +834,142 @@ eq("File \"bs_array_test.ml\", line 203, characters 5-12", Bs_Array.copy(aa), /* 9 ]); +eq("File \"bs_array_test.ml\", line 216, characters 5-12", Belt_Array.make(0, 3), /* int array */[]); + +eq("File \"bs_array_test.ml\", line 217, characters 5-12", Belt_Array.make(-1, 3), /* int array */[]); + +eq("File \"bs_array_test.ml\", line 220, characters 5-12", Belt_Array.zip(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 2, + 3, + 4, + 1 + ]), /* array */[ + /* tuple */[ + 1, + 2 + ], + /* tuple */[ + 2, + 3 + ], + /* tuple */[ + 3, + 4 + ] + ]); + +eq("File \"bs_array_test.ml\", line 221, characters 5-12", Belt_Array.zip(/* int array */[ + 2, + 3, + 4, + 1 + ], /* int array */[ + 1, + 2, + 3 + ]), /* array */[ + /* tuple */[ + 2, + 1 + ], + /* tuple */[ + 3, + 2 + ], + /* tuple */[ + 4, + 3 + ] + ]); + +eq("File \"bs_array_test.ml\", line 222, characters 5-12", Belt_Array.zipBy(/* int array */[ + 2, + 3, + 4, + 1 + ], /* int array */[ + 1, + 2, + 3 + ], (function (prim, prim$1) { + return prim - prim$1 | 0; + })), /* int array */[ + 1, + 1, + 1 + ]); + +eq("File \"bs_array_test.ml\", line 223, characters 5-12", Belt_Array.zipBy(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 2, + 3, + 4, + 1 + ], (function (prim, prim$1) { + return prim - prim$1 | 0; + })), Belt_Array.map(/* int array */[ + 1, + 1, + 1 + ], (function (x) { + return -x | 0; + }))); + +function sumUsingForEach(xs) { + var v = [0]; + Belt_Array.forEach(xs, (function (x) { + v[0] = v[0] + x | 0; + return /* () */0; + })); + return v[0]; +} + +eq("File \"bs_array_test.ml\", line 231, characters 5-12", sumUsingForEach(/* array */[ + 0, + 1, + 2, + 3, + 4 + ]), 10); + +b("File \"bs_array_test.ml\", line 232, characters 4-11", 1 - Belt_Array.every(/* array */[ + 0, + 1, + 2, + 3, + 4 + ], (function (x) { + return +(x > 2); + }))); + function id$1(_, x) { - var u = Bs_Array.copy(x); - return eq("File \"bs_array_test.ml\", line 206, characters 5-12", Bs_Array.reverse(x), (Bs_Array.reverseInPlace(u), u)); + var u = Belt_Array.copy(x); + return eq("File \"bs_array_test.ml\", line 240, characters 5-12", Belt_Array.reverse(x), (Belt_Array.reverseInPlace(u), u)); } -id$1("File \"bs_array_test.ml\", line 211, characters 5-12", /* array */[]); +id$1("File \"bs_array_test.ml\", line 245, characters 5-12", /* array */[]); -id$1("File \"bs_array_test.ml\", line 212, characters 5-12", /* int array */[1]); +id$1("File \"bs_array_test.ml\", line 246, characters 5-12", /* int array */[1]); -id$1("File \"bs_array_test.ml\", line 213, characters 5-12", /* int array */[ +id$1("File \"bs_array_test.ml\", line 247, characters 5-12", /* int array */[ 1, 2 ]); -id$1("File \"bs_array_test.ml\", line 214, characters 5-12", /* int array */[ +id$1("File \"bs_array_test.ml\", line 248, characters 5-12", /* int array */[ 1, 2, 3 ]); -id$1("File \"bs_array_test.ml\", line 215, characters 5-12", /* int array */[ +id$1("File \"bs_array_test.ml\", line 249, characters 5-12", /* int array */[ 1, 2, 3, @@ -816,29 +977,29 @@ id$1("File \"bs_array_test.ml\", line 215, characters 5-12", /* int array */[ ]); function every2(xs, ys) { - var partial_arg = Bs_List.toArray(ys); - var partial_arg$1 = Bs_List.toArray(xs); + var partial_arg = Belt_List.toArray(ys); + var partial_arg$1 = Belt_List.toArray(xs); return (function (param) { - return Bs_Array.every2(partial_arg$1, partial_arg, param); + return Belt_Array.every2(partial_arg$1, partial_arg, param); }); } function some2(xs, ys) { - var partial_arg = Bs_List.toArray(ys); - var partial_arg$1 = Bs_List.toArray(xs); + var partial_arg = Belt_List.toArray(ys); + var partial_arg$1 = Belt_List.toArray(xs); return (function (param) { - return Bs_Array.some2(partial_arg$1, partial_arg, param); + return Belt_Array.some2(partial_arg$1, partial_arg, param); }); } -eq("File \"bs_array_test.ml\", line 225, characters 5-12", every2(/* [] */0, /* :: */[ +eq("File \"bs_array_test.ml\", line 259, characters 5-12", every2(/* [] */0, /* :: */[ 1, /* [] */0 ])((function (x, y) { return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 226, characters 5-12", every2(/* :: */[ +eq("File \"bs_array_test.ml\", line 260, characters 5-12", every2(/* :: */[ 2, /* :: */[ 3, @@ -851,7 +1012,7 @@ eq("File \"bs_array_test.ml\", line 226, characters 5-12", every2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 227, characters 5-12", every2(/* :: */[ +eq("File \"bs_array_test.ml\", line 261, characters 5-12", every2(/* :: */[ 2, /* [] */0 ], /* :: */[ @@ -861,7 +1022,7 @@ eq("File \"bs_array_test.ml\", line 227, characters 5-12", every2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 228, characters 5-12", every2(/* :: */[ +eq("File \"bs_array_test.ml\", line 262, characters 5-12", every2(/* :: */[ 2, /* :: */[ 3, @@ -877,7 +1038,7 @@ eq("File \"bs_array_test.ml\", line 228, characters 5-12", every2(/* :: */[ return +(x > y); })), /* false */0); -eq("File \"bs_array_test.ml\", line 229, characters 5-12", every2(/* :: */[ +eq("File \"bs_array_test.ml\", line 263, characters 5-12", every2(/* :: */[ 2, /* :: */[ 3, @@ -893,14 +1054,14 @@ eq("File \"bs_array_test.ml\", line 229, characters 5-12", every2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 230, characters 5-12", some2(/* [] */0, /* :: */[ +eq("File \"bs_array_test.ml\", line 264, characters 5-12", some2(/* [] */0, /* :: */[ 1, /* [] */0 ])((function (x, y) { return +(x > y); })), /* false */0); -eq("File \"bs_array_test.ml\", line 231, characters 5-12", some2(/* :: */[ +eq("File \"bs_array_test.ml\", line 265, characters 5-12", some2(/* :: */[ 2, /* :: */[ 3, @@ -913,7 +1074,7 @@ eq("File \"bs_array_test.ml\", line 231, characters 5-12", some2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 232, characters 5-12", some2(/* :: */[ +eq("File \"bs_array_test.ml\", line 266, characters 5-12", some2(/* :: */[ 2, /* :: */[ 3, @@ -929,7 +1090,7 @@ eq("File \"bs_array_test.ml\", line 232, characters 5-12", some2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 233, characters 5-12", some2(/* :: */[ +eq("File \"bs_array_test.ml\", line 267, characters 5-12", some2(/* :: */[ 0, /* :: */[ 3, @@ -945,7 +1106,7 @@ eq("File \"bs_array_test.ml\", line 233, characters 5-12", some2(/* :: */[ return +(x > y); })), /* false */0); -eq("File \"bs_array_test.ml\", line 234, characters 5-12", some2(/* :: */[ +eq("File \"bs_array_test.ml\", line 268, characters 5-12", some2(/* :: */[ 0, /* :: */[ 3, @@ -961,7 +1122,7 @@ eq("File \"bs_array_test.ml\", line 234, characters 5-12", some2(/* :: */[ return +(x > y); })), /* true */1); -eq("File \"bs_array_test.ml\", line 239, characters 5-12", Bs_Array.concat(/* int array */[], /* int array */[ +eq("File \"bs_array_test.ml\", line 273, characters 5-12", Belt_Array.concat(/* int array */[], /* int array */[ 1, 2, 3 @@ -971,9 +1132,9 @@ eq("File \"bs_array_test.ml\", line 239, characters 5-12", Bs_Array.concat(/* in 3 ]); -eq("File \"bs_array_test.ml\", line 240, characters 5-12", Bs_Array.concat(/* array */[], /* array */[]), /* array */[]); +eq("File \"bs_array_test.ml\", line 274, characters 5-12", Belt_Array.concat(/* array */[], /* array */[]), /* array */[]); -eq("File \"bs_array_test.ml\", line 241, characters 5-12", Bs_Array.concat(/* int array */[ +eq("File \"bs_array_test.ml\", line 275, characters 5-12", Belt_Array.concat(/* int array */[ 3, 2 ], /* int array */[ @@ -988,7 +1149,7 @@ eq("File \"bs_array_test.ml\", line 241, characters 5-12", Bs_Array.concat(/* in 3 ]); -eq("File \"bs_array_test.ml\", line 242, characters 5-12", Bs_Array.concatMany(/* array */[ +eq("File \"bs_array_test.ml\", line 276, characters 5-12", Belt_Array.concatMany(/* array */[ /* int array */[ 3, 2 @@ -1006,7 +1167,7 @@ eq("File \"bs_array_test.ml\", line 242, characters 5-12", Bs_Array.concatMany(/ 3 ]); -eq("File \"bs_array_test.ml\", line 243, characters 5-12", Bs_Array.concatMany(/* array */[ +eq("File \"bs_array_test.ml\", line 277, characters 5-12", Belt_Array.concatMany(/* array */[ /* int array */[ 3, 2 @@ -1027,7 +1188,7 @@ eq("File \"bs_array_test.ml\", line 243, characters 5-12", Bs_Array.concatMany(/ 0 ]); -eq("File \"bs_array_test.ml\", line 244, characters 5-12", Bs_Array.concatMany(/* array */[ +eq("File \"bs_array_test.ml\", line 278, characters 5-12", Belt_Array.concatMany(/* array */[ /* int array */[], /* int array */[ 3, @@ -1049,12 +1210,53 @@ eq("File \"bs_array_test.ml\", line 244, characters 5-12", Bs_Array.concatMany(/ 0 ]); -eq("File \"bs_array_test.ml\", line 245, characters 5-12", Bs_Array.concatMany(/* array */[ +eq("File \"bs_array_test.ml\", line 279, characters 5-12", Belt_Array.concatMany(/* array */[ /* array */[], /* array */[] ]), /* array */[]); -Mt.from_pair_suites("File \"bs_array_test.ml\", line 247, characters 23-30", suites[0]); +b("File \"bs_array_test.ml\", line 282, characters 4-11", +(Belt_Array.cmp(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 0, + 1, + 2, + 3 + ], Caml_obj.caml_compare) < 0)); + +b("File \"bs_array_test.ml\", line 283, characters 4-11", +(Belt_Array.cmp(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 0, + 1, + 2 + ], Caml_primitive.caml_int_compare) > 0)); + +b("File \"bs_array_test.ml\", line 284, characters 4-11", +(Belt_Array.cmp(/* int array */[ + 1, + 2, + 3 + ], /* int array */[ + 1, + 2, + 3 + ], Caml_primitive.caml_int_compare) === 0)); + +b("File \"bs_array_test.ml\", line 285, characters 4-11", +(Belt_Array.cmp(/* int array */[ + 1, + 2, + 4 + ], /* int array */[ + 1, + 2, + 3 + ], Caml_primitive.caml_int_compare) > 0)); + +Mt.from_pair_suites("File \"bs_array_test.ml\", line 288, characters 23-30", suites[0]); var A = 0; @@ -1070,5 +1272,6 @@ exports.L = L; exports.add = add; exports.addone = addone; exports.makeMatrixExn = makeMatrixExn; +exports.sumUsingForEach = sumUsingForEach; exports.id = id$1; /* Not a pure module */ diff --git a/jscomp/test/bs_array_test.ml b/jscomp/test/bs_array_test.ml index be14b7059c..e2e5c164c5 100644 --- a/jscomp/test/bs_array_test.ml +++ b/jscomp/test/bs_array_test.ml @@ -8,8 +8,8 @@ let neq loc x y = suites := (loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Neq(x,y))) :: !suites -module A = Bs.Array -module L = Bs.List +module A = Belt.Array +module L = Belt.List type 'a t = 'a Js.Array.t let () = [| 1; 2; 3; 4 |] @@ -19,6 +19,16 @@ let () = |> Js.log +let () = + let v = [|1;2|] in + eq __LOC__ + (A.get v 0, A.get v 1, A.get v 2, A.get v 3, A.get v (-1) ) + (Some 1,Some 2, None, None, None); + + b __LOC__ (not (A.set [|1;2|] 2 0 )); + b __LOC__ (A.set [|1;2|] 0 0 ); + b __LOC__ (A.set [|1;2|] 1 0 ) + let id x = eq __LOC__ @@ -82,7 +92,9 @@ let () = let () = eq __LOC__ (A.reduceReverse [||] 100 (-)) 100; eq __LOC__ (A.reduceReverse [|1;2|] 100 (-)) 97; - eq __LOC__ (A.reduceReverse [|1;2;3;4|] 100 (-) ) 90 + eq __LOC__ (A.reduceReverse [|1;2;3;4|] 100 (-) ) 90; + b __LOC__ + (A.reduceReverse2 [|1;2;3|] [|1;2|] 0 (fun acc x y -> acc + x + y) = 6) let addone = fun [@bs] x -> x + 1 let makeMatrixExn sx sy init = @@ -200,7 +212,29 @@ let () = A.blit ~src:aa ~srcOffset:(-5) ~dst:aa ~dstOffset:4 ~len:3 ; eq __LOC__ (A.copy aa) [|0;8;9;3;5;6;7;7;8;9|]; A.blit ~src:aa ~srcOffset:4 ~dst:aa ~dstOffset:5 ~len:3 ; - eq __LOC__ (A.copy aa) [|0;8;9;3;5;5;6;7;8;9|] + eq __LOC__ (A.copy aa) [|0;8;9;3;5;5;6;7;8;9|]; + eq __LOC__ (A.make 0 3) [||]; + eq __LOC__ (A.make (-1) 3) [||] + +let () = + eq __LOC__ (A.zip [|1;2;3|] [|2;3;4;1|]) [|1,2;2,3;3,4|]; + eq __LOC__ (A.zip [|2;3;4;1|] [|1;2;3|] ) [|2,1;3,2;4,3|]; + eq __LOC__ (A.zipBy [|2;3;4;1|] [|1;2;3|] (-)) [|1;1;1|]; + eq __LOC__ (A.zipBy [|1;2;3|] [|2;3;4;1|] (-)) (A.map [|1;1;1|] (fun x -> -x)) + +let sumUsingForEach xs = + let v = ref 0 in + A.forEach xs (fun x -> v := !v + x) ; + !v + +let () = + eq __LOC__ (sumUsingForEach [|0;1;2;3;4|]) 10 ; + b __LOC__ ( not (A.every [|0;1;2;3;4|] (fun x -> x > 2))) + + + + + let id loc x = eq __LOC__ @@ -242,6 +276,13 @@ let () = eq __LOC__ (A.concatMany [|[|3;2|]; [|1;2;3|] |]) [|3;2;1;2;3|]; eq __LOC__ (A.concatMany [|[|3;2|]; [|1;2;3|];[||];[|0|] |]) [|3;2;1;2;3;0|]; eq __LOC__ (A.concatMany [| [||]; [|3;2|]; [|1;2;3|];[||];[|0|] |]) [|3;2;1;2;3;0|]; - eq __LOC__ (A.concatMany [| [||]; [||] |]) [||]; + eq __LOC__ (A.concatMany [| [||]; [||] |]) [||] + +let () = + b __LOC__ (A.cmp [|1;2;3|] [|0;1;2;3|] compare < 0) ; + b __LOC__ (A.cmp [|1;2;3|] [|0;1;2|] (fun x y -> compare x y) > 0); + b __LOC__ (A.cmp [|1;2;3|] [|1;2;3|] (fun x y -> compare x y) = 0); + b __LOC__ (A.cmp [|1;2;4|] [|1;2;3|] (fun x y -> compare x y) > 0); + ;; Mt.from_pair_suites __LOC__ !suites diff --git a/jscomp/test/bs_hashmap_test.js b/jscomp/test/bs_hashmap_test.js index e7c7a75c1a..dab57d3113 100644 --- a/jscomp/test/bs_hashmap_test.js +++ b/jscomp/test/bs_hashmap_test.js @@ -1,11 +1,11 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); var Hashtbl = require("../../lib/js/hashtbl.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_HashMap = require("../../lib/js/bs_HashMap.js"); -var Bs_SortArray = require("../../lib/js/bs_SortArray.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_HashMap = require("../../lib/js/belt_HashMap.js"); +var Belt_SortArray = require("../../lib/js/belt_SortArray.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); @@ -29,15 +29,15 @@ var hash = Hashtbl.hash; var cmp = Caml_primitive.caml_int_compare; -var Y = Bs_Id.hashable(hash, eq); +var Y = Belt_Id.hashable(hash, eq); -var empty = Bs_HashMap.make(30, Y); +var empty = Belt_HashMap.make(30, Y); function add(prim, prim$1) { return prim + prim$1 | 0; } -Bs_HashMap.mergeMany(empty, /* array */[ +Belt_HashMap.mergeMany(empty, /* array */[ /* tuple */[ 1, 1 @@ -56,42 +56,42 @@ Bs_HashMap.mergeMany(empty, /* array */[ ] ]); -eqx("File \"bs_hashmap_test.ml\", line 31, characters 6-13", Bs_HashMap.get(empty, 2), /* Some */[2]); +eqx("File \"bs_hashmap_test.ml\", line 31, characters 6-13", Belt_HashMap.get(empty, 2), /* Some */[2]); eqx("File \"bs_hashmap_test.ml\", line 32, characters 6-13", empty.size, 3); -var u = Bs_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); +var u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); -var v = Bs_Array.zip(u, u); +var v = Belt_Array.zip(u, u); -var xx = Bs_HashMap.ofArray(v, Y); +var xx = Belt_HashMap.ofArray(v, Y); eqx("File \"bs_hashmap_test.ml\", line 41, characters 6-13", xx.size, 91); -eqx("File \"bs_hashmap_test.ml\", line 42, characters 6-13", Bs_SortArray.stableSortBy(Bs_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); +eqx("File \"bs_hashmap_test.ml\", line 42, characters 6-13", Belt_SortArray.stableSortBy(Belt_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); -var u$1 = Bs_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); +var u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); -var v$1 = Bs_HashMap.make(40, Y); +var v$1 = Belt_HashMap.make(40, Y); -Bs_HashMap.mergeMany(v$1, Bs_Array.zip(u$1, u$1)); +Belt_HashMap.mergeMany(v$1, Belt_Array.zip(u$1, u$1)); eqx("File \"bs_hashmap_test.ml\", line 48, characters 6-13", v$1.size, 100001); for(var i = 0; i <= 1000; ++i){ - Bs_HashMap.remove(v$1, i); + Belt_HashMap.remove(v$1, i); } eqx("File \"bs_hashmap_test.ml\", line 52, characters 6-13", v$1.size, 99000); for(var i$1 = 0; i$1 <= 2000; ++i$1){ - Bs_HashMap.remove(v$1, i$1); + Belt_HashMap.remove(v$1, i$1); } eqx("File \"bs_hashmap_test.ml\", line 56, characters 6-13", v$1.size, 98000); -b("File \"bs_hashmap_test.ml\", line 57, characters 4-11", Bs_Array.every(Array_data_util.range(2001, 100000), (function (x) { - return Bs_HashMap.has(v$1, x); +b("File \"bs_hashmap_test.ml\", line 57, characters 4-11", Belt_Array.every(Array_data_util.range(2001, 100000), (function (x) { + return Belt_HashMap.has(v$1, x); }))); Mt.from_pair_suites("bs_hashmap_test.ml", suites[0]); @@ -102,7 +102,7 @@ var S = 0; var I = 0; -var $plus$plus = Bs_Array.concat; +var $plus$plus = Belt_Array.concat; var A = 0; diff --git a/jscomp/test/bs_hashmap_test.ml b/jscomp/test/bs_hashmap_test.ml index e3946d3084..7752e5c7b9 100644 --- a/jscomp/test/bs_hashmap_test.ml +++ b/jscomp/test/bs_hashmap_test.ml @@ -2,8 +2,8 @@ let suites : Mt.pair_suites ref = ref [] let test_id = ref 0 let eqx loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x -module N = Bs.HashMap -module S = Bs.Map.Int +module N = Belt.HashMap +module S = Belt.Map.Int (* module Y = struct type t = int @@ -11,8 +11,8 @@ module S = Bs.Map.Int let eq = fun (x : int) y -> x = y let hash = fun (x : int) -> Hashtbl.hash x let cmp = fun (x : int) y -> compare x y -module Y = (val Bs.Id.hashable ~eq ~hash) -let empty : (int, int, _) N.t = N.make ~dict:(module Y) 30 +module Y = (val Belt.Id.hashable ~eq ~hash) +let empty : (int, int, _) N.t = N.make ~id:(module Y) ~hintSize:30 (* [%bs.hash { @@ -22,7 +22,7 @@ let empty : (int, int, _) N.t = N.make ~dict:(module Y) 30 *) module I = Array_data_util -let (++) = Bs.Array.concat +let (++) = Belt.Array.concat let add = (+) @@ -31,19 +31,19 @@ let () = eqx __LOC__ (N.get empty 2) (Some 2); eqx __LOC__ (N.size empty) 3 -module A = Bs.Array -module So = Bs.SortArray +module A = Belt.Array +module So = Belt.SortArray let () = let u = I.randomRange 30 100 ++ I.randomRange 40 120 in let v = A.zip u u in - let xx = N.ofArray ~dict:(module Y) v in + let xx = N.ofArray ~id:(module Y) v in eqx __LOC__ (N.size xx) 91; eqx __LOC__ (So.stableSortBy (N.keysToArray xx) cmp) (I.range 30 120) let () = let u = I.randomRange 0 100_000 ++ I.randomRange 0 100 in - let v = N.make ~dict:(module Y) 40 in + let v = N.make ~id:(module Y) ~hintSize:40 in N.mergeMany v (A.zip u u); eqx __LOC__ (N.size v) 100_001; for i = 0 to 1_000 do @@ -56,4 +56,4 @@ let () = eqx __LOC__ (N.size v) 98_000; b __LOC__ (A.every (I.range 2_001 100_000) (fun x -> N.has v x )) -;; Mt.from_pair_suites __FILE__ !suites \ No newline at end of file +;; Mt.from_pair_suites __FILE__ !suites diff --git a/jscomp/test/bs_hashset_int_test.js b/jscomp/test/bs_hashset_int_test.js index 2e5a69ca4e..f6a19e08cc 100644 --- a/jscomp/test/bs_hashset_int_test.js +++ b/jscomp/test/bs_hashset_int_test.js @@ -1,12 +1,12 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_SetInt = require("../../lib/js/bs_SetInt.js"); -var Bs_HashSetInt = require("../../lib/js/bs_HashSetInt.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_SetInt = require("../../lib/js/belt_SetInt.js"); var Array_data_util = require("./array_data_util.js"); -var Bs_SortArrayInt = require("../../lib/js/bs_SortArrayInt.js"); -var Bs_internalBucketsType = require("../../lib/js/bs_internalBucketsType.js"); +var Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); +var Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); +var Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); var suites = [/* [] */0]; @@ -26,74 +26,74 @@ function add(x, y) { function sum2(h) { var v = [0]; - Bs_HashSetInt.forEach(h, (function (x) { + Belt_HashSetInt.forEach(h, (function (x) { v[0] = v[0] + x | 0; return /* () */0; })); return v[0]; } -var u = Bs_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); +var u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); -var v = Bs_HashSetInt.ofArray(u); +var v = Belt_HashSetInt.ofArray(u); eq("File \"bs_hashset_int_test.ml\", line 19, characters 5-12", v.size, 91); -var xs = Bs_SetInt.toArray(Bs_SetInt.ofArray(Bs_HashSetInt.toArray(v))); +var xs = Belt_SetInt.toArray(Belt_SetInt.ofArray(Belt_HashSetInt.toArray(v))); eq("File \"bs_hashset_int_test.ml\", line 21, characters 5-12", xs, Array_data_util.range(30, 120)); -eq("File \"bs_hashset_int_test.ml\", line 23, characters 5-12", Bs_HashSetInt.reduce(v, 0, add), 6825); +eq("File \"bs_hashset_int_test.ml\", line 23, characters 5-12", Belt_HashSetInt.reduce(v, 0, add), 6825); eq("File \"bs_hashset_int_test.ml\", line 24, characters 5-12", sum2(v), 6825); -var u$1 = Bs_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); +var u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); -var v$1 = Bs_internalBucketsType.make(/* () */0, /* () */0, 40); +var v$1 = Belt_internalBucketsType.make(/* () */0, /* () */0, 40); -Bs_HashSetInt.mergeMany(v$1, u$1); +Belt_HashSetInt.mergeMany(v$1, u$1); eq("File \"bs_hashset_int_test.ml\", line 30, characters 5-12", v$1.size, 100001); for(var i = 0; i <= 1000; ++i){ - Bs_HashSetInt.remove(v$1, i); + Belt_HashSetInt.remove(v$1, i); } eq("File \"bs_hashset_int_test.ml\", line 34, characters 5-12", v$1.size, 99000); for(var i$1 = 0; i$1 <= 2000; ++i$1){ - Bs_HashSetInt.remove(v$1, i$1); + Belt_HashSetInt.remove(v$1, i$1); } eq("File \"bs_hashset_int_test.ml\", line 38, characters 5-12", v$1.size, 98000); -var u0 = Bs_HashSetInt.ofArray(Array_data_util.randomRange(0, 100000)); +var u0 = Belt_HashSetInt.ofArray(Array_data_util.randomRange(0, 100000)); -var u1 = Bs_HashSetInt.copy(u0); +var u1 = Belt_HashSetInt.copy(u0); -eq("File \"bs_hashset_int_test.ml\", line 46, characters 5-12", Bs_HashSetInt.toArray(u0), Bs_HashSetInt.toArray(u1)); +eq("File \"bs_hashset_int_test.ml\", line 46, characters 5-12", Belt_HashSetInt.toArray(u0), Belt_HashSetInt.toArray(u1)); for(var i$2 = 0; i$2 <= 2000; ++i$2){ - Bs_HashSetInt.remove(u1, i$2); + Belt_HashSetInt.remove(u1, i$2); } for(var i$3 = 0; i$3 <= 1000; ++i$3){ - Bs_HashSetInt.remove(u0, i$3); + Belt_HashSetInt.remove(u0, i$3); } -var v0 = Bs_Array.concat(Array_data_util.range(0, 1000), Bs_HashSetInt.toArray(u0)); +var v0 = Belt_Array.concat(Array_data_util.range(0, 1000), Belt_HashSetInt.toArray(u0)); -var v1 = Bs_Array.concat(Array_data_util.range(0, 2000), Bs_HashSetInt.toArray(u1)); +var v1 = Belt_Array.concat(Array_data_util.range(0, 2000), Belt_HashSetInt.toArray(u1)); -Bs_SortArrayInt.stableSortInPlace(v0); +Belt_SortArrayInt.stableSortInPlace(v0); -Bs_SortArrayInt.stableSortInPlace(v1); +Belt_SortArrayInt.stableSortInPlace(v1); eq("File \"bs_hashset_int_test.ml\", line 57, characters 5-12", v0, v1); -var h = Bs_HashSetInt.ofArray(Array_data_util.randomRange(0, 1000000)); +var h = Belt_HashSetInt.ofArray(Array_data_util.randomRange(0, 1000000)); -var histo = Bs_HashSetInt.getBucketHistogram(h); +var histo = Belt_HashSetInt.getBucketHistogram(h); b("File \"bs_hashset_int_test.ml\", line 62, characters 4-11", +(histo.length <= 10)); @@ -105,7 +105,7 @@ var S = 0; var I = 0; -var $plus$plus = Bs_Array.concat; +var $plus$plus = Belt_Array.concat; var A = 0; diff --git a/jscomp/test/bs_hashset_int_test.ml b/jscomp/test/bs_hashset_int_test.ml index c92b20e1b2..ff8643939d 100644 --- a/jscomp/test/bs_hashset_int_test.ml +++ b/jscomp/test/bs_hashset_int_test.ml @@ -2,11 +2,11 @@ let suites : Mt.pair_suites ref = ref [] let test_id = ref 0 let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x -module N = Bs.HashSet.Int -module S = Bs.Set.Int +module N = Belt.HashSet.Int +module S = Belt.Set.Int module I = Array_data_util -let (++) = Bs.Array.concat +let (++) = Belt.Array.concat let add = fun x y -> x + y let sum2 h = @@ -36,9 +36,9 @@ let () = N.remove v i done ; eq __LOC__ (N.size v ) 98_000 -module A = Bs_Array +module A = Belt.Array -module SI = Bs.SortArray.Int +module SI = Belt.SortArray.Int let () = let u0 = N.ofArray (I.randomRange 0 100_000) in diff --git a/jscomp/test/bs_hashtbl_string_test.js b/jscomp/test/bs_hashtbl_string_test.js index 30697eecc7..324a715236 100644 --- a/jscomp/test/bs_hashtbl_string_test.js +++ b/jscomp/test/bs_hashtbl_string_test.js @@ -1,16 +1,16 @@ 'use strict'; -var Bs_Id = require("../../lib/js/bs_Id.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); var Hashtbl = require("../../lib/js/hashtbl.js"); var Caml_hash = require("../../lib/js/caml_hash.js"); -var Bs_HashMap = require("../../lib/js/bs_HashMap.js"); -var Bs_MapDict = require("../../lib/js/bs_MapDict.js"); -var Bs_HashMapInt = require("../../lib/js/bs_HashMapInt.js"); -var Bs_HashSetInt = require("../../lib/js/bs_HashSetInt.js"); +var Belt_HashMap = require("../../lib/js/belt_HashMap.js"); +var Belt_MapDict = require("../../lib/js/belt_MapDict.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); -var Bs_HashMapString = require("../../lib/js/bs_HashMapString.js"); -var Bs_internalBucketsType = require("../../lib/js/bs_internalBucketsType.js"); +var Belt_HashMapInt = require("../../lib/js/belt_HashMapInt.js"); +var Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); +var Belt_HashMapString = require("../../lib/js/belt_HashMapString.js"); var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js"); +var Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); function hash_string(s) { return Caml_hash.caml_hash_final_mix(Caml_hash.caml_hash_mix_string(0, s)); @@ -27,32 +27,32 @@ var hashString = (function (str) { } ); -var $$String = Bs_Id.hashable(Hashtbl.hash, (function (x, y) { +var $$String = Belt_Id.hashable(Hashtbl.hash, (function (x, y) { return +(x === y); })); -var String1 = Bs_Id.hashable(hashString, (function (x, y) { +var String1 = Belt_Id.hashable(hashString, (function (x, y) { return +(x === y); })); -var String2 = Bs_Id.hashable((function (x) { +var String2 = Belt_Id.hashable((function (x) { return Caml_hash.caml_hash_final_mix(Caml_hash.caml_hash_mix_string(0, x)); }), (function (x, y) { return +(x === y); })); -var Int = Bs_Id.hashable(Hashtbl.hash, (function (x, y) { +var Int = Belt_Id.hashable(Hashtbl.hash, (function (x, y) { return +(x === y); })); -var empty = Bs_HashMap.make(500000, Int); +var empty = Belt_HashMap.make(500000, Int); function bench() { for(var i = 0; i <= 1000000; ++i){ - Bs_HashMap.set(empty, i, i); + Belt_HashMap.set(empty, i, i); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashMap.has(empty, i$1)) { + if (!Belt_HashMap.has(empty, i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -64,16 +64,16 @@ function bench() { } } - return Bs_HashMap.logStats(empty); + return Belt_HashMap.logStats(empty); } function bench2(m) { - var empty = Bs_HashMap.make(1000000, m); + var empty = Belt_HashMap.make(1000000, m); for(var i = 0; i <= 1000000; ++i){ - Bs_HashMap.set(empty, "" + i, i); + Belt_HashMap.set(empty, "" + i, i); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashMap.has(empty, "" + i$1)) { + if (!Belt_HashMap.has(empty, "" + i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -86,7 +86,7 @@ function bench2(m) { } for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - Bs_HashMap.remove(empty, "" + i$2); + Belt_HashMap.remove(empty, "" + i$2); } if (empty.size) { throw [ @@ -105,15 +105,15 @@ function bench2(m) { function bench3(m) { var empty = { cmp: m[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; var cmp = m[/* cmp */0]; var table = empty.data; for(var i = 0; i <= 1000000; ++i){ - table = Bs_MapDict.set(table, "" + i, i, cmp); + table = Belt_MapDict.set(table, "" + i, i, cmp); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_MapDict.has(table, "" + i$1, cmp)) { + if (!Belt_MapDict.has(table, "" + i$1, cmp)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -126,9 +126,9 @@ function bench3(m) { } for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - table = Bs_MapDict.remove(table, "" + i$2, cmp); + table = Belt_MapDict.remove(table, "" + i$2, cmp); } - if (Bs_MapDict.size(table)) { + if (Belt_MapDict.size(table)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -142,15 +142,15 @@ function bench3(m) { } } -var Sx = Bs_Id.comparable(Caml_primitive.caml_string_compare); +var Sx = Belt_Id.comparable(Caml_primitive.caml_string_compare); function bench4() { - var table = Bs_internalBucketsType.make(/* () */0, /* () */0, 1000000); + var table = Belt_internalBucketsType.make(/* () */0, /* () */0, 1000000); for(var i = 0; i <= 1000000; ++i){ - Bs_HashMapString.set(table, "" + i, i); + Belt_HashMapString.set(table, "" + i, i); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashMapString.has(table, "" + i$1)) { + if (!Belt_HashMapString.has(table, "" + i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -163,9 +163,9 @@ function bench4() { } for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - Bs_HashMapString.remove(table, "" + i$2); + Belt_HashMapString.remove(table, "" + i$2); } - if (Bs_HashMapString.isEmpty(table)) { + if (Belt_HashMapString.isEmpty(table)) { return 0; } else { throw [ @@ -180,15 +180,15 @@ function bench4() { } function bench5() { - var table = Bs_HashMap.make(1000000, Int); + var table = Belt_HashMap.make(1000000, Int); console.time("bs_hashtbl_string_test.ml 133"); for(var i = 0; i <= 1000000; ++i){ - Bs_HashMap.set(table, i, i); + Belt_HashMap.set(table, i, i); } console.timeEnd("bs_hashtbl_string_test.ml 133"); console.time("bs_hashtbl_string_test.ml 137"); for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashMap.has(table, i$1)) { + if (!Belt_HashMap.has(table, i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -203,10 +203,10 @@ function bench5() { console.timeEnd("bs_hashtbl_string_test.ml 137"); console.time("bs_hashtbl_string_test.ml 141"); for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - Bs_HashMap.remove(table, i$2); + Belt_HashMap.remove(table, i$2); } console.timeEnd("bs_hashtbl_string_test.ml 141"); - if (Bs_HashMap.isEmpty(table)) { + if (Belt_HashMap.isEmpty(table)) { return 0; } else { throw [ @@ -221,12 +221,12 @@ function bench5() { } function bench6() { - var table = Bs_internalBucketsType.make(/* () */0, /* () */0, 1000000); + var table = Belt_internalBucketsType.make(/* () */0, /* () */0, 1000000); for(var i = 0; i <= 1000000; ++i){ - Bs_HashMapInt.set(table, i, i); + Belt_HashMapInt.set(table, i, i); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashMapInt.has(table, i$1)) { + if (!Belt_HashMapInt.has(table, i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -239,7 +239,7 @@ function bench6() { } for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - Bs_HashMapInt.remove(table, i$2); + Belt_HashMapInt.remove(table, i$2); } if (table.size) { throw [ @@ -256,13 +256,13 @@ function bench6() { } function bench7() { - var size = 2000000; - var table = Bs_internalBucketsType.make(/* () */0, /* () */0, size); + var hintSize = 2000000; + var table = Belt_internalBucketsType.make(/* () */0, /* () */0, hintSize); for(var i = 0; i <= 1000000; ++i){ - Bs_HashSetInt.add(table, i); + Belt_HashSetInt.add(table, i); } for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_HashSetInt.has(table, i$1)) { + if (!Belt_HashSetInt.has(table, i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -275,7 +275,7 @@ function bench7() { } for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - Bs_HashSetInt.remove(table, i$2); + Belt_HashSetInt.remove(table, i$2); } if (table.size) { throw [ diff --git a/jscomp/test/bs_hashtbl_string_test.ml b/jscomp/test/bs_hashtbl_string_test.ml index dd47575731..1efcc58b96 100644 --- a/jscomp/test/bs_hashtbl_string_test.ml +++ b/jscomp/test/bs_hashtbl_string_test.ml @@ -18,26 +18,26 @@ let hashString : string -> int = [%raw{|function (str) { |}] module String = - (val Bs.Id.hashable + (val Belt.Id.hashable ~eq:(fun (x:string) y -> x = y ) ~hash:Hashtbl.hash) module String1 = - (val Bs.Id.hashable + (val Belt.Id.hashable ~eq:(fun (x:string) y -> x = y ) ~hash:hashString) module String2 = - (val Bs.Id.hashable + (val Belt.Id.hashable ~eq:(fun (x:string) y -> x = y ) ~hash:(fun (x:string) -> hash_string x)) module Int = - (val Bs.Id.hashable + (val Belt.Id.hashable ~eq:(fun (x:int) y -> x = y ) ~hash:Hashtbl.hash) -module N = Bs.HashMap +module N = Belt.HashMap let empty = - N.make ~dict:(module Int) 500_000 + N.make ~id:(module Int) ~hintSize:500_000 let bench() = let count = 1_000_000 in @@ -54,16 +54,16 @@ let bench() = let count = 1_000_000 let initial_size = 1_000_000 -(* module B = Bs.Bag *) +(* module B = Belt.Bag *) (* - (empty : _ Bs.HashMap.t) + (empty : _ Belt.HashMap.t) #.add (string_of_int i) i #.add (string_of_int i) i *) -module M = Bs.HashMap -let bench2 (type t) (m : (string,t) Bs.Id.hashable) = +module M = Belt.HashMap +let bench2 (type t) (m : (string,t) Belt.Id.hashable) = let empty = - M.make ~dict:m initial_size in + M.make ~id:m ~hintSize:initial_size in let module String = (val m) in (* let hash = String.hash in let eq = String.eq in *) @@ -81,10 +81,10 @@ let bench2 (type t) (m : (string,t) Bs.Id.hashable) = done ; assert (M.size empty = 0) -(* Bs.HashMap.logStats empty *) -module Md = Bs.Map -module Md0 = Bs.Map.Dict -let bench3 (type t) (m : (string,t) Bs.Id.comparable) = +(* Belt.HashMap.logStats empty *) +module Md = Belt.Map +module Md0 = Belt.Map.Dict +let bench3 (type t) (m : (string,t) Belt.Id.comparable) = let empty = Md.make m in let module String = (val m) in @@ -104,8 +104,8 @@ let bench3 (type t) (m : (string,t) Bs.Id.comparable) = done ; assert (Md0.size !table = 0) -module Sx = (val Bs.Id.comparable ~cmp:(fun (x : string) y -> compare x y )) -module H = Bs.HashMap.String +module Sx = (val Belt.Id.comparable ~cmp:(fun (x : string) y -> compare x y )) +module H = Belt.HashMap.String let bench4 () = let table = H.make initial_size in @@ -123,10 +123,10 @@ let bench4 () = done ; assert (H.isEmpty table) -module H0 = Bs.HashMap +module H0 = Belt.HashMap let bench5 () = let table = - H0.make ~dict:(module Int) initial_size in + H0.make ~id:(module Int) ~hintSize:initial_size in (* let table_data = M.getData table in *) (* let hash = Int.hash in let eq = Int.eq in *) @@ -143,7 +143,7 @@ let bench5 () = done ]; assert (H0.isEmpty table) -module HI = Bs.HashMap.Int +module HI = Belt.HashMap.Int let bench6 () = let table = HI.make initial_size in @@ -161,7 +161,7 @@ let bench6 () = done ; assert (HI.size table = 0) -module S = Bs.HashSet.Int +module S = Belt.HashSet.Int let bench7 () = let table = (* [%time *) @@ -205,4 +205,4 @@ let bench7 () = ;; [%time bench7 ()] ;; [%time bench7 ()] ;; [%time bench7 ()] -;; [%time bench7 ()] *) \ No newline at end of file +;; [%time bench7 ()] *) diff --git a/jscomp/test/bs_list_test.js b/jscomp/test/bs_list_test.js index d36cbe208d..ff76976827 100644 --- a/jscomp/test/bs_list_test.js +++ b/jscomp/test/bs_list_test.js @@ -2,10 +2,11 @@ var Mt = require("./mt.js"); var Block = require("../../lib/js/block.js"); -var Bs_List = require("../../lib/js/bs_List.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); +var Belt_List = require("../../lib/js/belt_List.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); var Caml_int32 = require("../../lib/js/caml_int32.js"); +var Caml_primitive = require("../../lib/js/caml_primitive.js"); var suites = [/* [] */0]; @@ -44,7 +45,7 @@ function b(loc, x) { function sum(xs) { var v = [0]; - Bs_List.forEach(xs, (function (x) { + Belt_List.forEach(xs, (function (x) { v[0] = v[0] + x | 0; return /* () */0; })); @@ -53,26 +54,26 @@ function sum(xs) { function sum2(xs, ys) { var v = [0]; - Bs_List.forEach2(xs, ys, (function (x, y) { + Belt_List.forEach2(xs, ys, (function (x, y) { v[0] = (v[0] + x | 0) + y | 0; return /* () */0; })); return v[0]; } -var u = Bs_List.makeBy(5, (function (i) { +var u = Belt_List.makeBy(5, (function (i) { return Caml_int32.imul(i, i); })); function f(i) { - return eq("File \"bs_list_test.ml\", line 32, characters 7-14", Bs_List.getExn(u, i), Caml_int32.imul(i, i)); + return eq("File \"bs_list_test.ml\", line 32, characters 7-14", Belt_List.getExn(u, i), Caml_int32.imul(i, i)); } for(var i = 0; i <= 4; ++i){ f(i); } -eq("File \"bs_list_test.ml\", line 36, characters 5-12", Bs_List.map(u, (function (i) { +eq("File \"bs_list_test.ml\", line 36, characters 5-12", Belt_List.map(u, (function (i) { return i + 1 | 0; })), /* :: */[ 1, @@ -91,7 +92,23 @@ eq("File \"bs_list_test.ml\", line 36, characters 5-12", Bs_List.map(u, (functio ] ]); -eq("FLATTEN", Bs_List.flatten(/* :: */[ +eq("File \"bs_list_test.ml\", line 37, characters 5-12", Belt_List.getBy(/* :: */[ + 1, + /* :: */[ + 4, + /* :: */[ + 3, + /* :: */[ + 2, + /* [] */0 + ] + ] + ] + ], (function (x) { + return +(x % 2 === 0); + })), /* Some */[4]); + +eq("FLATTEN", Belt_List.flatten(/* :: */[ /* :: */[ 1, /* [] */0 @@ -109,7 +126,7 @@ eq("FLATTEN", Bs_List.flatten(/* :: */[ /* :: */[ /* [] */0, /* :: */[ - Bs_List.makeBy(4, (function (i) { + Belt_List.makeBy(4, (function (i) { return i; })), /* [] */0 @@ -140,9 +157,9 @@ eq("FLATTEN", Bs_List.flatten(/* :: */[ ] ]); -eq("FLATTEN", Bs_List.flatten(/* [] */0), /* [] */0); +eq("FLATTEN", Belt_List.flatten(/* [] */0), /* [] */0); -eq("FLATTEN", Bs_List.flatten(/* :: */[ +eq("FLATTEN", Belt_List.flatten(/* :: */[ /* [] */0, /* :: */[ /* [] */0, @@ -180,7 +197,7 @@ eq("FLATTEN", Bs_List.flatten(/* :: */[ ] ]); -eq("CONCATMANY", Bs_List.concatMany(/* array */[ +eq("CONCATMANY", Belt_List.concatMany(/* array */[ /* :: */[ 1, /* [] */0 @@ -194,7 +211,7 @@ eq("CONCATMANY", Bs_List.concatMany(/* array */[ /* [] */0 ], /* [] */0, - Bs_List.makeBy(4, (function (i) { + Belt_List.makeBy(4, (function (i) { return i; })) ]), /* :: */[ @@ -220,9 +237,9 @@ eq("CONCATMANY", Bs_List.concatMany(/* array */[ ] ]); -eq("CONCATMANY", Bs_List.concatMany(/* array */[]), /* [] */0); +eq("CONCATMANY", Belt_List.concatMany(/* array */[]), /* [] */0); -eq("CONCATMANY", Bs_List.concatMany(/* array */[ +eq("CONCATMANY", Belt_List.concatMany(/* array */[ /* [] */0, /* [] */0, /* :: */[ @@ -249,7 +266,7 @@ eq("CONCATMANY", Bs_List.concatMany(/* array */[ ] ]); -eq("CONCATMANY", Bs_List.concatMany(/* array */[ +eq("CONCATMANY", Belt_List.concatMany(/* array */[ /* [] */0, /* [] */0, /* :: */[ @@ -282,17 +299,37 @@ eq("CONCATMANY", Bs_List.concatMany(/* array */[ ] ]); -eq("File \"bs_list_test.ml\", line 61, characters 5-12", Bs_List.toArray(Bs_List.concat(Bs_List.makeBy(100, (function (i) { +eq("CONCATMANY", Belt_List.concatMany(/* array */[/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ]]), /* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ]); + +eq("File \"bs_list_test.ml\", line 62, characters 5-12", Belt_List.toArray(Belt_List.concat(Belt_List.makeBy(100, (function (i) { return i; - })), Bs_List.makeBy(100, (function (i) { + })), Belt_List.makeBy(100, (function (i) { return i; - })))), Bs_Array.concat(Bs_Array.makeBy(100, (function (i) { + })))), Belt_Array.concat(Belt_Array.makeBy(100, (function (i) { return i; - })), Bs_Array.makeBy(100, (function (i) { + })), Belt_Array.makeBy(100, (function (i) { return i; })))); -eq("APPEND", Bs_List.concat(/* :: */[ +eq("APPEND", Belt_List.concat(/* :: */[ 1, /* [] */0 ], /* [] */0), /* :: */[ @@ -300,7 +337,7 @@ eq("APPEND", Bs_List.concat(/* :: */[ /* [] */0 ]); -eq("APPEND", Bs_List.concat(/* [] */0, /* :: */[ +eq("APPEND", Belt_List.concat(/* [] */0, /* :: */[ 1, /* [] */0 ]), /* :: */[ @@ -308,7 +345,7 @@ eq("APPEND", Bs_List.concat(/* [] */0, /* :: */[ /* [] */0 ]); -eq("ZIP", Bs_List.zip(/* :: */[ +eq("ZIP", Belt_List.zip(/* :: */[ 1, /* :: */[ 2, @@ -337,14 +374,14 @@ eq("ZIP", Bs_List.zip(/* :: */[ ] ]); -eq("ZIP", Bs_List.zip(/* [] */0, /* :: */[ +eq("ZIP", Belt_List.zip(/* [] */0, /* :: */[ 1, /* [] */0 ]), /* [] */0); -eq("ZIP", Bs_List.zip(/* [] */0, /* [] */0), /* [] */0); +eq("ZIP", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); -eq("ZIP", Bs_List.zip(/* :: */[ +eq("ZIP", Belt_List.zip(/* :: */[ 1, /* :: */[ 2, @@ -355,7 +392,7 @@ eq("ZIP", Bs_List.zip(/* :: */[ ] ], /* [] */0), /* [] */0); -eq("ZIP", Bs_List.zip(/* :: */[ +eq("ZIP", Belt_List.zip(/* :: */[ 1, /* :: */[ 2, @@ -397,7 +434,7 @@ function mod2(x) { return +(x % 2 === 0); } -eq("PARTITION", Bs_List.partition(/* :: */[ +eq("PARTITION", Belt_List.partition(/* :: */[ 1, /* :: */[ 2, @@ -438,7 +475,7 @@ eq("PARTITION", Bs_List.partition(/* :: */[ ] ]); -eq("PARTITION", Bs_List.partition(/* :: */[ +eq("PARTITION", Belt_List.partition(/* :: */[ 2, /* :: */[ 2, @@ -467,7 +504,7 @@ eq("PARTITION", Bs_List.partition(/* :: */[ /* [] */0 ]); -eq("PARTITION", Bs_List.partition(/* :: */[ +eq("PARTITION", Belt_List.partition(/* :: */[ 2, /* :: */[ 2, @@ -498,17 +535,17 @@ eq("PARTITION", Bs_List.partition(/* :: */[ ] ]); -eq("PARTITION", Bs_List.partition(/* [] */0, mod2), /* tuple */[ +eq("PARTITION", Belt_List.partition(/* [] */0, mod2), /* tuple */[ /* [] */0, /* [] */0 ]); -eq("UNZIP", Bs_List.unzip(/* [] */0), /* tuple */[ +eq("UNZIP", Belt_List.unzip(/* [] */0), /* tuple */[ /* [] */0, /* [] */0 ]); -eq("UNZIP", Bs_List.unzip(/* :: */[ +eq("UNZIP", Belt_List.unzip(/* :: */[ /* tuple */[ 1, 2 @@ -525,7 +562,7 @@ eq("UNZIP", Bs_List.unzip(/* :: */[ ] ]); -eq("UNZIP", Bs_List.unzip(/* :: */[ +eq("UNZIP", Belt_List.unzip(/* :: */[ /* tuple */[ 1, 2 @@ -554,7 +591,7 @@ eq("UNZIP", Bs_List.unzip(/* :: */[ ] ]); -eq("FILTER", Bs_List.keep(/* :: */[ +eq("FILTER", Belt_List.keep(/* :: */[ 1, /* :: */[ 2, @@ -574,7 +611,7 @@ eq("FILTER", Bs_List.keep(/* :: */[ ] ]); -eq("FILTER", Bs_List.keep(/* :: */[ +eq("FILTER", Belt_List.keep(/* :: */[ 1, /* :: */[ 3, @@ -585,9 +622,9 @@ eq("FILTER", Bs_List.keep(/* :: */[ ] ], mod2), /* [] */0); -eq("FILTER", Bs_List.keep(/* [] */0, mod2), /* [] */0); +eq("FILTER", Belt_List.keep(/* [] */0, mod2), /* [] */0); -eq("FILTER", Bs_List.keep(/* :: */[ +eq("FILTER", Belt_List.keep(/* :: */[ 2, /* :: */[ 2, @@ -623,7 +660,7 @@ function id(x) { return x; } -eq("MAP", Bs_List.map(Bs_List.makeBy(5, id), (function (x) { +eq("MAP", Belt_List.map(Belt_List.makeBy(5, id), (function (x) { return (x << 1); })), /* :: */[ 0, @@ -642,9 +679,9 @@ eq("MAP", Bs_List.map(Bs_List.makeBy(5, id), (function (x) { ] ]); -eq("MAP", Bs_List.map(/* [] */0, id), /* [] */0); +eq("MAP", Belt_List.map(/* [] */0, id), /* [] */0); -eq("MAP", Bs_List.map(/* :: */[ +eq("MAP", Belt_List.map(/* :: */[ 1, /* [] */0 ], (function (x) { @@ -658,29 +695,29 @@ function add(a, b) { return a + b | 0; } -var length_10_id = Bs_List.makeBy(10, id); +var length_10_id = Belt_List.makeBy(10, id); -var length_8_id = Bs_List.makeBy(8, id); +var length_8_id = Belt_List.makeBy(8, id); -var d = Bs_List.makeBy(10, (function (x) { +var d = Belt_List.makeBy(10, (function (x) { return (x << 1); })); -eq("MAP2", Bs_List.zipBy(length_10_id, length_10_id, add), d); +eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), d); -eq("MAP2", Bs_List.zipBy(/* [] */0, /* :: */[ +eq("MAP2", Belt_List.zipBy(/* [] */0, /* :: */[ 1, /* [] */0 ], add), /* [] */0); -eq("MAP2", Bs_List.zipBy(/* :: */[ +eq("MAP2", Belt_List.zipBy(/* :: */[ 1, /* [] */0 ], /* [] */0, add), /* [] */0); -eq("MAP2", Bs_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); +eq("MAP2", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); -eq("MAP2", Bs_List.zipBy(length_10_id, length_10_id, add), Bs_List.concat(Bs_List.map(length_8_id, (function (x) { +eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), Belt_List.concat(Belt_List.map(length_8_id, (function (x) { return (x << 1); })), /* :: */[ 16, @@ -690,21 +727,21 @@ eq("MAP2", Bs_List.zipBy(length_10_id, length_10_id, add), Bs_List.concat(Bs_Lis ] ])); -eq("MAP2", Bs_List.zipBy(length_10_id, length_8_id, add), Bs_List.mapWithIndex(length_8_id, (function (i, x) { +eq("MAP2", Belt_List.zipBy(length_10_id, length_8_id, add), Belt_List.mapWithIndex(length_8_id, (function (i, x) { return i + x | 0; }))); -eq("MAP2", Bs_List.reverse(Bs_List.mapReverse2(length_10_id, length_10_id, add)), Bs_List.map(length_10_id, (function (x) { +eq("MAP2", Belt_List.reverse(Belt_List.mapReverse2(length_10_id, length_10_id, add)), Belt_List.map(length_10_id, (function (x) { return (x << 1); }))); -var xs = Bs_List.reverse(Bs_List.mapReverse2(length_8_id, length_10_id, add)); +var xs = Belt_List.reverse(Belt_List.mapReverse2(length_8_id, length_10_id, add)); -eq("File \"bs_list_test.ml\", line 138, characters 5-12", Bs_List.length(xs), 8); +eq("File \"bs_list_test.ml\", line 139, characters 5-12", Belt_List.length(xs), 8); -eq("MAP2", xs, Bs_List.zipBy(length_10_id, length_8_id, add)); +eq("MAP2", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); -eq("MAP2", Bs_List.mapReverse2(/* :: */[ +eq("MAP2", Belt_List.mapReverse2(/* :: */[ 1, /* :: */[ 2, @@ -729,7 +766,7 @@ eq("MAP2", Bs_List.mapReverse2(/* :: */[ ] ]); -eq("TAKE", Bs_List.take(/* :: */[ +eq("TAKE", Belt_List.take(/* :: */[ 1, /* :: */[ 2, @@ -746,9 +783,9 @@ eq("TAKE", Bs_List.take(/* :: */[ ] ]]); -eq("TAKE", Bs_List.take(/* [] */0, 1), /* None */0); +eq("TAKE", Belt_List.take(/* [] */0, 1), /* None */0); -eq("TAKE", Bs_List.take(/* :: */[ +eq("TAKE", Belt_List.take(/* :: */[ 1, /* :: */[ 2, @@ -756,7 +793,7 @@ eq("TAKE", Bs_List.take(/* :: */[ ] ], 3), /* None */0); -eq("TAKE", Bs_List.take(/* :: */[ +eq("TAKE", Belt_List.take(/* :: */[ 1, /* :: */[ 2, @@ -770,15 +807,15 @@ eq("TAKE", Bs_List.take(/* :: */[ ] ]]); -eq("TAKE", Bs_List.take(length_10_id, 8), /* Some */[length_8_id]); +eq("TAKE", Belt_List.take(length_10_id, 8), /* Some */[length_8_id]); -eq("TAKE", Bs_List.take(length_10_id, 0), /* Some */[/* [] */0]); +eq("TAKE", Belt_List.take(length_10_id, 0), /* Some */[/* [] */0]); -eq("TAKE", Bs_List.take(length_8_id, -2), /* None */0); +eq("TAKE", Belt_List.take(length_8_id, -2), /* None */0); -eq("DROP", Bs_List.drop(length_10_id, 10), /* Some */[/* [] */0]); +eq("DROP", Belt_List.drop(length_10_id, 10), /* Some */[/* [] */0]); -eq("DROP", Bs_List.drop(length_10_id, 8), /* Some */[/* :: */[ +eq("DROP", Belt_List.drop(length_10_id, 8), /* Some */[/* :: */[ 8, /* :: */[ 9, @@ -786,22 +823,22 @@ eq("DROP", Bs_List.drop(length_10_id, 8), /* Some */[/* :: */[ ] ]]); -eq("DROP", Bs_List.drop(length_10_id, 0), /* Some */[length_10_id]); +eq("DROP", Belt_List.drop(length_10_id, 0), /* Some */[length_10_id]); -eq("DROP", Bs_List.drop(length_8_id, -1), /* None */0); +eq("DROP", Belt_List.drop(length_8_id, -1), /* None */0); -var a = Bs_List.makeBy(5, id); +var a = Belt_List.makeBy(5, id); -eq("SPLIT", Bs_List.splitAt(/* [] */0, 1), /* None */0); +eq("SPLIT", Belt_List.splitAt(/* [] */0, 1), /* None */0); -eq("SPLIT", Bs_List.splitAt(a, 6), /* None */0); +eq("SPLIT", Belt_List.splitAt(a, 6), /* None */0); -eq("SPLIT", Bs_List.splitAt(a, 5), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 5), /* Some */[/* tuple */[ a, /* [] */0 ]]); -eq("SPLIT", Bs_List.splitAt(a, 4), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 4), /* Some */[/* tuple */[ /* :: */[ 0, /* :: */[ @@ -821,7 +858,7 @@ eq("SPLIT", Bs_List.splitAt(a, 4), /* Some */[/* tuple */[ ] ]]); -eq("SPLIT", Bs_List.splitAt(a, 3), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 3), /* Some */[/* tuple */[ /* :: */[ 0, /* :: */[ @@ -841,7 +878,7 @@ eq("SPLIT", Bs_List.splitAt(a, 3), /* Some */[/* tuple */[ ] ]]); -eq("SPLIT", Bs_List.splitAt(a, 2), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 2), /* Some */[/* tuple */[ /* :: */[ 0, /* :: */[ @@ -861,7 +898,7 @@ eq("SPLIT", Bs_List.splitAt(a, 2), /* Some */[/* tuple */[ ] ]]); -eq("SPLIT", Bs_List.splitAt(a, 1), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 1), /* Some */[/* tuple */[ /* :: */[ 0, /* [] */0 @@ -881,12 +918,12 @@ eq("SPLIT", Bs_List.splitAt(a, 1), /* Some */[/* tuple */[ ] ]]); -eq("SPLIT", Bs_List.splitAt(a, 0), /* Some */[/* tuple */[ +eq("SPLIT", Belt_List.splitAt(a, 0), /* Some */[/* tuple */[ /* [] */0, a ]]); -eq("SPLIT", Bs_List.splitAt(a, -1), /* None */0); +eq("SPLIT", Belt_List.splitAt(a, -1), /* None */0); function succx(x) { return x + 1 | 0; @@ -896,7 +933,7 @@ function eqx(x, y) { return +(x === y); } -b("File \"bs_list_test.ml\", line 176, characters 4-11", Bs_List.hasAssoc(/* :: */[ +b("File \"bs_list_test.ml\", line 177, characters 4-11", Belt_List.hasAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -916,7 +953,7 @@ b("File \"bs_list_test.ml\", line 176, characters 4-11", Bs_List.hasAssoc(/* :: ] ], 2, Caml_obj.caml_equal)); -b("File \"bs_list_test.ml\", line 177, characters 4-11", 1 - Bs_List.hasAssoc(/* :: */[ +b("File \"bs_list_test.ml\", line 178, characters 4-11", 1 - Belt_List.hasAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -936,7 +973,7 @@ b("File \"bs_list_test.ml\", line 177, characters 4-11", 1 - Bs_List.hasAssoc(/* ] ], 4, Caml_obj.caml_equal)); -b("File \"bs_list_test.ml\", line 178, characters 4-11", Bs_List.hasAssoc(/* :: */[ +b("File \"bs_list_test.ml\", line 179, characters 4-11", Belt_List.hasAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -958,7 +995,7 @@ b("File \"bs_list_test.ml\", line 178, characters 4-11", Bs_List.hasAssoc(/* :: return +((x + 1 | 0) === y); }))); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -990,7 +1027,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1022,7 +1059,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1054,7 +1091,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1092,7 +1129,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1124,7 +1161,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1156,7 +1193,7 @@ eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ ] ]); -eq("REMOVEASSOQ", Bs_List.removeAssoc(/* :: */[ +eq("REMOVEASSOQ", Belt_List.removeAssoc(/* :: */[ /* tuple */[ 1, "1" @@ -1208,13 +1245,13 @@ var ll = /* :: */[ ] ]; -var ll0 = Bs_List.removeAssoc(ll, 0, eqx); +var ll0 = Belt_List.removeAssoc(ll, 0, eqx); -b("File \"bs_list_test.ml\", line 189, characters 5-12", +(ll === ll0)); +b("File \"bs_list_test.ml\", line 190, characters 5-12", +(ll === ll0)); -var ll1 = Bs_List.setAssoc(ll, 2, "22", Caml_obj.caml_equal); +var ll1 = Belt_List.setAssoc(ll, 2, "22", Caml_obj.caml_equal); -eq("File \"bs_list_test.ml\", line 191, characters 5-12", ll1, /* :: */[ +eq("File \"bs_list_test.ml\", line 192, characters 5-12", ll1, /* :: */[ /* tuple */[ 1, "1" @@ -1234,9 +1271,9 @@ eq("File \"bs_list_test.ml\", line 191, characters 5-12", ll1, /* :: */[ ] ]); -var ll2 = Bs_List.setAssoc(ll1, 22, "2", Caml_obj.caml_equal); +var ll2 = Belt_List.setAssoc(ll1, 22, "2", Caml_obj.caml_equal); -b("File \"bs_list_test.ml\", line 193, characters 4-11", Caml_obj.caml_equal(ll2, /* :: */[ +b("File \"bs_list_test.ml\", line 194, characters 4-11", Caml_obj.caml_equal(ll2, /* :: */[ /* tuple */[ 22, "2" @@ -1244,9 +1281,9 @@ b("File \"bs_list_test.ml\", line 193, characters 4-11", Caml_obj.caml_equal(ll2 ll1 ])); -b("File \"bs_list_test.ml\", line 194, characters 4-11", +(Bs_List.tailExn(ll2) === ll1)); +b("File \"bs_list_test.ml\", line 195, characters 4-11", +(Belt_List.tailExn(ll2) === ll1)); -b("File \"bs_list_test.ml\", line 195, characters 4-11", Caml_obj.caml_equal(Bs_List.setAssoc(/* :: */[ +b("File \"bs_list_test.ml\", line 196, characters 4-11", Caml_obj.caml_equal(Belt_List.setAssoc(/* :: */[ /* tuple */[ 1, "a" @@ -1284,7 +1321,7 @@ b("File \"bs_list_test.ml\", line 195, characters 4-11", Caml_obj.caml_equal(Bs_ ] ])); -b("File \"bs_list_test.ml\", line 197, characters 4-11", Caml_obj.caml_equal(Bs_List.setAssoc(/* :: */[ +b("File \"bs_list_test.ml\", line 198, characters 4-11", Caml_obj.caml_equal(Belt_List.setAssoc(/* :: */[ /* tuple */[ 1, "a" @@ -1316,67 +1353,109 @@ b("File \"bs_list_test.ml\", line 197, characters 4-11", Caml_obj.caml_equal(Bs_ ] ])); -eq("File \"bs_list_test.ml\", line 202, characters 5-12", /* tuple */[ - Bs_List.head(length_10_id), - Bs_List.tail(length_10_id) +b("File \"bs_list_test.ml\", line 201, characters 4-11", Caml_obj.caml_equal(Belt_List.getAssoc(/* :: */[ + /* tuple */[ + 1, + "a" + ], + /* :: */[ + /* tuple */[ + 2, + "b" + ], + /* :: */[ + /* tuple */[ + 3, + "c" + ], + /* [] */0 + ] + ] + ], 2, Caml_obj.caml_equal), /* Some */["b"])); + +eq("File \"bs_list_test.ml\", line 205, characters 5-12", /* tuple */[ + Belt_List.head(length_10_id), + Belt_List.tail(length_10_id) ], /* tuple */[ /* Some */[0], - Bs_List.drop(length_10_id, 1) + Belt_List.drop(length_10_id, 1) ]); -eq("File \"bs_list_test.ml\", line 203, characters 5-12", Bs_List.head(/* [] */0), /* None */0); +eq("File \"bs_list_test.ml\", line 206, characters 5-12", Belt_List.head(/* [] */0), /* None */0); -Bs_List.forEachWithIndex(length_10_id, (function (i, x) { - return eq("File \"bs_list_test.ml\", line 205, characters 9-16", Bs_List.get(length_10_id, i), /* Some */[x]); +Belt_List.forEachWithIndex(length_10_id, (function (i, x) { + return eq("File \"bs_list_test.ml\", line 208, characters 9-16", Belt_List.get(length_10_id, i), /* Some */[x]); })); -eq("File \"bs_list_test.ml\", line 206, characters 5-12", Bs_List.tail(/* [] */0), /* None */0); +eq("File \"bs_list_test.ml\", line 209, characters 5-12", Belt_List.tail(/* [] */0), /* None */0); -eq("File \"bs_list_test.ml\", line 207, characters 5-12", Bs_List.drop(/* [] */0, 3), /* None */0); +eq("File \"bs_list_test.ml\", line 210, characters 5-12", Belt_List.drop(/* [] */0, 3), /* None */0); -eq("File \"bs_list_test.ml\", line 208, characters 5-12", Bs_List.mapWithIndex(/* [] */0, (function (i, x) { +eq("File \"bs_list_test.ml\", line 211, characters 5-12", Belt_List.mapWithIndex(/* [] */0, (function (i, x) { return i + x | 0; })), /* [] */0); -eq("File \"bs_list_test.ml\", line 209, characters 5-12", Bs_List.get(length_10_id, -1), /* None */0); +eq("File \"bs_list_test.ml\", line 212, characters 5-12", Belt_List.get(length_10_id, -1), /* None */0); -eq("File \"bs_list_test.ml\", line 210, characters 5-12", Bs_List.get(length_10_id, 12), /* None */0); +eq("File \"bs_list_test.ml\", line 213, characters 5-12", Belt_List.get(length_10_id, 12), /* None */0); -eq("File \"bs_list_test.ml\", line 211, characters 5-12", sum(/* [] */0), 0); +eq("File \"bs_list_test.ml\", line 214, characters 5-12", sum(/* [] */0), 0); -eq("File \"bs_list_test.ml\", line 212, characters 5-12", sum(length_10_id), 45); +eq("File \"bs_list_test.ml\", line 215, characters 5-12", sum(length_10_id), 45); -eq("File \"bs_list_test.ml\", line 213, characters 5-12", Bs_List.makeBy(0, id), /* [] */0); +eq("File \"bs_list_test.ml\", line 216, characters 5-12", Belt_List.makeBy(0, id), /* [] */0); -eq("File \"bs_list_test.ml\", line 214, characters 5-12", Bs_List.reverse(Bs_List.reverse(length_10_id)), length_10_id); +eq("File \"bs_list_test.ml\", line 217, characters 5-12", Belt_List.reverse(Belt_List.reverse(length_10_id)), length_10_id); -eq("File \"bs_list_test.ml\", line 215, characters 5-12", Bs_List.reverse(Bs_List.reverse(length_8_id)), length_8_id); +eq("File \"bs_list_test.ml\", line 218, characters 5-12", Belt_List.reverse(Belt_List.reverse(length_8_id)), length_8_id); -eq("File \"bs_list_test.ml\", line 216, characters 5-12", Bs_List.reverse(/* [] */0), /* [] */0); +eq("File \"bs_list_test.ml\", line 219, characters 5-12", Belt_List.reverse(/* [] */0), /* [] */0); -eq("File \"bs_list_test.ml\", line 217, characters 5-12", Bs_List.reverse(Bs_List.mapReverse(length_10_id, succx)), Bs_List.map(length_10_id, succx)); +eq("File \"bs_list_test.ml\", line 220, characters 5-12", Belt_List.reverse(Belt_List.mapReverse(length_10_id, succx)), Belt_List.map(length_10_id, succx)); -eq("File \"bs_list_test.ml\", line 220, characters 5-12", Bs_List.reduce(length_10_id, 0, add), 45); +eq("File \"bs_list_test.ml\", line 223, characters 5-12", Belt_List.reduce(length_10_id, 0, add), 45); -eq("File \"bs_list_test.ml\", line 222, characters 5-12", Bs_List.reduceReverse(length_10_id, 0, add), 45); +eq("File \"bs_list_test.ml\", line 225, characters 5-12", Belt_List.reduceReverse(length_10_id, 0, add), 45); -eq("File \"bs_list_test.ml\", line 226, characters 5-12", sum2(length_10_id, length_10_id), 90); +eq("File \"bs_list_test.ml\", line 229, characters 5-12", sum2(length_10_id, length_10_id), 90); -eq("File \"bs_list_test.ml\", line 227, characters 5-12", sum2(length_8_id, length_10_id), 56); +eq("File \"bs_list_test.ml\", line 230, characters 5-12", sum2(length_8_id, length_10_id), 56); -eq("File \"bs_list_test.ml\", line 228, characters 5-12", Bs_List.reduce2(length_10_id, length_8_id, 0, (function (acc, x, y) { +eq("File \"bs_list_test.ml\", line 231, characters 5-12", Belt_List.reduce2(length_10_id, length_8_id, 0, (function (acc, x, y) { return (acc + x | 0) + y | 0; })), 56); -eq("File \"bs_list_test.ml\", line 230, characters 5-12", Bs_List.reduceReverse2(length_10_id, length_8_id, 0, (function (acc, x, y) { +eq("File \"bs_list_test.ml\", line 233, characters 5-12", Belt_List.reduce2(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], /* :: */[ + 2, + /* :: */[ + 4, + /* :: */[ + 6, + /* [] */0 + ] + ] + ], 0, (function (a, b, c) { + return (a + b | 0) + c | 0; + })), 18); + +eq("File \"bs_list_test.ml\", line 234, characters 5-12", Belt_List.reduceReverse2(length_10_id, length_8_id, 0, (function (acc, x, y) { return (acc + x | 0) + y | 0; })), 56); -eq("File \"bs_list_test.ml\", line 232, characters 5-12", Bs_List.reduceReverse2(length_10_id, length_10_id, 0, (function (acc, x, y) { +eq("File \"bs_list_test.ml\", line 236, characters 5-12", Belt_List.reduceReverse2(length_10_id, length_10_id, 0, (function (acc, x, y) { return (acc + x | 0) + y | 0; })), 90); -eq("File \"bs_list_test.ml\", line 234, characters 5-12", Bs_List.reduceReverse2(/* :: */[ +eq("File \"bs_list_test.ml\", line 238, characters 5-12", Belt_List.reduceReverse2(/* :: */[ 1, /* :: */[ 2, @@ -1395,7 +1474,7 @@ eq("File \"bs_list_test.ml\", line 234, characters 5-12", Bs_List.reduceReverse2 return (acc + x | 0) + y | 0; })), 6); -eq("File \"bs_list_test.ml\", line 235, characters 5-12", Bs_List.every(/* :: */[ +eq("File \"bs_list_test.ml\", line 239, characters 5-12", Belt_List.every(/* :: */[ 2, /* :: */[ 4, @@ -1406,14 +1485,14 @@ eq("File \"bs_list_test.ml\", line 235, characters 5-12", Bs_List.every(/* :: */ ] ], mod2), /* true */1); -eq("File \"bs_list_test.ml\", line 236, characters 5-12", Bs_List.every(/* :: */[ +eq("File \"bs_list_test.ml\", line 240, characters 5-12", Belt_List.every(/* :: */[ 1, /* [] */0 ], mod2), /* false */0); -eq("File \"bs_list_test.ml\", line 237, characters 5-12", Bs_List.every(/* [] */0, mod2), /* true */1); +eq("File \"bs_list_test.ml\", line 241, characters 5-12", Belt_List.every(/* [] */0, mod2), /* true */1); -eq("File \"bs_list_test.ml\", line 238, characters 5-12", Bs_List.some(/* :: */[ +eq("File \"bs_list_test.ml\", line 242, characters 5-12", Belt_List.some(/* :: */[ 1, /* :: */[ 2, @@ -1424,7 +1503,7 @@ eq("File \"bs_list_test.ml\", line 238, characters 5-12", Bs_List.some(/* :: */[ ] ], mod2), /* true */1); -eq("File \"bs_list_test.ml\", line 239, characters 5-12", Bs_List.some(/* :: */[ +eq("File \"bs_list_test.ml\", line 243, characters 5-12", Belt_List.some(/* :: */[ 1, /* :: */[ 3, @@ -1435,9 +1514,9 @@ eq("File \"bs_list_test.ml\", line 239, characters 5-12", Bs_List.some(/* :: */[ ] ], mod2), /* false */0); -eq("File \"bs_list_test.ml\", line 240, characters 5-12", Bs_List.some(/* [] */0, mod2), /* false */0); +eq("File \"bs_list_test.ml\", line 244, characters 5-12", Belt_List.some(/* [] */0, mod2), /* false */0); -eq("File \"bs_list_test.ml\", line 241, characters 5-12", Bs_List.has(/* :: */[ +eq("File \"bs_list_test.ml\", line 245, characters 5-12", Belt_List.has(/* :: */[ 1, /* :: */[ 2, @@ -1450,7 +1529,7 @@ eq("File \"bs_list_test.ml\", line 241, characters 5-12", Bs_List.has(/* :: */[ return +("" + x === s); })), /* true */1); -eq("File \"bs_list_test.ml\", line 242, characters 5-12", Bs_List.has(/* :: */[ +eq("File \"bs_list_test.ml\", line 246, characters 5-12", Belt_List.has(/* :: */[ 1, /* :: */[ 2, @@ -1463,14 +1542,149 @@ eq("File \"bs_list_test.ml\", line 242, characters 5-12", Bs_List.has(/* :: */[ return +("" + x === s); })), /* false */0); -eq("File \"bs_list_test.ml\", line 245, characters 5-12", Bs_List.every2(/* [] */0, /* :: */[ +b("File \"bs_list_test.ml\", line 248, characters 4-11", +(Belt_List.reduceReverse(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], 0, (function (prim, prim$1) { + return prim + prim$1 | 0; + })) === 10)); + +b("File \"bs_list_test.ml\", line 249, characters 4-11", +(Belt_List.reduceReverse(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], 10, (function (prim, prim$1) { + return prim - prim$1 | 0; + })) === 0)); + +b("File \"bs_list_test.ml\", line 250, characters 4-11", Caml_obj.caml_equal(Belt_List.reduceReverse(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], /* [] */0, Belt_List.add), /* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ])); + +b("File \"bs_list_test.ml\", line 251, characters 4-11", +(Belt_List.reduce(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], 0, (function (prim, prim$1) { + return prim + prim$1 | 0; + })) === 10)); + +b("File \"bs_list_test.ml\", line 252, characters 4-11", +(Belt_List.reduce(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], 10, (function (prim, prim$1) { + return prim - prim$1 | 0; + })) === 0)); + +b("File \"bs_list_test.ml\", line 253, characters 4-11", Caml_obj.caml_equal(Belt_List.reduce(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], /* [] */0, Belt_List.add), /* :: */[ + 4, + /* :: */[ + 3, + /* :: */[ + 2, + /* :: */[ + 1, + /* [] */0 + ] + ] + ] + ])); + +b("File \"bs_list_test.ml\", line 254, characters 4-11", +(Belt_List.reduceReverse2(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], /* :: */[ + 1, + /* :: */[ + 2, + /* [] */0 + ] + ], 0, (function (acc, x, y) { + return (acc + x | 0) + y | 0; + })) === 6)); + +eq("File \"bs_list_test.ml\", line 258, characters 5-12", Belt_List.every2(/* [] */0, /* :: */[ 1, /* [] */0 ], (function (x, y) { return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 246, characters 5-12", Bs_List.every2(/* :: */[ +eq("File \"bs_list_test.ml\", line 259, characters 5-12", Belt_List.every2(/* :: */[ 2, /* :: */[ 3, @@ -1483,7 +1697,7 @@ eq("File \"bs_list_test.ml\", line 246, characters 5-12", Bs_List.every2(/* :: * return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 247, characters 5-12", Bs_List.every2(/* :: */[ +eq("File \"bs_list_test.ml\", line 260, characters 5-12", Belt_List.every2(/* :: */[ 2, /* [] */0 ], /* :: */[ @@ -1493,7 +1707,7 @@ eq("File \"bs_list_test.ml\", line 247, characters 5-12", Bs_List.every2(/* :: * return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 248, characters 5-12", Bs_List.every2(/* :: */[ +eq("File \"bs_list_test.ml\", line 261, characters 5-12", Belt_List.every2(/* :: */[ 2, /* :: */[ 3, @@ -1509,7 +1723,7 @@ eq("File \"bs_list_test.ml\", line 248, characters 5-12", Bs_List.every2(/* :: * return +(x > y); })), /* false */0); -eq("File \"bs_list_test.ml\", line 249, characters 5-12", Bs_List.every2(/* :: */[ +eq("File \"bs_list_test.ml\", line 262, characters 5-12", Belt_List.every2(/* :: */[ 2, /* :: */[ 3, @@ -1525,14 +1739,14 @@ eq("File \"bs_list_test.ml\", line 249, characters 5-12", Bs_List.every2(/* :: * return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 250, characters 5-12", Bs_List.some2(/* [] */0, /* :: */[ +eq("File \"bs_list_test.ml\", line 263, characters 5-12", Belt_List.some2(/* [] */0, /* :: */[ 1, /* [] */0 ], (function (x, y) { return +(x > y); })), /* false */0); -eq("File \"bs_list_test.ml\", line 251, characters 5-12", Bs_List.some2(/* :: */[ +eq("File \"bs_list_test.ml\", line 264, characters 5-12", Belt_List.some2(/* :: */[ 2, /* :: */[ 3, @@ -1545,7 +1759,7 @@ eq("File \"bs_list_test.ml\", line 251, characters 5-12", Bs_List.some2(/* :: */ return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 252, characters 5-12", Bs_List.some2(/* :: */[ +eq("File \"bs_list_test.ml\", line 265, characters 5-12", Belt_List.some2(/* :: */[ 2, /* :: */[ 3, @@ -1561,7 +1775,7 @@ eq("File \"bs_list_test.ml\", line 252, characters 5-12", Bs_List.some2(/* :: */ return +(x > y); })), /* true */1); -eq("File \"bs_list_test.ml\", line 253, characters 5-12", Bs_List.some2(/* :: */[ +eq("File \"bs_list_test.ml\", line 266, characters 5-12", Belt_List.some2(/* :: */[ 0, /* :: */[ 3, @@ -1577,7 +1791,7 @@ eq("File \"bs_list_test.ml\", line 253, characters 5-12", Bs_List.some2(/* :: */ return +(x > y); })), /* false */0); -eq("File \"bs_list_test.ml\", line 254, characters 5-12", Bs_List.some2(/* :: */[ +eq("File \"bs_list_test.ml\", line 267, characters 5-12", Belt_List.some2(/* :: */[ 0, /* :: */[ 3, @@ -1594,11 +1808,94 @@ eq("File \"bs_list_test.ml\", line 254, characters 5-12", Bs_List.some2(/* :: */ })), /* true */1); function makeTest(n) { - return eq("File \"bs_list_test.ml\", line 257, characters 5-12", Bs_List.make(n, 3), Bs_List.makeBy(n, (function () { + return eq("File \"bs_list_test.ml\", line 270, characters 5-12", Belt_List.make(n, 3), Belt_List.makeBy(n, (function () { return 3; }))); } +b("File \"bs_list_test.ml\", line 275, characters 4-11", +(Belt_List.cmp(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], /* :: */[ + 0, + /* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ] + ], Caml_obj.caml_compare) > 0)); + +b("File \"bs_list_test.ml\", line 276, characters 4-11", +(Belt_List.cmp(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], /* :: */[ + 0, + /* :: */[ + 1, + /* :: */[ + 2, + /* [] */0 + ] + ] + ], Caml_primitive.caml_int_compare) > 0)); + +b("File \"bs_list_test.ml\", line 277, characters 4-11", +(Belt_List.cmp(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], /* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], Caml_primitive.caml_int_compare) === 0)); + +b("File \"bs_list_test.ml\", line 278, characters 4-11", +(Belt_List.cmp(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 4, + /* [] */0 + ] + ] + ], /* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* [] */0 + ] + ] + ], Caml_primitive.caml_int_compare) > 0)); + makeTest(0); makeTest(1); @@ -1607,7 +1904,7 @@ makeTest(2); makeTest(3); -b("File \"bs_list_test.ml\", line 266, characters 4-11", 1 - Bs_List.eq(/* :: */[ +b("File \"bs_list_test.ml\", line 287, characters 4-11", 1 - Belt_List.eq(/* :: */[ 1, /* :: */[ 2, @@ -1626,7 +1923,7 @@ b("File \"bs_list_test.ml\", line 266, characters 4-11", 1 - Bs_List.eq(/* :: */ return +(x === y); }))); -b("File \"bs_list_test.ml\", line 267, characters 4-11", Bs_List.eq(/* :: */[ +b("File \"bs_list_test.ml\", line 288, characters 4-11", Belt_List.eq(/* :: */[ 1, /* :: */[ 2, @@ -1648,7 +1945,7 @@ b("File \"bs_list_test.ml\", line 267, characters 4-11", Bs_List.eq(/* :: */[ return +(x === y); }))); -b("File \"bs_list_test.ml\", line 268, characters 4-11", 1 - Bs_List.eq(/* :: */[ +b("File \"bs_list_test.ml\", line 289, characters 4-11", 1 - Belt_List.eq(/* :: */[ 1, /* :: */[ 2, @@ -1670,11 +1967,11 @@ b("File \"bs_list_test.ml\", line 268, characters 4-11", 1 - Bs_List.eq(/* :: */ return +(x === y); }))); -var u0 = Bs_List.makeBy(20, (function (x) { +var u0 = Belt_List.makeBy(20, (function (x) { return x; })); -var u1 = Bs_List.keepMap(u0, (function (x) { +var u1 = Belt_List.keepMap(u0, (function (x) { if (x % 7) { return /* None */0; } else { @@ -1682,7 +1979,7 @@ var u1 = Bs_List.keepMap(u0, (function (x) { } })); -eq("File \"bs_list_test.ml\", line 272, characters 5-12", u1, /* :: */[ +eq("File \"bs_list_test.ml\", line 294, characters 5-12", u1, /* :: */[ 1, /* :: */[ 8, @@ -1693,6 +1990,32 @@ eq("File \"bs_list_test.ml\", line 272, characters 5-12", u1, /* :: */[ ] ]); +b("File \"bs_list_test.ml\", line 295, characters 4-11", Caml_obj.caml_equal(Belt_List.keepMap(/* :: */[ + 1, + /* :: */[ + 2, + /* :: */[ + 3, + /* :: */[ + 4, + /* [] */0 + ] + ] + ] + ], (function (x) { + if (x % 2) { + return /* None */0; + } else { + return /* Some */[-x | 0]; + } + })), /* :: */[ + -2, + /* :: */[ + -4, + /* [] */0 + ] + ])); + Mt.from_pair_suites("bs_list_test.ml", suites[0]); var N = 0; diff --git a/jscomp/test/bs_list_test.ml b/jscomp/test/bs_list_test.ml index 735e986eee..b4e433c867 100644 --- a/jscomp/test/bs_list_test.ml +++ b/jscomp/test/bs_list_test.ml @@ -11,9 +11,9 @@ let b loc x = (loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Ok x)) :: !suites -(* module N = Bs.LinkList *) -module N = Bs.List -module A = Bs.Array +(* module N = Belt.LinkList *) +module N = Belt.List +module A = Belt.Array module J = Js.Json let sum xs = let v = ref 0 in @@ -33,7 +33,8 @@ let () = for i = 0 to 4 do f i done ; - eq __LOC__ (N.map u (fun i -> i + 1)) [1;2;5;10;17] + eq __LOC__ (N.map u (fun i -> i + 1)) [1;2;5;10;17]; + eq __LOC__ (N.getBy [1;4;3;2] (fun x -> x mod 2 = 0)) (Some 4) let () = let (=~) = eq "FLATTEN" in @@ -54,8 +55,8 @@ let () = [1;2;3; 0;1;2;3]; N.concatMany [||] =~ []; N.concatMany [|[];[]; [2]; [1];[2];[]|] =~ [2;1;2]; - N.concatMany [|[];[]; [2;3]; [1];[2];[]|] =~ [2;3;1;2] - + N.concatMany [|[];[]; [2;3]; [1];[2];[]|] =~ [2;3;1;2]; + N.concatMany [| [1;2;3]|] =~ [1;2;3] let () = eq __LOC__ @@ -195,7 +196,9 @@ let () = b __LOC__ (N.setAssoc [1,"a"; 2, "b"; 3, "c"] 2 "x" (=) = [1,"a"; 2, "x"; 3,"c"]); b __LOC__ (N.setAssoc [1,"a"; 3, "c"] 2 "2" (=) = - [2,"2"; 1,"a"; 3, "c"]) + [2,"2"; 1,"a"; 3, "c"]); + + b __LOC__ (N.getAssoc [ 1, "a"; 2, "b"; 3, "c"] 2 (=) = Some "b") let () = @@ -227,6 +230,7 @@ let () = eq __LOC__ (sum2 length_8_id length_10_id) 56; eq __LOC__ (N.reduce2 length_10_id length_8_id 0 (fun acc x y -> acc + x + y)) 56; + eq __LOC__ (N.reduce2 [1;2;3] [2;4;6] 0 (fun a b c -> a + b + c) ) 18; eq __LOC__ (N.reduceReverse2 length_10_id length_8_id 0 (fun acc x y -> acc + x + y)) 56; eq __LOC__ (N.reduceReverse2 length_10_id length_10_id 0 @@ -239,7 +243,16 @@ let () = eq __LOC__ (N.some [1;3;5] mod2) false; eq __LOC__ (N.some [] mod2) false; eq __LOC__ (N.has [1;2;3] "2" (fun x s -> string_of_int x = s)) true; - eq __LOC__ (N.has [1;2;3] "0" (fun x s -> string_of_int x = s)) false + eq __LOC__ (N.has [1;2;3] "0" (fun x s -> string_of_int x = s)) false; + + b __LOC__ (N.reduceReverse [1;2;3;4] 0 (+) = 10); + b __LOC__ (N.reduceReverse [1;2;3;4] 10 (-) = 0); + b __LOC__ (N.reduceReverse [1;2;3;4] [] N.add = [1;2;3;4]); + b __LOC__ (N.reduce [1;2;3;4] 0 (+) = 10); + b __LOC__ (N.reduce [1;2;3;4] 10 (-) = 0); + b __LOC__ (N.reduce [1;2;3;4] [] N.add = [4;3;2;1]); + b __LOC__ + (N.reduceReverse2 [1;2;3] [1;2] 0 (fun acc x y -> acc + x + y) = 6) let () = eq __LOC__ (N.every2 [] [1] (fun x y -> x > y)) true; @@ -256,6 +269,14 @@ let () = let makeTest n = eq __LOC__ (N.make n 3) (N.makeBy n (fun _ -> 3)) + +let () = + let module A = N in + b __LOC__ (A.cmp [1;2;3] [0;1;2;3] compare > 0) ; + b __LOC__ (A.cmp [1;2;3] [0;1;2] (fun x y -> compare x y) > 0); + b __LOC__ (A.cmp [1;2;3] [1;2;3] (fun x y -> compare x y) = 0); + b __LOC__ (A.cmp [1;2;4] [1;2;3] (fun x y -> compare x y) > 0) + let () = makeTest 0; makeTest 1; @@ -268,7 +289,12 @@ let () = b __LOC__ (not @@ N.eq [1;2;3] [1;2;4] (fun x y -> x = y)) let () = let u0 = N.makeBy 20 (fun x -> x) in - let u1 = N.keepMap u0 (fun x -> if x mod 7 = 0 then Some (x+1) else None) in - eq __LOC__ u1 [1;8;15] + let u1 = N.keepMap u0 + (fun x -> if x mod 7 = 0 then Some (x+1) else None) in + eq __LOC__ u1 [1;8;15]; + b __LOC__ + N.( keepMap [1;2;3;4] (fun x -> if x mod 2 = 0 then Some (-x ) else None) + = + [-2;-4]) ;; Mt.from_pair_suites __FILE__ !suites diff --git a/jscomp/test/bs_map_set_dict_test.js b/jscomp/test/bs_map_set_dict_test.js index 3a6d91a752..c1db12ff67 100644 --- a/jscomp/test/bs_map_set_dict_test.js +++ b/jscomp/test/bs_map_set_dict_test.js @@ -1,13 +1,13 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); -var Bs_Map = require("../../lib/js/bs_Map.js"); -var Bs_List = require("../../lib/js/bs_List.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_MapInt = require("../../lib/js/bs_MapInt.js"); -var Bs_MapDict = require("../../lib/js/bs_MapDict.js"); -var Bs_SetDict = require("../../lib/js/bs_SetDict.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); +var Belt_Map = require("../../lib/js/belt_Map.js"); +var Belt_List = require("../../lib/js/belt_List.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_MapInt = require("../../lib/js/belt_MapInt.js"); +var Belt_MapDict = require("../../lib/js/belt_MapDict.js"); +var Belt_SetDict = require("../../lib/js/belt_SetDict.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); @@ -23,37 +23,37 @@ function b(loc, v) { return Mt.bool_suites(test_id, suites, loc, v); } -var Icmp = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var Icmp = Belt_Id.comparable(Caml_primitive.caml_int_compare); -var Icmp2 = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var Icmp2 = Belt_Id.comparable(Caml_primitive.caml_int_compare); var m0 = { cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; -var I2 = Bs_Id.comparable((function (x, y) { +var I2 = Belt_Id.comparable((function (x, y) { return Caml_primitive.caml_int_compare(y, x); })); var m = { cmp: Icmp2[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; var m2 = { cmp: I2[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; var data = m.data; -Bs_Map.getId(m2); +Belt_Map.getId(m2); -var m_dict = Bs_Map.getId(m); +var m_dict = Belt_Map.getId(m); for(var i = 0; i <= 100000; ++i){ - data = Bs_MapDict.set(data, i, i, m_dict[/* cmp */0]); + data = Belt_MapDict.set(data, i, i, m_dict[/* cmp */0]); } var data$1 = data; @@ -65,47 +65,47 @@ var newm = { console.log(newm); -var m11 = Bs_MapDict.set(Bs_MapDict.empty, 1, 1, Icmp[/* cmp */0]); +var m11 = Belt_MapDict.set(Belt_MapDict.empty, 1, 1, Icmp[/* cmp */0]); console.log(m11); var v = { cmp: Icmp2[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }; -var m_dict$1 = Bs_Map.getId(m); +var m_dict$1 = Belt_Map.getId(m); var cmp = m_dict$1[/* cmp */0]; var data$2 = v.data; for(var i$1 = 0; i$1 <= 100000; ++i$1){ - data$2 = Bs_SetDict.add(data$2, i$1, cmp); + data$2 = Belt_SetDict.add(data$2, i$1, cmp); } console.log(data$2); function f(param) { - return Bs_Map.ofArray(param, Icmp); + return Belt_Map.ofArray(param, Icmp); } function $eq$tilde(a, b) { return (function (param) { - return Bs_Map.eq(a, b, param); + return Belt_Map.eq(a, b, param); }); } -var u0 = f(Bs_Array.map(Array_data_util.randomRange(0, 39), (function (x) { +var u0 = f(Belt_Array.map(Array_data_util.randomRange(0, 39), (function (x) { return /* tuple */[ x, x ]; }))); -var u1 = Bs_Map.set(u0, 39, 120); +var u1 = Belt_Map.set(u0, 39, 120); -b("File \"bs_map_set_dict_test.ml\", line 77, characters 4-11", Bs_Array.every2(Bs_MapDict.toArray(u0.data), Bs_Array.map(Array_data_util.range(0, 39), (function (x) { +b("File \"bs_map_set_dict_test.ml\", line 77, characters 4-11", Belt_Array.every2(Belt_MapDict.toArray(u0.data), Belt_Array.map(Array_data_util.range(0, 39), (function (x) { return /* tuple */[ x, x @@ -118,7 +118,7 @@ b("File \"bs_map_set_dict_test.ml\", line 77, characters 4-11", Bs_Array.every2( } }))); -b("File \"bs_map_set_dict_test.ml\", line 82, characters 4-11", Bs_List.every2(Bs_MapDict.toList(u0.data), Bs_List.ofArray(Bs_Array.map(Array_data_util.range(0, 39), (function (x) { +b("File \"bs_map_set_dict_test.ml\", line 82, characters 4-11", Belt_List.every2(Belt_MapDict.toList(u0.data), Belt_List.ofArray(Belt_Array.map(Array_data_util.range(0, 39), (function (x) { return /* tuple */[ x, x @@ -131,23 +131,23 @@ b("File \"bs_map_set_dict_test.ml\", line 82, characters 4-11", Bs_List.every2(B } }))); -eq("File \"bs_map_set_dict_test.ml\", line 87, characters 5-12", Bs_Map.get(u0, 39), /* Some */[39]); +eq("File \"bs_map_set_dict_test.ml\", line 87, characters 5-12", Belt_Map.get(u0, 39), /* Some */[39]); -eq("File \"bs_map_set_dict_test.ml\", line 88, characters 5-12", Bs_Map.get(u1, 39), /* Some */[120]); +eq("File \"bs_map_set_dict_test.ml\", line 88, characters 5-12", Belt_Map.get(u1, 39), /* Some */[120]); -var u = f(Bs_Array.makeByAndShuffle(10000, (function (x) { +var u = f(Belt_Array.makeByAndShuffle(10000, (function (x) { return /* tuple */[ x, x ]; }))); -eq("File \"bs_map_set_dict_test.ml\", line 94, characters 4-11", Bs_Array.makeBy(10000, (function (x) { +eq("File \"bs_map_set_dict_test.ml\", line 94, characters 4-11", Belt_Array.makeBy(10000, (function (x) { return /* tuple */[ x, x ]; - })), Bs_MapDict.toArray(u.data)); + })), Belt_MapDict.toArray(u.data)); Mt.from_pair_suites("bs_map_set_dict_test.ml", suites[0]); @@ -161,9 +161,9 @@ var A = 0; var L = 0; -var vv = Bs_MapInt.empty; +var vv = Belt_MapInt.empty; -var vv2 = Bs_MapInt.empty; +var vv2 = Belt_MapInt.empty; var Md0 = 0; diff --git a/jscomp/test/bs_map_set_dict_test.ml b/jscomp/test/bs_map_set_dict_test.ml index dbac0d45c1..fc74e1328a 100644 --- a/jscomp/test/bs_map_set_dict_test.ml +++ b/jscomp/test/bs_map_set_dict_test.ml @@ -4,33 +4,33 @@ let eq loc x y = Mt.eq_suites ~suites ~test_id loc x y let b loc v = Mt.bool_suites ~suites ~test_id loc v module Icmp = - (val Bs.Id.comparable + (val Belt.Id.comparable ~cmp:(fun (x : int) y -> compare x y ) ) module Icmp2 = -(val Bs.Id.comparable ~cmp:(fun (x : int) y -> +(val Belt.Id.comparable ~cmp:(fun (x : int) y -> compare x y )) -module M = Bs.Map -module MI = Bs.Map.Int -(* module B = Bs.Bag *) +module M = Belt.Map +module MI = Belt.Map.Int +(* module B = Belt.Bag *) module I = Array_data_util -module A = Bs_Array -module L = Bs.List +module A = Belt.Array +module L = Belt.List let m0 : (_,string,_) M.t = M.make (module Icmp) module I2 = -(val Bs.Id.comparable ~cmp:(fun (x : int) y -> compare y x )) +(val Belt.Id.comparable ~cmp:(fun (x : int) y -> compare y x )) let m = M.make (module Icmp2) let m2 : (int, string, _) M.t = M.make (module I2) let vv = MI.empty let vv2 = MI.empty -module Md0 = Bs.Map.Dict +module Md0 = Belt.Map.Dict let () = let count = 1_000_00 in let data = ref (M.getData m) in @@ -45,7 +45,7 @@ let () = done ; let newm = M.packIdData ~data:!data ~id:m_dict in Js.log newm -module ISet = Bs.Set +module ISet = Belt.Set let () = let m = Md0.empty in let m11 = @@ -55,7 +55,7 @@ let () = let _m20 = M.make (module Icmp) in Js.log m11 -module S0 = Bs.Set.Dict +module S0 = Belt.Set.Dict let () = let count = 100_000 in let v = ISet.make (module Icmp2) in diff --git a/jscomp/test/bs_map_test.js b/jscomp/test/bs_map_test.js index 8980f0bb3d..17b3966641 100644 --- a/jscomp/test/bs_map_test.js +++ b/jscomp/test/bs_map_test.js @@ -2,9 +2,9 @@ var Mt = require("./mt.js"); var Block = require("../../lib/js/block.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_MapInt = require("../../lib/js/bs_MapInt.js"); -var Bs_SetInt = require("../../lib/js/bs_SetInt.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_MapInt = require("../../lib/js/belt_MapInt.js"); +var Belt_SetInt = require("../../lib/js/belt_SetInt.js"); var suites = [/* [] */0]; @@ -41,34 +41,34 @@ function b(loc, v) { return /* () */0; } -var mapOfArray = Bs_MapInt.ofArray; +var mapOfArray = Belt_MapInt.ofArray; -var setOfArray = Bs_SetInt.ofArray; +var setOfArray = Belt_SetInt.ofArray; function emptyMap() { - return Bs_MapInt.empty; + return Belt_MapInt.empty; } -var v = Bs_Array.makeByAndShuffle(1000000, (function (i) { +var v = Belt_Array.makeByAndShuffle(1000000, (function (i) { return /* tuple */[ i, i ]; })); -var u = Bs_MapInt.ofArray(v); +var u = Belt_MapInt.ofArray(v); -b("File \"bs_map_test.ml\", line 27, characters 4-11", Bs_MapInt.checkInvariantInternal(u)); +b("File \"bs_map_test.ml\", line 27, characters 4-11", Belt_MapInt.checkInvariantInternal(u)); -var firstHalf = Bs_Array.slice(v, 0, 2000); +var firstHalf = Belt_Array.slice(v, 0, 2000); -var xx = Bs_Array.reduce(firstHalf, u, (function (acc, param) { - return Bs_MapInt.remove(acc, param[0]); +var xx = Belt_Array.reduce(firstHalf, u, (function (acc, param) { + return Belt_MapInt.remove(acc, param[0]); })); -b("File \"bs_map_test.ml\", line 31, characters 4-11", Bs_MapInt.checkInvariantInternal(u)); +b("File \"bs_map_test.ml\", line 31, characters 4-11", Belt_MapInt.checkInvariantInternal(u)); -b("File \"bs_map_test.ml\", line 32, characters 4-11", Bs_MapInt.checkInvariantInternal(xx)); +b("File \"bs_map_test.ml\", line 32, characters 4-11", Belt_MapInt.checkInvariantInternal(xx)); Mt.from_pair_suites("bs_map_test.ml", suites[0]); diff --git a/jscomp/test/bs_map_test.ml b/jscomp/test/bs_map_test.ml index fc4ac3d85a..1b868e73d7 100644 --- a/jscomp/test/bs_map_test.ml +++ b/jscomp/test/bs_map_test.ml @@ -11,9 +11,9 @@ let b loc v = (loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Ok v)) :: !suites -module M = Bs.Map.Int -module N = Bs.Set.Int -module A = Bs.Array +module M = Belt.Map.Int +module N = Belt.Set.Int +module A = Belt.Array let mapOfArray x = M.ofArray x diff --git a/jscomp/test/bs_mutable_set_test.js b/jscomp/test/bs_mutable_set_test.js index e26d2e1be6..cf860a5fa6 100644 --- a/jscomp/test/bs_mutable_set_test.js +++ b/jscomp/test/bs_mutable_set_test.js @@ -1,15 +1,15 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_List = require("../../lib/js/bs_List.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_Range = require("../../lib/js/bs_Range.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); +var Belt_List = require("../../lib/js/belt_List.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_Range = require("../../lib/js/belt_Range.js"); var Caml_array = require("../../lib/js/caml_array.js"); var Array_data_util = require("./array_data_util.js"); -var Bs_MutableSetInt = require("../../lib/js/bs_MutableSetInt.js"); -var Bs_internalAVLset = require("../../lib/js/bs_internalAVLset.js"); -var Bs_internalSetInt = require("../../lib/js/bs_internalSetInt.js"); +var Belt_MutableSetInt = require("../../lib/js/belt_MutableSetInt.js"); +var Belt_internalAVLset = require("../../lib/js/belt_internalAVLset.js"); +var Belt_internalSetInt = require("../../lib/js/belt_internalSetInt.js"); var suites = [/* [] */0]; @@ -26,94 +26,94 @@ function b(loc, x) { var xs = Array_data_util.range(0, 30); var u = { - data: Bs_internalSetInt.ofArray(xs) + data: Belt_internalSetInt.ofArray(xs) }; -b("File \"bs_mutable_set_test.ml\", line 20, characters 4-11", Bs_MutableSetInt.removeCheck(u, 0)); +b("File \"bs_mutable_set_test.ml\", line 20, characters 4-11", Belt_MutableSetInt.removeCheck(u, 0)); -b("File \"bs_mutable_set_test.ml\", line 21, characters 4-11", 1 - Bs_MutableSetInt.removeCheck(u, 0)); +b("File \"bs_mutable_set_test.ml\", line 21, characters 4-11", 1 - Belt_MutableSetInt.removeCheck(u, 0)); -b("File \"bs_mutable_set_test.ml\", line 22, characters 4-11", Bs_MutableSetInt.removeCheck(u, 30)); +b("File \"bs_mutable_set_test.ml\", line 22, characters 4-11", Belt_MutableSetInt.removeCheck(u, 30)); -b("File \"bs_mutable_set_test.ml\", line 23, characters 4-11", Bs_MutableSetInt.removeCheck(u, 20)); +b("File \"bs_mutable_set_test.ml\", line 23, characters 4-11", Belt_MutableSetInt.removeCheck(u, 20)); -eq("File \"bs_mutable_set_test.ml\", line 24, characters 5-12", Bs_internalAVLset.size(u.data), 28); +eq("File \"bs_mutable_set_test.ml\", line 24, characters 5-12", Belt_internalAVLset.size(u.data), 28); var r = Array_data_util.randomRange(0, 30); -b("File \"bs_mutable_set_test.ml\", line 26, characters 4-11", +(29 === Bs_internalAVLset.maxUndefined(u.data))); +b("File \"bs_mutable_set_test.ml\", line 26, characters 4-11", +(29 === Belt_internalAVLset.maxUndefined(u.data))); -b("File \"bs_mutable_set_test.ml\", line 27, characters 4-11", +(1 === Bs_internalAVLset.minUndefined(u.data))); +b("File \"bs_mutable_set_test.ml\", line 27, characters 4-11", +(1 === Belt_internalAVLset.minUndefined(u.data))); -Bs_MutableSetInt.add(u, 3); +Belt_MutableSetInt.add(u, 3); for(var i = 0 ,i_finish = r.length - 1 | 0; i <= i_finish; ++i){ - Bs_MutableSetInt.remove(u, r[i]); + Belt_MutableSetInt.remove(u, r[i]); } -b("File \"bs_mutable_set_test.ml\", line 32, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_mutable_set_test.ml\", line 32, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); -Bs_MutableSetInt.add(u, 0); +Belt_MutableSetInt.add(u, 0); -Bs_MutableSetInt.add(u, 1); +Belt_MutableSetInt.add(u, 1); -Bs_MutableSetInt.add(u, 2); +Belt_MutableSetInt.add(u, 2); -Bs_MutableSetInt.add(u, 0); +Belt_MutableSetInt.add(u, 0); -eq("File \"bs_mutable_set_test.ml\", line 37, characters 5-12", Bs_internalAVLset.size(u.data), 3); +eq("File \"bs_mutable_set_test.ml\", line 37, characters 5-12", Belt_internalAVLset.size(u.data), 3); -b("File \"bs_mutable_set_test.ml\", line 38, characters 4-11", 1 - Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_mutable_set_test.ml\", line 38, characters 4-11", 1 - Belt_internalAVLset.isEmpty(u.data)); for(var i$1 = 0; i$1 <= 3; ++i$1){ - Bs_MutableSetInt.remove(u, i$1); + Belt_MutableSetInt.remove(u, i$1); } -b("File \"bs_mutable_set_test.ml\", line 42, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_mutable_set_test.ml\", line 42, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); -Bs_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); +Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); -Bs_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 200)); +Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 200)); -eq("File \"bs_mutable_set_test.ml\", line 45, characters 5-12", Bs_internalAVLset.size(u.data), 20001); +eq("File \"bs_mutable_set_test.ml\", line 45, characters 5-12", Belt_internalAVLset.size(u.data), 20001); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 200)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 200)); -eq("File \"bs_mutable_set_test.ml\", line 47, characters 5-12", Bs_internalAVLset.size(u.data), 19800); +eq("File \"bs_mutable_set_test.ml\", line 47, characters 5-12", Belt_internalAVLset.size(u.data), 19800); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); -eq("File \"bs_mutable_set_test.ml\", line 49, characters 5-12", Bs_internalAVLset.size(u.data), 19000); +eq("File \"bs_mutable_set_test.ml\", line 49, characters 5-12", Belt_internalAVLset.size(u.data), 19000); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); -eq("File \"bs_mutable_set_test.ml\", line 51, characters 5-12", Bs_internalAVLset.size(u.data), 19000); +eq("File \"bs_mutable_set_test.ml\", line 51, characters 5-12", Belt_internalAVLset.size(u.data), 19000); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(1000, 10000)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(1000, 10000)); -eq("File \"bs_mutable_set_test.ml\", line 53, characters 5-12", Bs_internalAVLset.size(u.data), 10000); +eq("File \"bs_mutable_set_test.ml\", line 53, characters 5-12", Belt_internalAVLset.size(u.data), 10000); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 19999)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 19999)); -eq("File \"bs_mutable_set_test.ml\", line 55, characters 5-12", Bs_internalAVLset.size(u.data), 1); +eq("File \"bs_mutable_set_test.ml\", line 55, characters 5-12", Belt_internalAVLset.size(u.data), 1); -b("File \"bs_mutable_set_test.ml\", line 56, characters 4-11", Bs_internalSetInt.has(u.data, 20000)); +b("File \"bs_mutable_set_test.ml\", line 56, characters 4-11", Belt_internalSetInt.has(u.data, 20000)); -Bs_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 30000)); +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 30000)); -b("File \"bs_mutable_set_test.ml\", line 58, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_mutable_set_test.ml\", line 58, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); var xs$1 = Array_data_util.randomRange(1000, 2000); var v = { - data: Bs_internalSetInt.ofArray(xs$1) + data: Belt_internalSetInt.ofArray(xs$1) }; -var bs = Bs_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { - return Bs_MutableSetInt.removeCheck(v, x); +var bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { + return Belt_MutableSetInt.removeCheck(v, x); })); -var indeedRemoved = Bs_Array.reduce(bs, 0, (function (acc, x) { +var indeedRemoved = Belt_Array.reduce(bs, 0, (function (acc, x) { if (x) { return acc + 1 | 0; } else { @@ -123,13 +123,13 @@ var indeedRemoved = Bs_Array.reduce(bs, 0, (function (acc, x) { eq("File \"bs_mutable_set_test.ml\", line 65, characters 5-12", indeedRemoved, 500); -eq("File \"bs_mutable_set_test.ml\", line 66, characters 5-12", Bs_internalAVLset.size(v.data), 501); +eq("File \"bs_mutable_set_test.ml\", line 66, characters 5-12", Belt_internalAVLset.size(v.data), 501); -var cs = Bs_Array.map(Array_data_util.randomRange(500, 2000), (function (x) { - return Bs_MutableSetInt.addCheck(v, x); +var cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), (function (x) { + return Belt_MutableSetInt.addCheck(v, x); })); -var indeedAded = Bs_Array.reduce(cs, 0, (function (acc, x) { +var indeedAded = Belt_Array.reduce(cs, 0, (function (acc, x) { if (x) { return acc + 1 | 0; } else { @@ -139,41 +139,41 @@ var indeedAded = Bs_Array.reduce(cs, 0, (function (acc, x) { eq("File \"bs_mutable_set_test.ml\", line 69, characters 5-12", indeedAded, 1000); -eq("File \"bs_mutable_set_test.ml\", line 70, characters 5-12", Bs_internalAVLset.size(v.data), 1501); +eq("File \"bs_mutable_set_test.ml\", line 70, characters 5-12", Belt_internalAVLset.size(v.data), 1501); var d = { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; -b("File \"bs_mutable_set_test.ml\", line 71, characters 4-11", Bs_internalAVLset.isEmpty(d.data)); +b("File \"bs_mutable_set_test.ml\", line 71, characters 4-11", Belt_internalAVLset.isEmpty(d.data)); -eq("File \"bs_mutable_set_test.ml\", line 72, characters 5-12", Bs_internalAVLset.minimum(v.data), /* Some */[500]); +eq("File \"bs_mutable_set_test.ml\", line 72, characters 5-12", Belt_internalAVLset.minimum(v.data), /* Some */[500]); -eq("File \"bs_mutable_set_test.ml\", line 73, characters 5-12", Bs_internalAVLset.maximum(v.data), /* Some */[2000]); +eq("File \"bs_mutable_set_test.ml\", line 73, characters 5-12", Belt_internalAVLset.maximum(v.data), /* Some */[2000]); -eq("File \"bs_mutable_set_test.ml\", line 74, characters 5-12", Bs_internalAVLset.minUndefined(v.data), 500); +eq("File \"bs_mutable_set_test.ml\", line 74, characters 5-12", Belt_internalAVLset.minUndefined(v.data), 500); -eq("File \"bs_mutable_set_test.ml\", line 75, characters 5-12", Bs_internalAVLset.maxUndefined(v.data), 2000); +eq("File \"bs_mutable_set_test.ml\", line 75, characters 5-12", Belt_internalAVLset.maxUndefined(v.data), 2000); -eq("File \"bs_mutable_set_test.ml\", line 76, characters 5-12", Bs_MutableSetInt.reduce(v, 0, (function (x, y) { +eq("File \"bs_mutable_set_test.ml\", line 76, characters 5-12", Belt_MutableSetInt.reduce(v, 0, (function (x, y) { return x + y | 0; })), 1876250); -b("File \"bs_mutable_set_test.ml\", line 77, characters 4-11", Bs_List.eq(Bs_internalAVLset.toList(v.data), Bs_List.makeBy(1501, (function (i) { +b("File \"bs_mutable_set_test.ml\", line 77, characters 4-11", Belt_List.eq(Belt_internalAVLset.toList(v.data), Belt_List.makeBy(1501, (function (i) { return i + 500 | 0; })), (function (x, y) { return +(x === y); }))); -eq("File \"bs_mutable_set_test.ml\", line 78, characters 5-12", Bs_internalAVLset.toArray(v.data), Array_data_util.range(500, 2000)); +eq("File \"bs_mutable_set_test.ml\", line 78, characters 5-12", Belt_internalAVLset.toArray(v.data), Array_data_util.range(500, 2000)); -b("File \"bs_mutable_set_test.ml\", line 79, characters 4-11", Bs_internalAVLset.checkInvariantInternal(v.data)); +b("File \"bs_mutable_set_test.ml\", line 79, characters 4-11", Belt_internalAVLset.checkInvariantInternal(v.data)); -eq("File \"bs_mutable_set_test.ml\", line 80, characters 5-12", Bs_internalSetInt.get(v.data, 3), /* None */0); +eq("File \"bs_mutable_set_test.ml\", line 80, characters 5-12", Belt_internalSetInt.get(v.data, 3), /* None */0); -eq("File \"bs_mutable_set_test.ml\", line 81, characters 5-12", Bs_internalSetInt.get(v.data, 1200), /* Some */[1200]); +eq("File \"bs_mutable_set_test.ml\", line 81, characters 5-12", Belt_internalSetInt.get(v.data, 1200), /* Some */[1200]); -var match = Bs_MutableSetInt.split(v, 1000); +var match = Belt_MutableSetInt.split(v, 1000); var match$1 = match[0]; @@ -183,25 +183,25 @@ var aa = match$1[0]; b("File \"bs_mutable_set_test.ml\", line 83, characters 4-11", match[1]); -b("File \"bs_mutable_set_test.ml\", line 84, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(aa.data), Array_data_util.range(500, 999), (function (x, y) { +b("File \"bs_mutable_set_test.ml\", line 84, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(aa.data), Array_data_util.range(500, 999), (function (x, y) { return +(x === y); }))); -b("File \"bs_mutable_set_test.ml\", line 85, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(bb.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); +b("File \"bs_mutable_set_test.ml\", line 85, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(bb.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); -b("File \"bs_mutable_set_test.ml\", line 86, characters 5-12", Bs_MutableSetInt.subset(aa, v)); +b("File \"bs_mutable_set_test.ml\", line 86, characters 5-12", Belt_MutableSetInt.subset(aa, v)); -b("File \"bs_mutable_set_test.ml\", line 87, characters 4-11", Bs_MutableSetInt.subset(bb, v)); +b("File \"bs_mutable_set_test.ml\", line 87, characters 4-11", Belt_MutableSetInt.subset(bb, v)); -var d$1 = Bs_MutableSetInt.intersect(aa, bb); +var d$1 = Belt_MutableSetInt.intersect(aa, bb); -b("File \"bs_mutable_set_test.ml\", line 88, characters 4-11", Bs_internalAVLset.isEmpty(d$1.data)); +b("File \"bs_mutable_set_test.ml\", line 88, characters 4-11", Belt_internalAVLset.isEmpty(d$1.data)); -var c = Bs_MutableSetInt.removeCheck(v, 1000); +var c = Belt_MutableSetInt.removeCheck(v, 1000); b("File \"bs_mutable_set_test.ml\", line 90, characters 4-11", c); -var match$2 = Bs_MutableSetInt.split(v, 1000); +var match$2 = Belt_MutableSetInt.split(v, 1000); var match$3 = match$2[0]; @@ -211,36 +211,36 @@ var aa$1 = match$3[0]; b("File \"bs_mutable_set_test.ml\", line 92, characters 4-11", 1 - match$2[1]); -b("File \"bs_mutable_set_test.ml\", line 93, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(aa$1.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); +b("File \"bs_mutable_set_test.ml\", line 93, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(aa$1.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); -b("File \"bs_mutable_set_test.ml\", line 94, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(bb$1.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); +b("File \"bs_mutable_set_test.ml\", line 94, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(bb$1.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); -b("File \"bs_mutable_set_test.ml\", line 95, characters 5-12", Bs_MutableSetInt.subset(aa$1, v)); +b("File \"bs_mutable_set_test.ml\", line 95, characters 5-12", Belt_MutableSetInt.subset(aa$1, v)); -b("File \"bs_mutable_set_test.ml\", line 96, characters 4-11", Bs_MutableSetInt.subset(bb$1, v)); +b("File \"bs_mutable_set_test.ml\", line 96, characters 4-11", Belt_MutableSetInt.subset(bb$1, v)); -var d$2 = Bs_MutableSetInt.intersect(aa$1, bb$1); +var d$2 = Belt_MutableSetInt.intersect(aa$1, bb$1); -b("File \"bs_mutable_set_test.ml\", line 97, characters 4-11", Bs_internalAVLset.isEmpty(d$2.data)); +b("File \"bs_mutable_set_test.ml\", line 97, characters 4-11", Belt_internalAVLset.isEmpty(d$2.data)); var xs$2 = Array_data_util.randomRange(0, 100); var aa$2 = { - data: Bs_internalSetInt.ofArray(xs$2) + data: Belt_internalSetInt.ofArray(xs$2) }; var xs$3 = Array_data_util.randomRange(40, 120); var bb$2 = { - data: Bs_internalSetInt.ofArray(xs$3) + data: Belt_internalSetInt.ofArray(xs$3) }; -var cc = Bs_MutableSetInt.union(aa$2, bb$2); +var cc = Belt_MutableSetInt.union(aa$2, bb$2); var xs$4 = Array_data_util.randomRange(0, 120); -b("File \"bs_mutable_set_test.ml\", line 106, characters 4-11", Bs_MutableSetInt.eq(cc, { - data: Bs_internalSetInt.ofArray(xs$4) +b("File \"bs_mutable_set_test.ml\", line 106, characters 4-11", Belt_MutableSetInt.eq(cc, { + data: Belt_internalSetInt.ofArray(xs$4) })); var xs$5 = Array_data_util.randomRange(0, 20); @@ -249,48 +249,48 @@ var xs$6 = Array_data_util.randomRange(21, 40); var xs$7 = Array_data_util.randomRange(0, 40); -b("File \"bs_mutable_set_test.ml\", line 108, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.union({ - data: Bs_internalSetInt.ofArray(xs$5) +b("File \"bs_mutable_set_test.ml\", line 108, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.union({ + data: Belt_internalSetInt.ofArray(xs$5) }, { - data: Bs_internalSetInt.ofArray(xs$6) + data: Belt_internalSetInt.ofArray(xs$6) }), { - data: Bs_internalSetInt.ofArray(xs$7) + data: Belt_internalSetInt.ofArray(xs$7) })); -var dd = Bs_MutableSetInt.intersect(aa$2, bb$2); +var dd = Belt_MutableSetInt.intersect(aa$2, bb$2); var xs$8 = Array_data_util.randomRange(40, 100); -b("File \"bs_mutable_set_test.ml\", line 113, characters 4-11", Bs_MutableSetInt.eq(dd, { - data: Bs_internalSetInt.ofArray(xs$8) +b("File \"bs_mutable_set_test.ml\", line 113, characters 4-11", Belt_MutableSetInt.eq(dd, { + data: Belt_internalSetInt.ofArray(xs$8) })); var xs$9 = Array_data_util.randomRange(0, 20); var xs$10 = Array_data_util.randomRange(21, 40); -b("File \"bs_mutable_set_test.ml\", line 114, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(xs$9) +b("File \"bs_mutable_set_test.ml\", line 114, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(xs$9) }, { - data: Bs_internalSetInt.ofArray(xs$10) + data: Belt_internalSetInt.ofArray(xs$10) }), { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); var xs$11 = Array_data_util.randomRange(21, 40); var xs$12 = Array_data_util.randomRange(0, 20); -b("File \"bs_mutable_set_test.ml\", line 120, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(xs$11) +b("File \"bs_mutable_set_test.ml\", line 120, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(xs$11) }, { - data: Bs_internalSetInt.ofArray(xs$12) + data: Belt_internalSetInt.ofArray(xs$12) }), { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); -b("File \"bs_mutable_set_test.ml\", line 126, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(/* array */[ +b("File \"bs_mutable_set_test.ml\", line 126, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(/* array */[ 1, 3, 4, @@ -299,7 +299,7 @@ b("File \"bs_mutable_set_test.ml\", line 126, characters 4-11", Bs_MutableSetInt 9 ]) }, { - data: Bs_internalSetInt.ofArray(/* array */[ + data: Belt_internalSetInt.ofArray(/* array */[ 2, 4, 5, @@ -308,7 +308,7 @@ b("File \"bs_mutable_set_test.ml\", line 126, characters 4-11", Bs_MutableSetInt 10 ]) }), { - data: Bs_internalSetInt.ofArray(/* int array */[ + data: Belt_internalSetInt.ofArray(/* int array */[ 4, 5 ]) @@ -316,14 +316,14 @@ b("File \"bs_mutable_set_test.ml\", line 126, characters 4-11", Bs_MutableSetInt var xs$13 = Array_data_util.randomRange(0, 39); -b("File \"bs_mutable_set_test.ml\", line 132, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff(aa$2, bb$2), { - data: Bs_internalSetInt.ofArray(xs$13) +b("File \"bs_mutable_set_test.ml\", line 132, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$2, bb$2), { + data: Belt_internalSetInt.ofArray(xs$13) })); var xs$14 = Array_data_util.randomRange(101, 120); -b("File \"bs_mutable_set_test.ml\", line 134, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff(bb$2, aa$2), { - data: Bs_internalSetInt.ofArray(xs$14) +b("File \"bs_mutable_set_test.ml\", line 134, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$2, aa$2), { + data: Belt_internalSetInt.ofArray(xs$14) })); var xs$15 = Array_data_util.randomRange(21, 40); @@ -332,12 +332,12 @@ var xs$16 = Array_data_util.randomRange(0, 20); var xs$17 = Array_data_util.randomRange(21, 40); -b("File \"bs_mutable_set_test.ml\", line 136, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$15) +b("File \"bs_mutable_set_test.ml\", line 136, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$15) }, { - data: Bs_internalSetInt.ofArray(xs$16) + data: Belt_internalSetInt.ofArray(xs$16) }), { - data: Bs_internalSetInt.ofArray(xs$17) + data: Belt_internalSetInt.ofArray(xs$17) })); var xs$18 = Array_data_util.randomRange(0, 20); @@ -346,12 +346,12 @@ var xs$19 = Array_data_util.randomRange(21, 40); var xs$20 = Array_data_util.randomRange(0, 20); -b("File \"bs_mutable_set_test.ml\", line 142, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$18) +b("File \"bs_mutable_set_test.ml\", line 142, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$18) }, { - data: Bs_internalSetInt.ofArray(xs$19) + data: Belt_internalSetInt.ofArray(xs$19) }), { - data: Bs_internalSetInt.ofArray(xs$20) + data: Belt_internalSetInt.ofArray(xs$20) })); var xs$21 = Array_data_util.randomRange(0, 20); @@ -360,29 +360,29 @@ var xs$22 = Array_data_util.randomRange(0, 40); var xs$23 = Array_data_util.randomRange(0, -1); -b("File \"bs_mutable_set_test.ml\", line 149, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$21) +b("File \"bs_mutable_set_test.ml\", line 149, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$21) }, { - data: Bs_internalSetInt.ofArray(xs$22) + data: Belt_internalSetInt.ofArray(xs$22) }), { - data: Bs_internalSetInt.ofArray(xs$23) + data: Belt_internalSetInt.ofArray(xs$23) })); var xs$24 = Array_data_util.randomRange(0, 1000); var a0 = { - data: Bs_internalSetInt.ofArray(xs$24) + data: Belt_internalSetInt.ofArray(xs$24) }; -var a1 = Bs_MutableSetInt.keep(a0, (function (x) { +var a1 = Belt_MutableSetInt.keep(a0, (function (x) { return +(x % 2 === 0); })); -var a2 = Bs_MutableSetInt.keep(a0, (function (x) { +var a2 = Belt_MutableSetInt.keep(a0, (function (x) { return +(x % 2 !== 0); })); -var match$4 = Bs_MutableSetInt.partition(a0, (function (x) { +var match$4 = Belt_MutableSetInt.partition(a0, (function (x) { return +(x % 2 === 0); })); @@ -390,11 +390,11 @@ var a4 = match$4[1]; var a3 = match$4[0]; -b("File \"bs_mutable_set_test.ml\", line 164, characters 4-11", Bs_MutableSetInt.eq(a1, a3)); +b("File \"bs_mutable_set_test.ml\", line 164, characters 4-11", Belt_MutableSetInt.eq(a1, a3)); -b("File \"bs_mutable_set_test.ml\", line 165, characters 4-11", Bs_MutableSetInt.eq(a2, a4)); +b("File \"bs_mutable_set_test.ml\", line 165, characters 4-11", Belt_MutableSetInt.eq(a2, a4)); -b("File \"bs_mutable_set_test.ml\", line 166, characters 4-11", Bs_List.every(/* :: */[ +b("File \"bs_mutable_set_test.ml\", line 166, characters 4-11", Belt_List.every(/* :: */[ a0, /* :: */[ a1, @@ -410,97 +410,97 @@ b("File \"bs_mutable_set_test.ml\", line 166, characters 4-11", Bs_List.every(/* ] ] ], (function (x) { - return Bs_internalAVLset.checkInvariantInternal(x.data); + return Belt_internalAVLset.checkInvariantInternal(x.data); }))); var v$1 = { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; for(var i$2 = 0; i$2 <= 100000; ++i$2){ - Bs_MutableSetInt.add(v$1, i$2); + Belt_MutableSetInt.add(v$1, i$2); } -b("File \"bs_mutable_set_test.ml\", line 177, characters 4-11", Bs_internalAVLset.checkInvariantInternal(v$1.data)); +b("File \"bs_mutable_set_test.ml\", line 177, characters 4-11", Belt_internalAVLset.checkInvariantInternal(v$1.data)); -b("File \"bs_mutable_set_test.ml\", line 178, characters 4-11", Bs_Range.every(0, 100000, (function (i) { - return Bs_internalSetInt.has(v$1.data, i); +b("File \"bs_mutable_set_test.ml\", line 178, characters 4-11", Belt_Range.every(0, 100000, (function (i) { + return Belt_internalSetInt.has(v$1.data, i); }))); -eq("File \"bs_mutable_set_test.ml\", line 181, characters 5-12", Bs_internalAVLset.size(v$1.data), 100001); +eq("File \"bs_mutable_set_test.ml\", line 181, characters 5-12", Belt_internalAVLset.size(v$1.data), 100001); -var u$1 = Bs_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); +var u$1 = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); var v$2 = { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; -Bs_MutableSetInt.mergeMany(v$2, u$1); +Belt_MutableSetInt.mergeMany(v$2, u$1); -eq("File \"bs_mutable_set_test.ml\", line 187, characters 5-12", Bs_internalAVLset.size(v$2.data), 91); +eq("File \"bs_mutable_set_test.ml\", line 187, characters 5-12", Belt_internalAVLset.size(v$2.data), 91); -eq("File \"bs_mutable_set_test.ml\", line 188, characters 5-12", Bs_internalAVLset.toArray(v$2.data), Array_data_util.range(30, 120)); +eq("File \"bs_mutable_set_test.ml\", line 188, characters 5-12", Belt_internalAVLset.toArray(v$2.data), Array_data_util.range(30, 120)); -var u$2 = Bs_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); +var u$2 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); var v$3 = { - data: Bs_internalSetInt.ofArray(u$2) + data: Belt_internalSetInt.ofArray(u$2) }; -eq("File \"bs_mutable_set_test.ml\", line 193, characters 5-12", Bs_internalAVLset.size(v$3.data), 100001); +eq("File \"bs_mutable_set_test.ml\", line 193, characters 5-12", Belt_internalAVLset.size(v$3.data), 100001); var u$3 = Array_data_util.randomRange(50000, 80000); for(var i$3 = 0 ,i_finish$1 = u$3.length - 1 | 0; i$3 <= i_finish$1; ++i$3){ - Bs_MutableSetInt.remove(v$3, i$3); + Belt_MutableSetInt.remove(v$3, i$3); } -eq("File \"bs_mutable_set_test.ml\", line 200, characters 5-12", Bs_internalAVLset.size(v$3.data), 70000); +eq("File \"bs_mutable_set_test.ml\", line 200, characters 5-12", Belt_internalAVLset.size(v$3.data), 70000); var vv = Array_data_util.randomRange(0, 100000); for(var i$4 = 0 ,i_finish$2 = vv.length - 1 | 0; i$4 <= i_finish$2; ++i$4){ - Bs_MutableSetInt.remove(v$3, Caml_array.caml_array_get(vv, i$4)); + Belt_MutableSetInt.remove(v$3, Caml_array.caml_array_get(vv, i$4)); } -eq("File \"bs_mutable_set_test.ml\", line 206, characters 5-12", Bs_internalAVLset.size(v$3.data), 0); +eq("File \"bs_mutable_set_test.ml\", line 206, characters 5-12", Belt_internalAVLset.size(v$3.data), 0); -b("File \"bs_mutable_set_test.ml\", line 207, characters 4-11", Bs_internalAVLset.isEmpty(v$3.data)); +b("File \"bs_mutable_set_test.ml\", line 207, characters 4-11", Belt_internalAVLset.isEmpty(v$3.data)); -var xs$25 = Bs_Array.makeBy(30, (function (i) { +var xs$25 = Belt_Array.makeBy(30, (function (i) { return i; })); var v$4 = { - data: Bs_internalSetInt.ofArray(xs$25) + data: Belt_internalSetInt.ofArray(xs$25) }; -Bs_MutableSetInt.remove(v$4, 30); +Belt_MutableSetInt.remove(v$4, 30); -Bs_MutableSetInt.remove(v$4, 29); +Belt_MutableSetInt.remove(v$4, 29); -b("File \"bs_mutable_set_test.ml\", line 213, characters 4-11", +(28 === Bs_internalAVLset.maxUndefined(v$4.data))); +b("File \"bs_mutable_set_test.ml\", line 213, characters 4-11", +(28 === Belt_internalAVLset.maxUndefined(v$4.data))); -Bs_MutableSetInt.remove(v$4, 0); +Belt_MutableSetInt.remove(v$4, 0); -b("File \"bs_mutable_set_test.ml\", line 215, characters 4-11", +(1 === Bs_internalAVLset.minUndefined(v$4.data))); +b("File \"bs_mutable_set_test.ml\", line 215, characters 4-11", +(1 === Belt_internalAVLset.minUndefined(v$4.data))); -eq("File \"bs_mutable_set_test.ml\", line 216, characters 5-12", Bs_internalAVLset.size(v$4.data), 28); +eq("File \"bs_mutable_set_test.ml\", line 216, characters 5-12", Belt_internalAVLset.size(v$4.data), 28); var vv$1 = Array_data_util.randomRange(1, 28); for(var i$5 = 0 ,i_finish$3 = vv$1.length - 1 | 0; i$5 <= i_finish$3; ++i$5){ - Bs_MutableSetInt.remove(v$4, Caml_array.caml_array_get(vv$1, i$5)); + Belt_MutableSetInt.remove(v$4, Caml_array.caml_array_get(vv$1, i$5)); } -eq("File \"bs_mutable_set_test.ml\", line 221, characters 5-12", Bs_internalAVLset.size(v$4.data), 0); +eq("File \"bs_mutable_set_test.ml\", line 221, characters 5-12", Belt_internalAVLset.size(v$4.data), 0); function id(loc, x) { var u = { - data: Bs_internalAVLset.ofSortedArrayUnsafe(x) + data: Belt_internalAVLset.ofSortedArrayUnsafe(x) }; - b(loc, Bs_internalAVLset.checkInvariantInternal(u.data)); - return b(loc, Bs_Array.every2(Bs_internalAVLset.toArray(u.data), x, Caml_obj.caml_equal)); + b(loc, Belt_internalAVLset.checkInvariantInternal(u.data)); + return b(loc, Belt_Array.every2(Belt_internalAVLset.toArray(u.data), x, Caml_obj.caml_equal)); } id("File \"bs_mutable_set_test.ml\", line 229, characters 5-12", /* int array */[]); @@ -589,105 +589,105 @@ id("File \"bs_mutable_set_test.ml\", line 240, characters 5-12", Array_data_util var xs$26 = Array_data_util.randomRange(0, 1000); var v$5 = { - data: Bs_internalSetInt.ofArray(xs$26) + data: Belt_internalSetInt.ofArray(xs$26) }; -var copyV = Bs_MutableSetInt.keep(v$5, (function (x) { +var copyV = Belt_MutableSetInt.keep(v$5, (function (x) { return +(x % 8 === 0); })); -var match$5 = Bs_MutableSetInt.partition(v$5, (function (x) { +var match$5 = Belt_MutableSetInt.partition(v$5, (function (x) { return +(x % 8 === 0); })); -var cc$1 = Bs_MutableSetInt.keep(v$5, (function (x) { +var cc$1 = Belt_MutableSetInt.keep(v$5, (function (x) { return +(x % 8 !== 0); })); for(var i$6 = 0; i$6 <= 200; ++i$6){ - Bs_MutableSetInt.remove(v$5, i$6); + Belt_MutableSetInt.remove(v$5, i$6); } -eq("File \"bs_mutable_set_test.ml\", line 250, characters 5-12", Bs_internalAVLset.size(copyV.data), 126); +eq("File \"bs_mutable_set_test.ml\", line 250, characters 5-12", Belt_internalAVLset.size(copyV.data), 126); -eq("File \"bs_mutable_set_test.ml\", line 251, characters 5-12", Bs_internalAVLset.toArray(copyV.data), Bs_Array.makeBy(126, (function (i) { +eq("File \"bs_mutable_set_test.ml\", line 251, characters 5-12", Belt_internalAVLset.toArray(copyV.data), Belt_Array.makeBy(126, (function (i) { return (i << 3); }))); -eq("File \"bs_mutable_set_test.ml\", line 252, characters 5-12", Bs_internalAVLset.size(v$5.data), 800); +eq("File \"bs_mutable_set_test.ml\", line 252, characters 5-12", Belt_internalAVLset.size(v$5.data), 800); -b("File \"bs_mutable_set_test.ml\", line 253, characters 4-11", Bs_MutableSetInt.eq(copyV, match$5[0])); +b("File \"bs_mutable_set_test.ml\", line 253, characters 4-11", Belt_MutableSetInt.eq(copyV, match$5[0])); -b("File \"bs_mutable_set_test.ml\", line 254, characters 4-11", Bs_MutableSetInt.eq(cc$1, match$5[1])); +b("File \"bs_mutable_set_test.ml\", line 254, characters 4-11", Belt_MutableSetInt.eq(cc$1, match$5[1])); var xs$27 = Array_data_util.randomRange(0, 1000); var v$6 = { - data: Bs_internalSetInt.ofArray(xs$27) + data: Belt_internalSetInt.ofArray(xs$27) }; -var match$6 = Bs_MutableSetInt.split(v$6, 400); +var match$6 = Belt_MutableSetInt.split(v$6, 400); var match$7 = match$6[0]; var xs$28 = Array_data_util.randomRange(0, 399); -b("File \"bs_mutable_set_test.ml\", line 259, characters 4-11", Bs_MutableSetInt.eq(match$7[0], { - data: Bs_internalSetInt.ofArray(xs$28) +b("File \"bs_mutable_set_test.ml\", line 259, characters 4-11", Belt_MutableSetInt.eq(match$7[0], { + data: Belt_internalSetInt.ofArray(xs$28) })); var xs$29 = Array_data_util.randomRange(401, 1000); -b("File \"bs_mutable_set_test.ml\", line 260, characters 4-11", Bs_MutableSetInt.eq(match$7[1], { - data: Bs_internalSetInt.ofArray(xs$29) +b("File \"bs_mutable_set_test.ml\", line 260, characters 4-11", Belt_MutableSetInt.eq(match$7[1], { + data: Belt_internalSetInt.ofArray(xs$29) })); -var xs$30 = Bs_Array.map(Array_data_util.randomRange(0, 1000), (function (x) { +var xs$30 = Belt_Array.map(Array_data_util.randomRange(0, 1000), (function (x) { return (x << 1); })); var d$3 = { - data: Bs_internalSetInt.ofArray(xs$30) + data: Belt_internalSetInt.ofArray(xs$30) }; -var match$8 = Bs_MutableSetInt.split(d$3, 1001); +var match$8 = Belt_MutableSetInt.split(d$3, 1001); var match$9 = match$8[0]; -var xs$31 = Bs_Array.makeBy(501, (function (x) { +var xs$31 = Belt_Array.makeBy(501, (function (x) { return (x << 1); })); -b("File \"bs_mutable_set_test.ml\", line 263, characters 4-11", Bs_MutableSetInt.eq(match$9[0], { - data: Bs_internalSetInt.ofArray(xs$31) +b("File \"bs_mutable_set_test.ml\", line 263, characters 4-11", Belt_MutableSetInt.eq(match$9[0], { + data: Belt_internalSetInt.ofArray(xs$31) })); -var xs$32 = Bs_Array.makeBy(500, (function (x) { +var xs$32 = Belt_Array.makeBy(500, (function (x) { return 1002 + (x << 1) | 0; })); -b("File \"bs_mutable_set_test.ml\", line 264, characters 4-11", Bs_MutableSetInt.eq(match$9[1], { - data: Bs_internalSetInt.ofArray(xs$32) +b("File \"bs_mutable_set_test.ml\", line 264, characters 4-11", Belt_MutableSetInt.eq(match$9[1], { + data: Belt_internalSetInt.ofArray(xs$32) })); var xs$33 = Array_data_util.randomRange(0, 100); var aa$3 = { - data: Bs_internalSetInt.ofArray(xs$33) + data: Belt_internalSetInt.ofArray(xs$33) }; var xs$34 = Array_data_util.randomRange(40, 120); var bb$3 = { - data: Bs_internalSetInt.ofArray(xs$34) + data: Belt_internalSetInt.ofArray(xs$34) }; -var cc$2 = Bs_MutableSetInt.union(aa$3, bb$3); +var cc$2 = Belt_MutableSetInt.union(aa$3, bb$3); var xs$35 = Array_data_util.randomRange(0, 120); -b("File \"bs_mutable_set_test.ml\", line 274, characters 4-11", Bs_MutableSetInt.eq(cc$2, { - data: Bs_internalSetInt.ofArray(xs$35) +b("File \"bs_mutable_set_test.ml\", line 274, characters 4-11", Belt_MutableSetInt.eq(cc$2, { + data: Belt_internalSetInt.ofArray(xs$35) })); var xs$36 = Array_data_util.randomRange(0, 20); @@ -696,48 +696,48 @@ var xs$37 = Array_data_util.randomRange(21, 40); var xs$38 = Array_data_util.randomRange(0, 40); -b("File \"bs_mutable_set_test.ml\", line 276, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.union({ - data: Bs_internalSetInt.ofArray(xs$36) +b("File \"bs_mutable_set_test.ml\", line 276, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.union({ + data: Belt_internalSetInt.ofArray(xs$36) }, { - data: Bs_internalSetInt.ofArray(xs$37) + data: Belt_internalSetInt.ofArray(xs$37) }), { - data: Bs_internalSetInt.ofArray(xs$38) + data: Belt_internalSetInt.ofArray(xs$38) })); -var dd$1 = Bs_MutableSetInt.intersect(aa$3, bb$3); +var dd$1 = Belt_MutableSetInt.intersect(aa$3, bb$3); var xs$39 = Array_data_util.randomRange(40, 100); -b("File \"bs_mutable_set_test.ml\", line 281, characters 4-11", Bs_MutableSetInt.eq(dd$1, { - data: Bs_internalSetInt.ofArray(xs$39) +b("File \"bs_mutable_set_test.ml\", line 281, characters 4-11", Belt_MutableSetInt.eq(dd$1, { + data: Belt_internalSetInt.ofArray(xs$39) })); var xs$40 = Array_data_util.randomRange(0, 20); var xs$41 = Array_data_util.randomRange(21, 40); -b("File \"bs_mutable_set_test.ml\", line 282, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(xs$40) +b("File \"bs_mutable_set_test.ml\", line 282, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(xs$40) }, { - data: Bs_internalSetInt.ofArray(xs$41) + data: Belt_internalSetInt.ofArray(xs$41) }), { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); var xs$42 = Array_data_util.randomRange(21, 40); var xs$43 = Array_data_util.randomRange(0, 20); -b("File \"bs_mutable_set_test.ml\", line 288, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(xs$42) +b("File \"bs_mutable_set_test.ml\", line 288, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(xs$42) }, { - data: Bs_internalSetInt.ofArray(xs$43) + data: Belt_internalSetInt.ofArray(xs$43) }), { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); -b("File \"bs_mutable_set_test.ml\", line 294, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.intersect({ - data: Bs_internalSetInt.ofArray(/* array */[ +b("File \"bs_mutable_set_test.ml\", line 294, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect({ + data: Belt_internalSetInt.ofArray(/* array */[ 1, 3, 4, @@ -746,7 +746,7 @@ b("File \"bs_mutable_set_test.ml\", line 294, characters 4-11", Bs_MutableSetInt 9 ]) }, { - data: Bs_internalSetInt.ofArray(/* array */[ + data: Belt_internalSetInt.ofArray(/* array */[ 2, 4, 5, @@ -755,7 +755,7 @@ b("File \"bs_mutable_set_test.ml\", line 294, characters 4-11", Bs_MutableSetInt 10 ]) }), { - data: Bs_internalSetInt.ofArray(/* int array */[ + data: Belt_internalSetInt.ofArray(/* int array */[ 4, 5 ]) @@ -763,14 +763,14 @@ b("File \"bs_mutable_set_test.ml\", line 294, characters 4-11", Bs_MutableSetInt var xs$44 = Array_data_util.randomRange(0, 39); -b("File \"bs_mutable_set_test.ml\", line 300, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff(aa$3, bb$3), { - data: Bs_internalSetInt.ofArray(xs$44) +b("File \"bs_mutable_set_test.ml\", line 300, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$3, bb$3), { + data: Belt_internalSetInt.ofArray(xs$44) })); var xs$45 = Array_data_util.randomRange(101, 120); -b("File \"bs_mutable_set_test.ml\", line 302, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff(bb$3, aa$3), { - data: Bs_internalSetInt.ofArray(xs$45) +b("File \"bs_mutable_set_test.ml\", line 302, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$3, aa$3), { + data: Belt_internalSetInt.ofArray(xs$45) })); var xs$46 = Array_data_util.randomRange(21, 40); @@ -779,12 +779,12 @@ var xs$47 = Array_data_util.randomRange(0, 20); var xs$48 = Array_data_util.randomRange(21, 40); -b("File \"bs_mutable_set_test.ml\", line 304, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$46) +b("File \"bs_mutable_set_test.ml\", line 304, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$46) }, { - data: Bs_internalSetInt.ofArray(xs$47) + data: Belt_internalSetInt.ofArray(xs$47) }), { - data: Bs_internalSetInt.ofArray(xs$48) + data: Belt_internalSetInt.ofArray(xs$48) })); var xs$49 = Array_data_util.randomRange(0, 20); @@ -793,12 +793,12 @@ var xs$50 = Array_data_util.randomRange(21, 40); var xs$51 = Array_data_util.randomRange(0, 20); -b("File \"bs_mutable_set_test.ml\", line 310, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$49) +b("File \"bs_mutable_set_test.ml\", line 310, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$49) }, { - data: Bs_internalSetInt.ofArray(xs$50) + data: Belt_internalSetInt.ofArray(xs$50) }), { - data: Bs_internalSetInt.ofArray(xs$51) + data: Belt_internalSetInt.ofArray(xs$51) })); var xs$52 = Array_data_util.randomRange(0, 20); @@ -807,12 +807,12 @@ var xs$53 = Array_data_util.randomRange(0, 40); var xs$54 = Array_data_util.randomRange(0, -1); -b("File \"bs_mutable_set_test.ml\", line 317, characters 4-11", Bs_MutableSetInt.eq(Bs_MutableSetInt.diff({ - data: Bs_internalSetInt.ofArray(xs$52) +b("File \"bs_mutable_set_test.ml\", line 317, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff({ + data: Belt_internalSetInt.ofArray(xs$52) }, { - data: Bs_internalSetInt.ofArray(xs$53) + data: Belt_internalSetInt.ofArray(xs$53) }), { - data: Bs_internalSetInt.ofArray(xs$54) + data: Belt_internalSetInt.ofArray(xs$54) })); Mt.from_pair_suites("bs_mutable_set_test.ml", suites[0]); @@ -827,15 +827,15 @@ var A = 0; var L = 0; -var empty = Bs_MutableSetInt.make; +var empty = Belt_MutableSetInt.make; -var ofArray = Bs_MutableSetInt.ofArray; +var ofArray = Belt_MutableSetInt.ofArray; -var $plus$plus = Bs_MutableSetInt.union; +var $plus$plus = Belt_MutableSetInt.union; -var f = Bs_MutableSetInt.ofArray; +var f = Belt_MutableSetInt.ofArray; -var $eq$tilde = Bs_MutableSetInt.eq; +var $eq$tilde = Belt_MutableSetInt.eq; exports.suites = suites; exports.test_id = test_id; diff --git a/jscomp/test/bs_mutable_set_test.ml b/jscomp/test/bs_mutable_set_test.ml index b2905a20a8..a2cce75d56 100644 --- a/jscomp/test/bs_mutable_set_test.ml +++ b/jscomp/test/bs_mutable_set_test.ml @@ -3,12 +3,12 @@ let test_id = ref 0 let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x -module N = Bs.MutableSet.Int +module N = Belt.MutableSet.Int module I = Array_data_util -module R = Bs.Range -module A = Bs.Array -module L = Bs.List +module R = Belt.Range +module A = Belt.Array +module L = Belt.List let (++) = A.concat let empty = N.make let ofArray = N.ofArray diff --git a/jscomp/test/bs_poly_map_test.js b/jscomp/test/bs_poly_map_test.js index 3bf0d2ba85..e5a0318ebb 100644 --- a/jscomp/test/bs_poly_map_test.js +++ b/jscomp/test/bs_poly_map_test.js @@ -1,12 +1,12 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); -var Bs_Map = require("../../lib/js/bs_Map.js"); -var Bs_Set = require("../../lib/js/bs_Set.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); +var Belt_Map = require("../../lib/js/belt_Map.js"); +var Belt_Set = require("../../lib/js/belt_Set.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); -var Bs_MapDict = require("../../lib/js/bs_MapDict.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_MapDict = require("../../lib/js/belt_MapDict.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); @@ -22,37 +22,37 @@ function b(loc, v) { return Mt.bool_suites(test_id, suites, loc, v); } -var Icmp = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var Icmp = Belt_Id.comparable(Caml_primitive.caml_int_compare); function mapOfArray(x) { - return Bs_Map.ofArray(x, Icmp); + return Belt_Map.ofArray(x, Icmp); } function setOfArray(x) { - return Bs_Set.ofArray(x, Icmp); + return Belt_Set.ofArray(x, Icmp); } function emptyMap() { return { cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; } function mergeInter(s1, s2) { - var m = Bs_Map.merge(s1, s2, (function (_, v1, v2) { + var m = Belt_Map.merge(s1, s2, (function (_, v1, v2) { if (v1 && v2) { return /* Some */[/* () */0]; } else { return /* None */0; } })); - var x = Bs_MapDict.keysToArray(m.data); - return Bs_Set.ofArray(x, Icmp); + var x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.ofArray(x, Icmp); } function mergeUnion(s1, s2) { - var m = Bs_Map.merge(s1, s2, (function (_, v1, v2) { + var m = Belt_Map.merge(s1, s2, (function (_, v1, v2) { if (v1) { return /* Some */[/* () */0]; } else if (v2) { @@ -61,24 +61,24 @@ function mergeUnion(s1, s2) { return /* None */0; } })); - var x = Bs_MapDict.keysToArray(m.data); - return Bs_Set.ofArray(x, Icmp); + var x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.ofArray(x, Icmp); } function mergeDiff(s1, s2) { - var m = Bs_Map.merge(s1, s2, (function (_, v1, v2) { + var m = Belt_Map.merge(s1, s2, (function (_, v1, v2) { if (v1 && !v2) { return /* Some */[/* () */0]; } else { return /* None */0; } })); - var x = Bs_MapDict.keysToArray(m.data); - return Bs_Set.ofArray(x, Icmp); + var x = Belt_MapDict.keysToArray(m.data); + return Belt_Set.ofArray(x, Icmp); } function randomRange(i, j) { - return Bs_Array.map(Array_data_util.randomRange(i, j), (function (x) { + return Belt_Array.map(Array_data_util.randomRange(i, j), (function (x) { return /* tuple */[ x, x @@ -88,37 +88,37 @@ function randomRange(i, j) { var x = randomRange(0, 100); -var u0 = Bs_Map.ofArray(x, Icmp); +var u0 = Belt_Map.ofArray(x, Icmp); var x$1 = randomRange(30, 120); -var u1 = Bs_Map.ofArray(x$1, Icmp); +var u1 = Belt_Map.ofArray(x$1, Icmp); var x$2 = Array_data_util.range(30, 100); -b("File \"bs_poly_map_test.ml\", line 48, characters 4-11", Bs_Set.eq(mergeInter(u0, u1), Bs_Set.ofArray(x$2, Icmp))); +b("File \"bs_poly_map_test.ml\", line 48, characters 4-11", Belt_Set.eq(mergeInter(u0, u1), Belt_Set.ofArray(x$2, Icmp))); var x$3 = Array_data_util.range(0, 120); -b("File \"bs_poly_map_test.ml\", line 49, characters 4-11", Bs_Set.eq(mergeUnion(u0, u1), Bs_Set.ofArray(x$3, Icmp))); +b("File \"bs_poly_map_test.ml\", line 49, characters 4-11", Belt_Set.eq(mergeUnion(u0, u1), Belt_Set.ofArray(x$3, Icmp))); var x$4 = Array_data_util.range(0, 29); -b("File \"bs_poly_map_test.ml\", line 50, characters 4-11", Bs_Set.eq(mergeDiff(u0, u1), Bs_Set.ofArray(x$4, Icmp))); +b("File \"bs_poly_map_test.ml\", line 50, characters 4-11", Belt_Set.eq(mergeDiff(u0, u1), Belt_Set.ofArray(x$4, Icmp))); var x$5 = Array_data_util.range(101, 120); -b("File \"bs_poly_map_test.ml\", line 51, characters 4-11", Bs_Set.eq(mergeDiff(u1, u0), Bs_Set.ofArray(x$5, Icmp))); +b("File \"bs_poly_map_test.ml\", line 51, characters 4-11", Belt_Set.eq(mergeDiff(u1, u0), Belt_Set.ofArray(x$5, Icmp))); var x$6 = randomRange(0, 10); -var a0 = Bs_Map.ofArray(x$6, Icmp); +var a0 = Belt_Map.ofArray(x$6, Icmp); -var a1 = Bs_Map.set(a0, 3, 33); +var a1 = Belt_Map.set(a0, 3, 33); -var a2 = Bs_Map.remove(a1, 3); +var a2 = Belt_Map.remove(a1, 3); -var a3 = Bs_Map.update(a2, 3, (function (k) { +var a3 = Belt_Map.update(a2, 3, (function (k) { if (k) { return /* Some */[k[0] + 1 | 0]; } else { @@ -126,7 +126,7 @@ var a3 = Bs_Map.update(a2, 3, (function (k) { } })); -var a4 = Bs_Map.update(a2, 3, (function (k) { +var a4 = Belt_Map.update(a2, 3, (function (k) { if (k) { return /* Some */[k[0] + 1 | 0]; } else { @@ -134,27 +134,27 @@ var a4 = Bs_Map.update(a2, 3, (function (k) { } })); -var a5 = Bs_Map.remove(a0, 3); +var a5 = Belt_Map.remove(a0, 3); -var a6 = Bs_Map.remove(a5, 3); +var a6 = Belt_Map.remove(a5, 3); b("File \"bs_poly_map_test.ml\", line 70, characters 4-11", +(a5 === a6)); -b("File \"bs_poly_map_test.ml\", line 71, characters 4-11", Bs_Map.has(a0, 3)); +b("File \"bs_poly_map_test.ml\", line 71, characters 4-11", Belt_Map.has(a0, 3)); -b("File \"bs_poly_map_test.ml\", line 72, characters 4-11", 1 - Bs_Map.has(a5, 3)); +b("File \"bs_poly_map_test.ml\", line 72, characters 4-11", 1 - Belt_Map.has(a5, 3)); -b("File \"bs_poly_map_test.ml\", line 73, characters 4-11", +(3 === Bs_Map.getUndefined(a0, 3))); +b("File \"bs_poly_map_test.ml\", line 73, characters 4-11", +(3 === Belt_Map.getUndefined(a0, 3))); -b("File \"bs_poly_map_test.ml\", line 74, characters 4-11", +(33 === Bs_Map.getUndefined(a1, 3))); +b("File \"bs_poly_map_test.ml\", line 74, characters 4-11", +(33 === Belt_Map.getUndefined(a1, 3))); -b("File \"bs_poly_map_test.ml\", line 75, characters 4-11", +(Bs_Map.getUndefined(a2, 3) === undefined)); +b("File \"bs_poly_map_test.ml\", line 75, characters 4-11", +(Belt_Map.getUndefined(a2, 3) === undefined)); -b("File \"bs_poly_map_test.ml\", line 77, characters 4-11", +(11 === Bs_Map.getUndefined(a3, 3))); +b("File \"bs_poly_map_test.ml\", line 77, characters 4-11", +(11 === Belt_Map.getUndefined(a3, 3))); -b("File \"bs_poly_map_test.ml\", line 78, characters 4-11", +(Bs_Map.getUndefined(a4, 3) === undefined)); +b("File \"bs_poly_map_test.ml\", line 78, characters 4-11", +(Belt_Map.getUndefined(a4, 3) === undefined)); -var a7 = Bs_Map.removeMany(a0, /* array */[ +var a7 = Belt_Map.removeMany(a0, /* array */[ 7, 8, 0, @@ -168,30 +168,30 @@ var a7 = Bs_Map.removeMany(a0, /* array */[ 6 ]); -eq("File \"bs_poly_map_test.ml\", line 81, characters 5-12", Bs_MapDict.keysToArray(a7.data), /* int array */[ +eq("File \"bs_poly_map_test.ml\", line 81, characters 5-12", Belt_MapDict.keysToArray(a7.data), /* int array */[ 9, 10 ]); -var a8 = Bs_Map.removeMany(a7, Array_data_util.randomRange(0, 100)); +var a8 = Belt_Map.removeMany(a7, Array_data_util.randomRange(0, 100)); -b("File \"bs_poly_map_test.ml\", line 83, characters 4-11", Bs_MapDict.isEmpty(a8.data)); +b("File \"bs_poly_map_test.ml\", line 83, characters 4-11", Belt_MapDict.isEmpty(a8.data)); var x$7 = randomRange(0, 100); -var u0$1 = Bs_Map.ofArray(x$7, Icmp); +var u0$1 = Belt_Map.ofArray(x$7, Icmp); -var u1$1 = Bs_Map.set(u0$1, 3, 32); +var u1$1 = Belt_Map.set(u0$1, 3, 32); -eq("File \"bs_poly_map_test.ml\", line 90, characters 5-12", Bs_Map.get(u1$1, 3), /* Some */[32]); +eq("File \"bs_poly_map_test.ml\", line 90, characters 5-12", Belt_Map.get(u1$1, 3), /* Some */[32]); -eq("File \"bs_poly_map_test.ml\", line 91, characters 5-12", Bs_Map.get(u0$1, 3), /* Some */[3]); +eq("File \"bs_poly_map_test.ml\", line 91, characters 5-12", Belt_Map.get(u0$1, 3), /* Some */[3]); function acc(m, is) { - return Bs_Array.reduce(is, m, (function (a, i) { + return Belt_Array.reduce(is, m, (function (a, i) { var m = a; var i$1 = i; - return Bs_Map.update(m, i$1, (function (n) { + return Belt_Map.update(m, i$1, (function (n) { if (n) { return /* Some */[n[0] + 1 | 0]; } else { @@ -203,44 +203,44 @@ function acc(m, is) { var m = { cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; -var m1 = acc(m, Bs_Array.concat(Array_data_util.randomRange(0, 20), Array_data_util.randomRange(10, 30))); +var m1 = acc(m, Belt_Array.concat(Array_data_util.randomRange(0, 20), Array_data_util.randomRange(10, 30))); -var x$8 = Bs_Array.makeBy(31, (function (i) { +var x$8 = Belt_Array.makeBy(31, (function (i) { return /* tuple */[ i, i >= 10 && i <= 20 ? 2 : 1 ]; })); -b("File \"bs_poly_map_test.ml\", line 103, characters 4-11", Bs_Map.eq(m1, Bs_Map.ofArray(x$8, Icmp), (function (x, y) { +b("File \"bs_poly_map_test.ml\", line 103, characters 4-11", Belt_Map.eq(m1, Belt_Map.ofArray(x$8, Icmp), (function (x, y) { return +(x === y); }))); var v0 = { cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; -var v1 = Bs_Map.mergeMany(v0, Bs_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { +var v1 = Belt_Map.mergeMany(v0, Belt_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { return /* tuple */[ x, x ]; }))); -var x$9 = Bs_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { +var x$9 = Belt_Array.map(Array_data_util.randomRange(0, 10000), (function (x) { return /* tuple */[ x, x ]; })); -var v2 = Bs_Map.ofArray(x$9, Icmp); +var v2 = Belt_Map.ofArray(x$9, Icmp); -b("File \"bs_poly_map_test.ml\", line 117, characters 4-11", Bs_Map.eq(v1, v2, (function (x, y) { +b("File \"bs_poly_map_test.ml\", line 117, characters 4-11", Belt_Map.eq(v1, v2, (function (x, y) { return +(x === y); }))); @@ -252,65 +252,65 @@ function inc(x) { } } -var v3 = Bs_Map.update(v1, 10, inc); +var v3 = Belt_Map.update(v1, 10, inc); -var v4 = Bs_Map.update(v3, -10, inc); +var v4 = Belt_Map.update(v3, -10, inc); -var match = Bs_Map.split(v3, 5000); +var match = Belt_Map.split(v3, 5000); var pres = match[1]; var match$1 = match[0]; -var match$2 = Bs_Map.get(v3, 10); +var match$2 = Belt_Map.get(v3, 10); b("File \"bs_poly_map_test.ml\", line 126, characters 4-11", match$2 && match$2[0] === 11 ? /* true */1 : /* false */0); -var match$3 = Bs_Map.get(v3, -10); +var match$3 = Belt_Map.get(v3, -10); b("File \"bs_poly_map_test.ml\", line 127, characters 4-11", match$3 ? /* false */0 : /* true */1); -var match$4 = Bs_Map.get(v4, -10); +var match$4 = Belt_Map.get(v4, -10); b("File \"bs_poly_map_test.ml\", line 128, characters 4-11", match$4 && match$4[0] === 0 ? /* true */1 : /* false */0); -var map = Bs_Map.remove({ +var map = Belt_Map.remove({ cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }, 0); -b("File \"bs_poly_map_test.ml\", line 129, characters 4-11", Bs_MapDict.isEmpty(map.data)); +b("File \"bs_poly_map_test.ml\", line 129, characters 4-11", Belt_MapDict.isEmpty(map.data)); -var map$1 = Bs_Map.removeMany({ +var map$1 = Belt_Map.removeMany({ cmp: Icmp[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }, /* int array */[0]); -b("File \"bs_poly_map_test.ml\", line 130, characters 4-11", Bs_MapDict.isEmpty(map$1.data)); +b("File \"bs_poly_map_test.ml\", line 130, characters 4-11", Belt_MapDict.isEmpty(map$1.data)); b("File \"bs_poly_map_test.ml\", line 131, characters 4-11", pres && pres[0] === 5000 ? /* true */1 : /* false */0); -b("File \"bs_poly_map_test.ml\", line 132, characters 4-11", Bs_Array.eq(Bs_MapDict.keysToArray(match$1[0].data), Bs_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.ml\", line 132, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[0].data), Belt_Array.makeBy(5000, (function (i) { return i; })), Caml_obj.caml_equal)); -b("File \"bs_poly_map_test.ml\", line 133, characters 4-11", Bs_Array.eq(Bs_MapDict.keysToArray(match$1[1].data), Bs_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.ml\", line 133, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$1[1].data), Belt_Array.makeBy(5000, (function (i) { return 5001 + i | 0; })), Caml_obj.caml_equal)); -var v7 = Bs_Map.remove(v3, 5000); +var v7 = Belt_Map.remove(v3, 5000); -var match$5 = Bs_Map.split(v7, 5000); +var match$5 = Belt_Map.split(v7, 5000); var match$6 = match$5[0]; b("File \"bs_poly_map_test.ml\", line 137, characters 4-11", match$5[1] ? /* false */0 : /* true */1); -b("File \"bs_poly_map_test.ml\", line 138, characters 4-11", Bs_Array.eq(Bs_MapDict.keysToArray(match$6[0].data), Bs_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.ml\", line 138, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[0].data), Belt_Array.makeBy(5000, (function (i) { return i; })), Caml_obj.caml_equal)); -b("File \"bs_poly_map_test.ml\", line 139, characters 4-11", Bs_Array.eq(Bs_MapDict.keysToArray(match$6[1].data), Bs_Array.makeBy(5000, (function (i) { +b("File \"bs_poly_map_test.ml\", line 139, characters 4-11", Belt_Array.eq(Belt_MapDict.keysToArray(match$6[1].data), Belt_Array.makeBy(5000, (function (i) { return 5001 + i | 0; })), Caml_obj.caml_equal)); diff --git a/jscomp/test/bs_poly_map_test.ml b/jscomp/test/bs_poly_map_test.ml index d2e7febde4..13ae5e7241 100644 --- a/jscomp/test/bs_poly_map_test.ml +++ b/jscomp/test/bs_poly_map_test.ml @@ -4,18 +4,18 @@ let eq loc x y = Mt.eq_suites ~suites ~test_id loc x y let b loc v = Mt.bool_suites ~suites ~test_id loc v module Icmp = - (val Bs.Id.comparable + (val Belt.Id.comparable (fun (x : int) y -> compare x y) ) -module M = Bs.Map -module N = Bs.Set +module M = Belt.Map +module N = Belt.Set -module A = Bs_Array +module A = Belt.Array module I = Array_data_util let mapOfArray x = M.ofArray ~id:(module Icmp) x -let setOfArray x = N.ofArray ~dict:(module Icmp) x +let setOfArray x = N.ofArray ~id:(module Icmp) x let emptyMap () = M.make (module Icmp) let mergeInter s1 s2 = diff --git a/jscomp/test/bs_poly_mutable_map_test.js b/jscomp/test/bs_poly_mutable_map_test.js index 994478ba0c..33c3674597 100644 --- a/jscomp/test/bs_poly_mutable_map_test.js +++ b/jscomp/test/bs_poly_mutable_map_test.js @@ -1,13 +1,13 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); -var Bs_Set = require("../../lib/js/bs_Set.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_MutableMap = require("../../lib/js/bs_MutableMap.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); +var Belt_Set = require("../../lib/js/belt_Set.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); -var Bs_internalAVLtree = require("../../lib/js/bs_internalAVLtree.js"); +var Belt_MutableMap = require("../../lib/js/belt_MutableMap.js"); +var Belt_internalAVLtree = require("../../lib/js/belt_internalAVLtree.js"); var suites = [/* [] */0]; @@ -21,18 +21,18 @@ function b(loc, v) { return Mt.bool_suites(test_id, suites, loc, v); } -var Icmp = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var Icmp = Belt_Id.comparable(Caml_primitive.caml_int_compare); function f(x) { - return Bs_MutableMap.ofArray(x, Icmp); + return Belt_MutableMap.ofArray(x, Icmp); } function ff(x) { - return Bs_Set.ofArray(x, Icmp); + return Belt_Set.ofArray(x, Icmp); } function randomRange(i, j) { - return Bs_Array.map(Array_data_util.randomRange(i, j), (function (x) { + return Belt_Array.map(Array_data_util.randomRange(i, j), (function (x) { return /* tuple */[ x, x @@ -42,13 +42,13 @@ function randomRange(i, j) { var x = randomRange(0, 10); -var a0 = Bs_MutableMap.ofArray(x, Icmp); +var a0 = Belt_MutableMap.ofArray(x, Icmp); -Bs_MutableMap.set(a0, 3, 33); +Belt_MutableMap.set(a0, 3, 33); -eq("File \"bs_poly_mutable_map_test.ml\", line 27, characters 7-14", Bs_MutableMap.getExn(a0, 3), 33); +eq("File \"bs_poly_mutable_map_test.ml\", line 27, characters 7-14", Belt_MutableMap.getExn(a0, 3), 33); -Bs_MutableMap.removeMany(a0, /* array */[ +Belt_MutableMap.removeMany(a0, /* array */[ 7, 8, 0, @@ -62,14 +62,14 @@ Bs_MutableMap.removeMany(a0, /* array */[ 6 ]); -eq("File \"bs_poly_mutable_map_test.ml\", line 29, characters 7-14", Bs_internalAVLtree.keysToArray(a0.data), /* int array */[ +eq("File \"bs_poly_mutable_map_test.ml\", line 29, characters 7-14", Belt_internalAVLtree.keysToArray(a0.data), /* int array */[ 9, 10 ]); -Bs_MutableMap.removeMany(a0, Array_data_util.randomRange(0, 100)); +Belt_MutableMap.removeMany(a0, Array_data_util.randomRange(0, 100)); -b("File \"bs_poly_mutable_map_test.ml\", line 31, characters 6-13", Bs_internalAVLtree.isEmpty(a0.data)); +b("File \"bs_poly_mutable_map_test.ml\", line 31, characters 6-13", Belt_internalAVLtree.isEmpty(a0.data)); Mt.from_pair_suites("bs_poly_mutable_map_test.ml", suites[0]); diff --git a/jscomp/test/bs_poly_mutable_map_test.ml b/jscomp/test/bs_poly_mutable_map_test.ml index 09ec758dfe..5e234e6049 100644 --- a/jscomp/test/bs_poly_mutable_map_test.ml +++ b/jscomp/test/bs_poly_mutable_map_test.ml @@ -4,17 +4,17 @@ let eq loc x y = Mt.eq_suites ~suites ~test_id loc x y let b loc v = Mt.bool_suites ~suites ~test_id loc v module Icmp = - (val Bs.Id.comparable + (val Belt.Id.comparable (fun (x : int) y -> compare x y ) ) -module M = Bs.MutableMap -module N = Bs.Set +module M = Belt.MutableMap +module N = Belt.Set -module A = Bs_Array +module A = Belt.Array module I = Array_data_util -let f x = M.ofArray ~dict:(module Icmp) x -let ff x = N.ofArray ~dict:(module Icmp) x +let f x = M.ofArray ~id:(module Icmp) x +let ff x = N.ofArray ~id:(module Icmp) x let randomRange i j = @@ -32,4 +32,4 @@ let randomRange i j = -;; Mt.from_pair_suites __FILE__ !suites \ No newline at end of file +;; Mt.from_pair_suites __FILE__ !suites diff --git a/jscomp/test/bs_poly_mutable_set_test.js b/jscomp/test/bs_poly_mutable_set_test.js index c56216bfb7..4380f2a550 100644 --- a/jscomp/test/bs_poly_mutable_set_test.js +++ b/jscomp/test/bs_poly_mutable_set_test.js @@ -1,14 +1,14 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); -var Bs_List = require("../../lib/js/bs_List.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); -var Bs_MutableSet = require("../../lib/js/bs_MutableSet.js"); +var Belt_List = require("../../lib/js/belt_List.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); -var Bs_internalAVLset = require("../../lib/js/bs_internalAVLset.js"); +var Belt_MutableSet = require("../../lib/js/belt_MutableSet.js"); +var Belt_internalAVLset = require("../../lib/js/belt_internalAVLset.js"); var suites = [/* [] */0]; @@ -22,102 +22,102 @@ function b(loc, x) { return Mt.bool_suites(test_id, suites, loc, x); } -var IntCmp = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var IntCmp = Belt_Id.comparable(Caml_primitive.caml_int_compare); function ofArray(param) { - return Bs_MutableSet.ofArray(param, IntCmp); + return Belt_MutableSet.ofArray(param, IntCmp); } function empty() { return { cmp: IntCmp[/* cmp */0], - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } var u = ofArray(Array_data_util.range(0, 30)); -b("File \"bs_poly_mutable_set_test.ml\", line 18, characters 4-11", Bs_MutableSet.removeCheck(u, 0)); +b("File \"bs_poly_mutable_set_test.ml\", line 18, characters 4-11", Belt_MutableSet.removeCheck(u, 0)); -b("File \"bs_poly_mutable_set_test.ml\", line 19, characters 4-11", 1 - Bs_MutableSet.removeCheck(u, 0)); +b("File \"bs_poly_mutable_set_test.ml\", line 19, characters 4-11", 1 - Belt_MutableSet.removeCheck(u, 0)); -b("File \"bs_poly_mutable_set_test.ml\", line 20, characters 4-11", Bs_MutableSet.removeCheck(u, 30)); +b("File \"bs_poly_mutable_set_test.ml\", line 20, characters 4-11", Belt_MutableSet.removeCheck(u, 30)); -b("File \"bs_poly_mutable_set_test.ml\", line 21, characters 4-11", Bs_MutableSet.removeCheck(u, 20)); +b("File \"bs_poly_mutable_set_test.ml\", line 21, characters 4-11", Belt_MutableSet.removeCheck(u, 20)); -eq("File \"bs_poly_mutable_set_test.ml\", line 22, characters 5-12", Bs_internalAVLset.size(u.data), 28); +eq("File \"bs_poly_mutable_set_test.ml\", line 22, characters 5-12", Belt_internalAVLset.size(u.data), 28); var r = Array_data_util.randomRange(0, 30); -b("File \"bs_poly_mutable_set_test.ml\", line 24, characters 4-11", +(29 === Bs_internalAVLset.maxUndefined(u.data))); +b("File \"bs_poly_mutable_set_test.ml\", line 24, characters 4-11", +(29 === Belt_internalAVLset.maxUndefined(u.data))); -b("File \"bs_poly_mutable_set_test.ml\", line 25, characters 4-11", +(1 === Bs_internalAVLset.minUndefined(u.data))); +b("File \"bs_poly_mutable_set_test.ml\", line 25, characters 4-11", +(1 === Belt_internalAVLset.minUndefined(u.data))); -Bs_MutableSet.add(u, 3); +Belt_MutableSet.add(u, 3); for(var i = 0 ,i_finish = r.length - 1 | 0; i <= i_finish; ++i){ - Bs_MutableSet.remove(u, r[i]); + Belt_MutableSet.remove(u, r[i]); } -b("File \"bs_poly_mutable_set_test.ml\", line 30, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 30, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); -Bs_MutableSet.add(u, 0); +Belt_MutableSet.add(u, 0); -Bs_MutableSet.add(u, 1); +Belt_MutableSet.add(u, 1); -Bs_MutableSet.add(u, 2); +Belt_MutableSet.add(u, 2); -Bs_MutableSet.add(u, 0); +Belt_MutableSet.add(u, 0); -eq("File \"bs_poly_mutable_set_test.ml\", line 35, characters 5-12", Bs_internalAVLset.size(u.data), 3); +eq("File \"bs_poly_mutable_set_test.ml\", line 35, characters 5-12", Belt_internalAVLset.size(u.data), 3); -b("File \"bs_poly_mutable_set_test.ml\", line 36, characters 4-11", 1 - Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 36, characters 4-11", 1 - Belt_internalAVLset.isEmpty(u.data)); for(var i$1 = 0; i$1 <= 3; ++i$1){ - Bs_MutableSet.remove(u, i$1); + Belt_MutableSet.remove(u, i$1); } -b("File \"bs_poly_mutable_set_test.ml\", line 40, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 40, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); -Bs_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 20000)); +Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 20000)); -Bs_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 200)); +Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 200)); -eq("File \"bs_poly_mutable_set_test.ml\", line 43, characters 5-12", Bs_internalAVLset.size(u.data), 20001); +eq("File \"bs_poly_mutable_set_test.ml\", line 43, characters 5-12", Belt_internalAVLset.size(u.data), 20001); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(0, 200)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 200)); -eq("File \"bs_poly_mutable_set_test.ml\", line 45, characters 5-12", Bs_internalAVLset.size(u.data), 19800); +eq("File \"bs_poly_mutable_set_test.ml\", line 45, characters 5-12", Belt_internalAVLset.size(u.data), 19800); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); -eq("File \"bs_poly_mutable_set_test.ml\", line 47, characters 5-12", Bs_internalAVLset.size(u.data), 19000); +eq("File \"bs_poly_mutable_set_test.ml\", line 47, characters 5-12", Belt_internalAVLset.size(u.data), 19000); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); -eq("File \"bs_poly_mutable_set_test.ml\", line 49, characters 5-12", Bs_internalAVLset.size(u.data), 19000); +eq("File \"bs_poly_mutable_set_test.ml\", line 49, characters 5-12", Belt_internalAVLset.size(u.data), 19000); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(1000, 10000)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(1000, 10000)); -eq("File \"bs_poly_mutable_set_test.ml\", line 51, characters 5-12", Bs_internalAVLset.size(u.data), 10000); +eq("File \"bs_poly_mutable_set_test.ml\", line 51, characters 5-12", Belt_internalAVLset.size(u.data), 10000); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 19999)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 19999)); -eq("File \"bs_poly_mutable_set_test.ml\", line 53, characters 5-12", Bs_internalAVLset.size(u.data), 1); +eq("File \"bs_poly_mutable_set_test.ml\", line 53, characters 5-12", Belt_internalAVLset.size(u.data), 1); -b("File \"bs_poly_mutable_set_test.ml\", line 54, characters 4-11", Bs_MutableSet.has(u, 20000)); +b("File \"bs_poly_mutable_set_test.ml\", line 54, characters 4-11", Belt_MutableSet.has(u, 20000)); -Bs_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 30000)); +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 30000)); -b("File \"bs_poly_mutable_set_test.ml\", line 56, characters 4-11", Bs_internalAVLset.isEmpty(u.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 56, characters 4-11", Belt_internalAVLset.isEmpty(u.data)); var v = ofArray(Array_data_util.randomRange(1000, 2000)); -var bs = Bs_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { - return Bs_MutableSet.removeCheck(v, x); +var bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), (function (x) { + return Belt_MutableSet.removeCheck(v, x); })); -var indeedRemoved = Bs_Array.reduce(bs, 0, (function (acc, x) { +var indeedRemoved = Belt_Array.reduce(bs, 0, (function (acc, x) { if (x) { return acc + 1 | 0; } else { @@ -127,13 +127,13 @@ var indeedRemoved = Bs_Array.reduce(bs, 0, (function (acc, x) { eq("File \"bs_poly_mutable_set_test.ml\", line 63, characters 5-12", indeedRemoved, 500); -eq("File \"bs_poly_mutable_set_test.ml\", line 64, characters 5-12", Bs_internalAVLset.size(v.data), 501); +eq("File \"bs_poly_mutable_set_test.ml\", line 64, characters 5-12", Belt_internalAVLset.size(v.data), 501); -var cs = Bs_Array.map(Array_data_util.randomRange(500, 2000), (function (x) { - return Bs_MutableSet.addCheck(v, x); +var cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), (function (x) { + return Belt_MutableSet.addCheck(v, x); })); -var indeedAded = Bs_Array.reduce(cs, 0, (function (acc, x) { +var indeedAded = Belt_Array.reduce(cs, 0, (function (acc, x) { if (x) { return acc + 1 | 0; } else { @@ -143,42 +143,42 @@ var indeedAded = Bs_Array.reduce(cs, 0, (function (acc, x) { eq("File \"bs_poly_mutable_set_test.ml\", line 67, characters 5-12", indeedAded, 1000); -eq("File \"bs_poly_mutable_set_test.ml\", line 68, characters 5-12", Bs_internalAVLset.size(v.data), 1501); +eq("File \"bs_poly_mutable_set_test.ml\", line 68, characters 5-12", Belt_internalAVLset.size(v.data), 1501); var d = { cmp: IntCmp[/* cmp */0], - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; -b("File \"bs_poly_mutable_set_test.ml\", line 69, characters 4-11", Bs_internalAVLset.isEmpty(d.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 69, characters 4-11", Belt_internalAVLset.isEmpty(d.data)); -eq("File \"bs_poly_mutable_set_test.ml\", line 70, characters 5-12", Bs_internalAVLset.minimum(v.data), /* Some */[500]); +eq("File \"bs_poly_mutable_set_test.ml\", line 70, characters 5-12", Belt_internalAVLset.minimum(v.data), /* Some */[500]); -eq("File \"bs_poly_mutable_set_test.ml\", line 71, characters 5-12", Bs_internalAVLset.maximum(v.data), /* Some */[2000]); +eq("File \"bs_poly_mutable_set_test.ml\", line 71, characters 5-12", Belt_internalAVLset.maximum(v.data), /* Some */[2000]); -eq("File \"bs_poly_mutable_set_test.ml\", line 72, characters 5-12", Bs_internalAVLset.minUndefined(v.data), 500); +eq("File \"bs_poly_mutable_set_test.ml\", line 72, characters 5-12", Belt_internalAVLset.minUndefined(v.data), 500); -eq("File \"bs_poly_mutable_set_test.ml\", line 73, characters 5-12", Bs_internalAVLset.maxUndefined(v.data), 2000); +eq("File \"bs_poly_mutable_set_test.ml\", line 73, characters 5-12", Belt_internalAVLset.maxUndefined(v.data), 2000); -eq("File \"bs_poly_mutable_set_test.ml\", line 74, characters 5-12", Bs_MutableSet.reduce(v, 0, (function (x, y) { +eq("File \"bs_poly_mutable_set_test.ml\", line 74, characters 5-12", Belt_MutableSet.reduce(v, 0, (function (x, y) { return x + y | 0; })), 1876250); -b("File \"bs_poly_mutable_set_test.ml\", line 75, characters 4-11", Bs_List.eq(Bs_internalAVLset.toList(v.data), Bs_List.makeBy(1501, (function (i) { +b("File \"bs_poly_mutable_set_test.ml\", line 75, characters 4-11", Belt_List.eq(Belt_internalAVLset.toList(v.data), Belt_List.makeBy(1501, (function (i) { return i + 500 | 0; })), (function (x, y) { return +(x === y); }))); -eq("File \"bs_poly_mutable_set_test.ml\", line 76, characters 5-12", Bs_internalAVLset.toArray(v.data), Array_data_util.range(500, 2000)); +eq("File \"bs_poly_mutable_set_test.ml\", line 76, characters 5-12", Belt_internalAVLset.toArray(v.data), Array_data_util.range(500, 2000)); -b("File \"bs_poly_mutable_set_test.ml\", line 77, characters 4-11", Bs_internalAVLset.checkInvariantInternal(v.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 77, characters 4-11", Belt_internalAVLset.checkInvariantInternal(v.data)); -eq("File \"bs_poly_mutable_set_test.ml\", line 78, characters 5-12", Bs_MutableSet.get(v, 3), /* None */0); +eq("File \"bs_poly_mutable_set_test.ml\", line 78, characters 5-12", Belt_MutableSet.get(v, 3), /* None */0); -eq("File \"bs_poly_mutable_set_test.ml\", line 79, characters 5-12", Bs_MutableSet.get(v, 1200), /* Some */[1200]); +eq("File \"bs_poly_mutable_set_test.ml\", line 79, characters 5-12", Belt_MutableSet.get(v, 1200), /* Some */[1200]); -var match = Bs_MutableSet.split(v, 1000); +var match = Belt_MutableSet.split(v, 1000); var match$1 = match[0]; @@ -188,23 +188,23 @@ var aa = match$1[0]; b("File \"bs_poly_mutable_set_test.ml\", line 81, characters 4-11", match[1]); -b("File \"bs_poly_mutable_set_test.ml\", line 82, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(aa.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); +b("File \"bs_poly_mutable_set_test.ml\", line 82, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(aa.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); -b("File \"bs_poly_mutable_set_test.ml\", line 83, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(bb.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); +b("File \"bs_poly_mutable_set_test.ml\", line 83, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(bb.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); -b("File \"bs_poly_mutable_set_test.ml\", line 84, characters 5-12", Bs_MutableSet.subset(aa, v)); +b("File \"bs_poly_mutable_set_test.ml\", line 84, characters 5-12", Belt_MutableSet.subset(aa, v)); -b("File \"bs_poly_mutable_set_test.ml\", line 85, characters 4-11", Bs_MutableSet.subset(bb, v)); +b("File \"bs_poly_mutable_set_test.ml\", line 85, characters 4-11", Belt_MutableSet.subset(bb, v)); -var d$1 = Bs_MutableSet.intersect(aa, bb); +var d$1 = Belt_MutableSet.intersect(aa, bb); -b("File \"bs_poly_mutable_set_test.ml\", line 86, characters 4-11", Bs_internalAVLset.isEmpty(d$1.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 86, characters 4-11", Belt_internalAVLset.isEmpty(d$1.data)); -var c = Bs_MutableSet.removeCheck(v, 1000); +var c = Belt_MutableSet.removeCheck(v, 1000); b("File \"bs_poly_mutable_set_test.ml\", line 88, characters 4-11", c); -var match$2 = Bs_MutableSet.split(v, 1000); +var match$2 = Belt_MutableSet.split(v, 1000); var match$3 = match$2[0]; @@ -214,43 +214,43 @@ var aa$1 = match$3[0]; b("File \"bs_poly_mutable_set_test.ml\", line 90, characters 4-11", 1 - match$2[1]); -b("File \"bs_poly_mutable_set_test.ml\", line 91, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(aa$1.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); +b("File \"bs_poly_mutable_set_test.ml\", line 91, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(aa$1.data), Array_data_util.range(500, 999), Caml_obj.caml_equal)); -b("File \"bs_poly_mutable_set_test.ml\", line 92, characters 4-11", Bs_Array.eq(Bs_internalAVLset.toArray(bb$1.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); +b("File \"bs_poly_mutable_set_test.ml\", line 92, characters 4-11", Belt_Array.eq(Belt_internalAVLset.toArray(bb$1.data), Array_data_util.range(1001, 2000), Caml_obj.caml_equal)); -b("File \"bs_poly_mutable_set_test.ml\", line 93, characters 5-12", Bs_MutableSet.subset(aa$1, v)); +b("File \"bs_poly_mutable_set_test.ml\", line 93, characters 5-12", Belt_MutableSet.subset(aa$1, v)); -b("File \"bs_poly_mutable_set_test.ml\", line 94, characters 4-11", Bs_MutableSet.subset(bb$1, v)); +b("File \"bs_poly_mutable_set_test.ml\", line 94, characters 4-11", Belt_MutableSet.subset(bb$1, v)); -var d$2 = Bs_MutableSet.intersect(aa$1, bb$1); +var d$2 = Belt_MutableSet.intersect(aa$1, bb$1); -b("File \"bs_poly_mutable_set_test.ml\", line 95, characters 4-11", Bs_internalAVLset.isEmpty(d$2.data)); +b("File \"bs_poly_mutable_set_test.ml\", line 95, characters 4-11", Belt_internalAVLset.isEmpty(d$2.data)); var aa$2 = ofArray(Array_data_util.randomRange(0, 100)); var bb$2 = ofArray(Array_data_util.randomRange(40, 120)); -var cc = Bs_MutableSet.union(aa$2, bb$2); +var cc = Belt_MutableSet.union(aa$2, bb$2); -b("File \"bs_poly_mutable_set_test.ml\", line 104, characters 4-11", Bs_MutableSet.eq(cc, ofArray(Array_data_util.randomRange(0, 120)))); +b("File \"bs_poly_mutable_set_test.ml\", line 104, characters 4-11", Belt_MutableSet.eq(cc, ofArray(Array_data_util.randomRange(0, 120)))); -b("File \"bs_poly_mutable_set_test.ml\", line 106, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.union(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), ofArray(Array_data_util.randomRange(0, 40)))); +b("File \"bs_poly_mutable_set_test.ml\", line 106, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.union(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), ofArray(Array_data_util.randomRange(0, 40)))); -var dd = Bs_MutableSet.intersect(aa$2, bb$2); +var dd = Belt_MutableSet.intersect(aa$2, bb$2); -b("File \"bs_poly_mutable_set_test.ml\", line 111, characters 4-11", Bs_MutableSet.eq(dd, ofArray(Array_data_util.randomRange(40, 100)))); +b("File \"bs_poly_mutable_set_test.ml\", line 111, characters 4-11", Belt_MutableSet.eq(dd, ofArray(Array_data_util.randomRange(40, 100)))); -b("File \"bs_poly_mutable_set_test.ml\", line 112, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.intersect(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), { +b("File \"bs_poly_mutable_set_test.ml\", line 112, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), { cmp: IntCmp[/* cmp */0], - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); -b("File \"bs_poly_mutable_set_test.ml\", line 118, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.intersect(ofArray(Array_data_util.randomRange(21, 40)), ofArray(Array_data_util.randomRange(0, 20))), { +b("File \"bs_poly_mutable_set_test.ml\", line 118, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(ofArray(Array_data_util.randomRange(21, 40)), ofArray(Array_data_util.randomRange(0, 20))), { cmp: IntCmp[/* cmp */0], - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty })); -b("File \"bs_poly_mutable_set_test.ml\", line 124, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.intersect(ofArray(/* array */[ +b("File \"bs_poly_mutable_set_test.ml\", line 124, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(ofArray(/* array */[ 1, 3, 4, @@ -269,27 +269,27 @@ b("File \"bs_poly_mutable_set_test.ml\", line 124, characters 4-11", Bs_MutableS 5 ]))); -b("File \"bs_poly_mutable_set_test.ml\", line 130, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.diff(aa$2, bb$2), ofArray(Array_data_util.randomRange(0, 39)))); +b("File \"bs_poly_mutable_set_test.ml\", line 130, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(aa$2, bb$2), ofArray(Array_data_util.randomRange(0, 39)))); -b("File \"bs_poly_mutable_set_test.ml\", line 132, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.diff(bb$2, aa$2), ofArray(Array_data_util.randomRange(101, 120)))); +b("File \"bs_poly_mutable_set_test.ml\", line 132, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(bb$2, aa$2), ofArray(Array_data_util.randomRange(101, 120)))); -b("File \"bs_poly_mutable_set_test.ml\", line 134, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.diff(ofArray(Array_data_util.randomRange(21, 40)), ofArray(Array_data_util.randomRange(0, 20))), ofArray(Array_data_util.randomRange(21, 40)))); +b("File \"bs_poly_mutable_set_test.ml\", line 134, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(ofArray(Array_data_util.randomRange(21, 40)), ofArray(Array_data_util.randomRange(0, 20))), ofArray(Array_data_util.randomRange(21, 40)))); -b("File \"bs_poly_mutable_set_test.ml\", line 140, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.diff(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), ofArray(Array_data_util.randomRange(0, 20)))); +b("File \"bs_poly_mutable_set_test.ml\", line 140, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(21, 40))), ofArray(Array_data_util.randomRange(0, 20)))); -b("File \"bs_poly_mutable_set_test.ml\", line 147, characters 4-11", Bs_MutableSet.eq(Bs_MutableSet.diff(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(0, 40))), ofArray(Array_data_util.randomRange(0, -1)))); +b("File \"bs_poly_mutable_set_test.ml\", line 147, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(ofArray(Array_data_util.randomRange(0, 20)), ofArray(Array_data_util.randomRange(0, 40))), ofArray(Array_data_util.randomRange(0, -1)))); var a0 = ofArray(Array_data_util.randomRange(0, 1000)); -var a1 = Bs_MutableSet.keep(a0, (function (x) { +var a1 = Belt_MutableSet.keep(a0, (function (x) { return +(x % 2 === 0); })); -var a2 = Bs_MutableSet.keep(a0, (function (x) { +var a2 = Belt_MutableSet.keep(a0, (function (x) { return +(x % 2 !== 0); })); -var match$4 = Bs_MutableSet.partition(a0, (function (x) { +var match$4 = Belt_MutableSet.partition(a0, (function (x) { return +(x % 2 === 0); })); @@ -297,11 +297,11 @@ var a4 = match$4[1]; var a3 = match$4[0]; -b("File \"bs_poly_mutable_set_test.ml\", line 162, characters 4-11", Bs_MutableSet.eq(a1, a3)); +b("File \"bs_poly_mutable_set_test.ml\", line 162, characters 4-11", Belt_MutableSet.eq(a1, a3)); -b("File \"bs_poly_mutable_set_test.ml\", line 163, characters 4-11", Bs_MutableSet.eq(a2, a4)); +b("File \"bs_poly_mutable_set_test.ml\", line 163, characters 4-11", Belt_MutableSet.eq(a2, a4)); -b("File \"bs_poly_mutable_set_test.ml\", line 164, characters 4-11", Bs_List.every(/* :: */[ +b("File \"bs_poly_mutable_set_test.ml\", line 164, characters 4-11", Belt_List.every(/* :: */[ a0, /* :: */[ a1, @@ -317,7 +317,7 @@ b("File \"bs_poly_mutable_set_test.ml\", line 164, characters 4-11", Bs_List.eve ] ] ], (function (x) { - return Bs_internalAVLset.checkInvariantInternal(x.data); + return Belt_internalAVLset.checkInvariantInternal(x.data); }))); Mt.from_pair_suites("bs_poly_mutable_set_test.ml", suites[0]); @@ -330,11 +330,11 @@ var A = 0; var L = 0; -var $plus$plus = Bs_MutableSet.union; +var $plus$plus = Belt_MutableSet.union; var f = ofArray; -var $eq$tilde = Bs_MutableSet.eq; +var $eq$tilde = Belt_MutableSet.eq; exports.suites = suites; exports.test_id = test_id; diff --git a/jscomp/test/bs_poly_mutable_set_test.ml b/jscomp/test/bs_poly_mutable_set_test.ml index b746feca12..d01feaf7aa 100644 --- a/jscomp/test/bs_poly_mutable_set_test.ml +++ b/jscomp/test/bs_poly_mutable_set_test.ml @@ -3,14 +3,14 @@ let test_id = ref 0 let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x -module N = Bs.MutableSet +module N = Belt.MutableSet module I = Array_data_util -module A = Bs.Array +module A = Belt.Array module IntCmp = - (val Bs.Id.comparable (fun (x:int) y -> compare x y)) -module L = Bs.List -let ofArray = N.ofArray ~dict:(module IntCmp) -let empty () = N.make ~dict:(module IntCmp) + (val Belt.Id.comparable (fun (x:int) y -> compare x y)) +module L = Belt.List +let ofArray = N.ofArray ~id:(module IntCmp) +let empty () = N.make ~id:(module IntCmp) let () = diff --git a/jscomp/test/bs_poly_set_test.js b/jscomp/test/bs_poly_set_test.js index f0089b767f..c8edd56eec 100644 --- a/jscomp/test/bs_poly_set_test.js +++ b/jscomp/test/bs_poly_set_test.js @@ -1,12 +1,12 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Id = require("../../lib/js/bs_Id.js"); -var Bs_Set = require("../../lib/js/bs_Set.js"); -var Bs_List = require("../../lib/js/bs_List.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); +var Belt_Id = require("../../lib/js/belt_Id.js"); +var Belt_Set = require("../../lib/js/belt_Set.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); -var Bs_SetDict = require("../../lib/js/bs_SetDict.js"); +var Belt_List = require("../../lib/js/belt_List.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_SetDict = require("../../lib/js/belt_SetDict.js"); var Caml_primitive = require("../../lib/js/caml_primitive.js"); var Array_data_util = require("./array_data_util.js"); @@ -26,229 +26,229 @@ function t(loc, x) { return Mt.throw_suites(test_id, suites, loc, x); } -var IntCmp = Bs_Id.comparable(Caml_primitive.caml_int_compare); +var IntCmp = Belt_Id.comparable(Caml_primitive.caml_int_compare); -var u0 = Bs_Set.ofArray(Array_data_util.range(0, 30), IntCmp); +var u0 = Belt_Set.ofArray(Array_data_util.range(0, 30), IntCmp); -var u1 = Bs_Set.remove(u0, 0); +var u1 = Belt_Set.remove(u0, 0); -var u2 = Bs_Set.remove(u1, 0); +var u2 = Belt_Set.remove(u1, 0); -var u3 = Bs_Set.remove(u2, 30); +var u3 = Belt_Set.remove(u2, 30); -var u4 = Bs_Set.remove(u3, 20); +var u4 = Belt_Set.remove(u3, 20); var r = Array_data_util.randomRange(0, 30); -var u5 = Bs_Set.add(u4, 3); +var u5 = Belt_Set.add(u4, 3); -var u6 = Bs_Set.removeMany(u5, r); +var u6 = Belt_Set.removeMany(u5, r); -var u7 = Bs_Set.mergeMany(u6, /* int array */[ +var u7 = Belt_Set.mergeMany(u6, /* int array */[ 0, 1, 2, 0 ]); -var u8 = Bs_Set.removeMany(u7, /* int array */[ +var u8 = Belt_Set.removeMany(u7, /* int array */[ 0, 1, 2, 3 ]); -var u9 = Bs_Set.mergeMany(u8, Array_data_util.randomRange(0, 20000)); +var u9 = Belt_Set.mergeMany(u8, Array_data_util.randomRange(0, 20000)); -var u10 = Bs_Set.mergeMany(u9, Array_data_util.randomRange(0, 200)); +var u10 = Belt_Set.mergeMany(u9, Array_data_util.randomRange(0, 200)); -var u11 = Bs_Set.removeMany(u10, Array_data_util.randomRange(0, 200)); +var u11 = Belt_Set.removeMany(u10, Array_data_util.randomRange(0, 200)); -var u12 = Bs_Set.removeMany(u11, Array_data_util.randomRange(0, 1000)); +var u12 = Belt_Set.removeMany(u11, Array_data_util.randomRange(0, 1000)); -var u13 = Bs_Set.removeMany(u12, Array_data_util.randomRange(0, 1000)); +var u13 = Belt_Set.removeMany(u12, Array_data_util.randomRange(0, 1000)); -var u14 = Bs_Set.removeMany(u13, Array_data_util.randomRange(1000, 10000)); +var u14 = Belt_Set.removeMany(u13, Array_data_util.randomRange(1000, 10000)); -var u15 = Bs_Set.removeMany(u14, Array_data_util.randomRange(10000, 19999)); +var u15 = Belt_Set.removeMany(u14, Array_data_util.randomRange(10000, 19999)); -var u16 = Bs_Set.removeMany(u15, Array_data_util.randomRange(20000, 21000)); +var u16 = Belt_Set.removeMany(u15, Array_data_util.randomRange(20000, 21000)); b("File \"bs_poly_set_test.ml\", line 33, characters 4-11", +(u0 !== u1)); b("File \"bs_poly_set_test.ml\", line 34, characters 4-11", +(u2 === u1)); -eq("File \"bs_poly_set_test.ml\", line 35, characters 5-12", Bs_SetDict.size(u4.data), 28); +eq("File \"bs_poly_set_test.ml\", line 35, characters 5-12", Belt_SetDict.size(u4.data), 28); -b("File \"bs_poly_set_test.ml\", line 36, characters 4-11", +(29 === Bs_SetDict.maxUndefined(u4.data))); +b("File \"bs_poly_set_test.ml\", line 36, characters 4-11", +(29 === Belt_SetDict.maxUndefined(u4.data))); -b("File \"bs_poly_set_test.ml\", line 37, characters 4-11", +(1 === Bs_SetDict.minUndefined(u4.data))); +b("File \"bs_poly_set_test.ml\", line 37, characters 4-11", +(1 === Belt_SetDict.minUndefined(u4.data))); b("File \"bs_poly_set_test.ml\", line 38, characters 4-11", +(u4 === u5)); -b("File \"bs_poly_set_test.ml\", line 39, characters 4-11", Bs_SetDict.isEmpty(u6.data)); +b("File \"bs_poly_set_test.ml\", line 39, characters 4-11", Belt_SetDict.isEmpty(u6.data)); -eq("File \"bs_poly_set_test.ml\", line 40, characters 6-13", Bs_SetDict.size(u7.data), 3); +eq("File \"bs_poly_set_test.ml\", line 40, characters 6-13", Belt_SetDict.size(u7.data), 3); -b("File \"bs_poly_set_test.ml\", line 41, characters 4-11", 1 - Bs_SetDict.isEmpty(u7.data)); +b("File \"bs_poly_set_test.ml\", line 41, characters 4-11", 1 - Belt_SetDict.isEmpty(u7.data)); -b("File \"bs_poly_set_test.ml\", line 42, characters 4-11", Bs_SetDict.isEmpty(u8.data)); +b("File \"bs_poly_set_test.ml\", line 42, characters 4-11", Belt_SetDict.isEmpty(u8.data)); -b("File \"bs_poly_set_test.ml\", line 45, characters 4-11", Bs_Set.has(u10, 20)); +b("File \"bs_poly_set_test.ml\", line 45, characters 4-11", Belt_Set.has(u10, 20)); -b("File \"bs_poly_set_test.ml\", line 46, characters 4-11", Bs_Set.has(u10, 21)); +b("File \"bs_poly_set_test.ml\", line 46, characters 4-11", Belt_Set.has(u10, 21)); -eq("File \"bs_poly_set_test.ml\", line 47, characters 5-12", Bs_SetDict.size(u10.data), 20001); +eq("File \"bs_poly_set_test.ml\", line 47, characters 5-12", Belt_SetDict.size(u10.data), 20001); -eq("File \"bs_poly_set_test.ml\", line 48, characters 5-12", Bs_SetDict.size(u11.data), 19800); +eq("File \"bs_poly_set_test.ml\", line 48, characters 5-12", Belt_SetDict.size(u11.data), 19800); -eq("File \"bs_poly_set_test.ml\", line 49, characters 5-12", Bs_SetDict.size(u12.data), 19000); +eq("File \"bs_poly_set_test.ml\", line 49, characters 5-12", Belt_SetDict.size(u12.data), 19000); -eq("File \"bs_poly_set_test.ml\", line 51, characters 5-12", Bs_SetDict.size(u13.data), Bs_SetDict.size(u12.data)); +eq("File \"bs_poly_set_test.ml\", line 51, characters 5-12", Belt_SetDict.size(u13.data), Belt_SetDict.size(u12.data)); -eq("File \"bs_poly_set_test.ml\", line 52, characters 5-12", Bs_SetDict.size(u14.data), 10000); +eq("File \"bs_poly_set_test.ml\", line 52, characters 5-12", Belt_SetDict.size(u14.data), 10000); -eq("File \"bs_poly_set_test.ml\", line 53, characters 5-12", Bs_SetDict.size(u15.data), 1); +eq("File \"bs_poly_set_test.ml\", line 53, characters 5-12", Belt_SetDict.size(u15.data), 1); -b("File \"bs_poly_set_test.ml\", line 54, characters 4-11", Bs_Set.has(u15, 20000)); +b("File \"bs_poly_set_test.ml\", line 54, characters 4-11", Belt_Set.has(u15, 20000)); -b("File \"bs_poly_set_test.ml\", line 55, characters 4-11", 1 - Bs_Set.has(u15, 2000)); +b("File \"bs_poly_set_test.ml\", line 55, characters 4-11", 1 - Belt_Set.has(u15, 2000)); -b("File \"bs_poly_set_test.ml\", line 56, characters 4-11", Bs_SetDict.isEmpty(u16.data)); +b("File \"bs_poly_set_test.ml\", line 56, characters 4-11", Belt_SetDict.isEmpty(u16.data)); -var u17 = Bs_Set.ofArray(Array_data_util.randomRange(0, 100), IntCmp); +var u17 = Belt_Set.ofArray(Array_data_util.randomRange(0, 100), IntCmp); -var u18 = Bs_Set.ofArray(Array_data_util.randomRange(59, 200), IntCmp); +var u18 = Belt_Set.ofArray(Array_data_util.randomRange(59, 200), IntCmp); -var u19 = Bs_Set.union(u17, u18); +var u19 = Belt_Set.union(u17, u18); -var u20 = Bs_Set.ofArray(Array_data_util.randomRange(0, 200), IntCmp); +var u20 = Belt_Set.ofArray(Array_data_util.randomRange(0, 200), IntCmp); -b("File \"bs_poly_set_test.ml\", line 61, characters 4-11", Bs_Set.eq(u19, u20)); +b("File \"bs_poly_set_test.ml\", line 61, characters 4-11", Belt_Set.eq(u19, u20)); -var u21 = Bs_Set.intersect(u17, u18); +var u21 = Belt_Set.intersect(u17, u18); -eq("File \"bs_poly_set_test.ml\", line 63, characters 5-12", Bs_SetDict.toArray(u21.data), Array_data_util.range(59, 100)); +eq("File \"bs_poly_set_test.ml\", line 63, characters 5-12", Belt_SetDict.toArray(u21.data), Array_data_util.range(59, 100)); -var u22 = Bs_Set.diff(u17, u18); +var u22 = Belt_Set.diff(u17, u18); -eq("File \"bs_poly_set_test.ml\", line 65, characters 5-12", Bs_SetDict.toArray(u22.data), Array_data_util.range(0, 58)); +eq("File \"bs_poly_set_test.ml\", line 65, characters 5-12", Belt_SetDict.toArray(u22.data), Array_data_util.range(0, 58)); -var u23 = Bs_Set.diff(u18, u17); +var u23 = Belt_Set.diff(u18, u17); -var u24 = Bs_Set.union(u18, u17); +var u24 = Belt_Set.union(u18, u17); -b("File \"bs_poly_set_test.ml\", line 68, characters 4-11", Bs_Set.eq(u24, u19)); +b("File \"bs_poly_set_test.ml\", line 68, characters 4-11", Belt_Set.eq(u24, u19)); -eq("File \"bs_poly_set_test.ml\", line 69, characters 5-12", Bs_SetDict.toArray(u23.data), Array_data_util.range(101, 200)); +eq("File \"bs_poly_set_test.ml\", line 69, characters 5-12", Belt_SetDict.toArray(u23.data), Array_data_util.range(101, 200)); -b("File \"bs_poly_set_test.ml\", line 70, characters 4-11", Bs_Set.subset(u23, u18)); +b("File \"bs_poly_set_test.ml\", line 70, characters 4-11", Belt_Set.subset(u23, u18)); -b("File \"bs_poly_set_test.ml\", line 71, characters 4-11", 1 - Bs_Set.subset(u18, u23)); +b("File \"bs_poly_set_test.ml\", line 71, characters 4-11", 1 - Belt_Set.subset(u18, u23)); -b("File \"bs_poly_set_test.ml\", line 72, characters 4-11", Bs_Set.subset(u22, u17)); +b("File \"bs_poly_set_test.ml\", line 72, characters 4-11", Belt_Set.subset(u22, u17)); -b("File \"bs_poly_set_test.ml\", line 73, characters 4-11", Bs_Set.subset(u21, u17) && Bs_Set.subset(u21, u18)); +b("File \"bs_poly_set_test.ml\", line 73, characters 4-11", Belt_Set.subset(u21, u17) && Belt_Set.subset(u21, u18)); -b("File \"bs_poly_set_test.ml\", line 74, characters 4-11", +(47 === Bs_Set.getUndefined(u22, 47))); +b("File \"bs_poly_set_test.ml\", line 74, characters 4-11", +(47 === Belt_Set.getUndefined(u22, 47))); -b("File \"bs_poly_set_test.ml\", line 75, characters 4-11", Caml_obj.caml_equal(/* Some */[47], Bs_Set.get(u22, 47))); +b("File \"bs_poly_set_test.ml\", line 75, characters 4-11", Caml_obj.caml_equal(/* Some */[47], Belt_Set.get(u22, 47))); -b("File \"bs_poly_set_test.ml\", line 76, characters 4-11", +(Bs_Set.getUndefined(u22, 59) === undefined)); +b("File \"bs_poly_set_test.ml\", line 76, characters 4-11", +(Belt_Set.getUndefined(u22, 59) === undefined)); -b("File \"bs_poly_set_test.ml\", line 77, characters 4-11", +(/* None */0 === Bs_Set.get(u22, 59))); +b("File \"bs_poly_set_test.ml\", line 77, characters 4-11", +(/* None */0 === Belt_Set.get(u22, 59))); -var u25 = Bs_Set.add(u22, 59); +var u25 = Belt_Set.add(u22, 59); -eq("File \"bs_poly_set_test.ml\", line 79, characters 5-12", Bs_SetDict.size(u25.data), 60); +eq("File \"bs_poly_set_test.ml\", line 79, characters 5-12", Belt_SetDict.size(u25.data), 60); var m = { cmp: IntCmp[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }; -b("File \"bs_poly_set_test.ml\", line 80, characters 4-11", +(Bs_SetDict.minimum(m.data) === /* None */0)); +b("File \"bs_poly_set_test.ml\", line 80, characters 4-11", +(Belt_SetDict.minimum(m.data) === /* None */0)); var m$1 = { cmp: IntCmp[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }; -b("File \"bs_poly_set_test.ml\", line 81, characters 4-11", +(Bs_SetDict.maximum(m$1.data) === /* None */0)); +b("File \"bs_poly_set_test.ml\", line 81, characters 4-11", +(Belt_SetDict.maximum(m$1.data) === /* None */0)); var m$2 = { cmp: IntCmp[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }; -b("File \"bs_poly_set_test.ml\", line 82, characters 4-11", +(Bs_SetDict.minUndefined(m$2.data) === undefined)); +b("File \"bs_poly_set_test.ml\", line 82, characters 4-11", +(Belt_SetDict.minUndefined(m$2.data) === undefined)); var m$3 = { cmp: IntCmp[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }; -b("File \"bs_poly_set_test.ml\", line 83, characters 4-11", +(Bs_SetDict.maxUndefined(m$3.data) === undefined)); +b("File \"bs_poly_set_test.ml\", line 83, characters 4-11", +(Belt_SetDict.maxUndefined(m$3.data) === undefined)); function testIterToList(xs) { var v = [/* [] */0]; - Bs_Set.forEach(xs, (function (x) { + Belt_Set.forEach(xs, (function (x) { v[0] = /* :: */[ x, v[0] ]; return /* () */0; })); - return Bs_List.reverse(v[0]); + return Belt_List.reverse(v[0]); } -var u0$1 = Bs_Set.ofArray(Array_data_util.randomRange(0, 20), IntCmp); +var u0$1 = Belt_Set.ofArray(Array_data_util.randomRange(0, 20), IntCmp); -var u1$1 = Bs_Set.remove(u0$1, 17); +var u1$1 = Belt_Set.remove(u0$1, 17); -var u2$1 = Bs_Set.add(u1$1, 33); +var u2$1 = Belt_Set.add(u1$1, 33); -b("File \"bs_poly_set_test.ml\", line 94, characters 4-11", Bs_List.every2(testIterToList(u0$1), Bs_List.makeBy(21, (function (i) { +b("File \"bs_poly_set_test.ml\", line 94, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_List.makeBy(21, (function (i) { return i; })), (function (x, y) { return +(x === y); }))); -b("File \"bs_poly_set_test.ml\", line 95, characters 4-11", Bs_List.every2(testIterToList(u0$1), Bs_SetDict.toList(u0$1.data), (function (x, y) { +b("File \"bs_poly_set_test.ml\", line 95, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_SetDict.toList(u0$1.data), (function (x, y) { return +(x === y); }))); -b("File \"bs_poly_set_test.ml\", line 96, characters 4-11", Bs_Set.some(u0$1, (function (x) { +b("File \"bs_poly_set_test.ml\", line 96, characters 4-11", Belt_Set.some(u0$1, (function (x) { return +(x === 17); }))); -b("File \"bs_poly_set_test.ml\", line 97, characters 4-11", 1 - Bs_Set.some(u1$1, (function (x) { +b("File \"bs_poly_set_test.ml\", line 97, characters 4-11", 1 - Belt_Set.some(u1$1, (function (x) { return +(x === 17); }))); -b("File \"bs_poly_set_test.ml\", line 98, characters 4-11", Bs_Set.every(u0$1, (function (x) { +b("File \"bs_poly_set_test.ml\", line 98, characters 4-11", Belt_Set.every(u0$1, (function (x) { return +(x < 24); }))); -b("File \"bs_poly_set_test.ml\", line 99, characters 4-11", 1 - Bs_Set.every(u2$1, (function (x) { +b("File \"bs_poly_set_test.ml\", line 99, characters 4-11", 1 - Belt_Set.every(u2$1, (function (x) { return +(x < 24); }))); -b("File \"bs_poly_set_test.ml\", line 100, characters 4-11", +(Bs_Set.cmp(u1$1, u0$1) < 0)); +b("File \"bs_poly_set_test.ml\", line 100, characters 4-11", +(Belt_Set.cmp(u1$1, u0$1) < 0)); -b("File \"bs_poly_set_test.ml\", line 101, characters 4-11", +(Bs_Set.cmp(u0$1, u1$1) > 0)); +b("File \"bs_poly_set_test.ml\", line 101, characters 4-11", +(Belt_Set.cmp(u0$1, u1$1) > 0)); -var a0 = Bs_Set.ofArray(Array_data_util.randomRange(0, 1000), IntCmp); +var a0 = Belt_Set.ofArray(Array_data_util.randomRange(0, 1000), IntCmp); -var a1 = Bs_Set.keep(a0, (function (x) { +var a1 = Belt_Set.keep(a0, (function (x) { return +(x % 2 === 0); })); -var a2 = Bs_Set.keep(a0, (function (x) { +var a2 = Belt_Set.keep(a0, (function (x) { return +(x % 2 !== 0); })); -var match = Bs_Set.partition(a0, (function (x) { +var match = Belt_Set.partition(a0, (function (x) { return +(x % 2 === 0); })); @@ -256,45 +256,45 @@ var a4 = match[1]; var a3 = match[0]; -b("File \"bs_poly_set_test.ml\", line 111, characters 4-11", Bs_Set.eq(a1, a3)); +b("File \"bs_poly_set_test.ml\", line 111, characters 4-11", Belt_Set.eq(a1, a3)); -b("File \"bs_poly_set_test.ml\", line 112, characters 4-11", Bs_Set.eq(a2, a4)); +b("File \"bs_poly_set_test.ml\", line 112, characters 4-11", Belt_Set.eq(a2, a4)); -eq("File \"bs_poly_set_test.ml\", line 113, characters 5-12", Bs_Set.getExn(a0, 3), 3); +eq("File \"bs_poly_set_test.ml\", line 113, characters 5-12", Belt_Set.getExn(a0, 3), 3); -eq("File \"bs_poly_set_test.ml\", line 114, characters 5-12", Bs_Set.getExn(a0, 4), 4); +eq("File \"bs_poly_set_test.ml\", line 114, characters 5-12", Belt_Set.getExn(a0, 4), 4); t("File \"bs_poly_set_test.ml\", line 115, characters 4-11", (function () { - Bs_Set.getExn(a0, 1002); + Belt_Set.getExn(a0, 1002); return /* () */0; })); t("File \"bs_poly_set_test.ml\", line 116, characters 4-11", (function () { - Bs_Set.getExn(a0, -1); + Belt_Set.getExn(a0, -1); return /* () */0; })); -eq("File \"bs_poly_set_test.ml\", line 117, characters 5-12", Bs_SetDict.size(a0.data), 1001); +eq("File \"bs_poly_set_test.ml\", line 117, characters 5-12", Belt_SetDict.size(a0.data), 1001); -b("File \"bs_poly_set_test.ml\", line 118, characters 4-11", 1 - Bs_SetDict.isEmpty(a0.data)); +b("File \"bs_poly_set_test.ml\", line 118, characters 4-11", 1 - Belt_SetDict.isEmpty(a0.data)); -var match$1 = Bs_Set.split(a0, 200); +var match$1 = Belt_Set.split(a0, 200); var match$2 = match$1[0]; b("File \"bs_poly_set_test.ml\", line 120, characters 4-11", match$1[1]); -eq("File \"bs_poly_set_test.ml\", line 121, characters 5-12", Bs_SetDict.toArray(match$2[0].data), Bs_Array.makeBy(200, (function (i) { +eq("File \"bs_poly_set_test.ml\", line 121, characters 5-12", Belt_SetDict.toArray(match$2[0].data), Belt_Array.makeBy(200, (function (i) { return i; }))); -eq("File \"bs_poly_set_test.ml\", line 122, characters 5-12", Bs_SetDict.toList(match$2[1].data), Bs_List.makeBy(800, (function (i) { +eq("File \"bs_poly_set_test.ml\", line 122, characters 5-12", Belt_SetDict.toList(match$2[1].data), Belt_List.makeBy(800, (function (i) { return i + 201 | 0; }))); -var a7 = Bs_Set.remove(a0, 200); +var a7 = Belt_Set.remove(a0, 200); -var match$3 = Bs_Set.split(a7, 200); +var match$3 = Belt_Set.split(a7, 200); var match$4 = match$3[0]; @@ -304,19 +304,19 @@ var a8 = match$4[0]; b("File \"bs_poly_set_test.ml\", line 125, characters 4-11", 1 - match$3[1]); -eq("File \"bs_poly_set_test.ml\", line 126, characters 5-12", Bs_SetDict.toArray(a8.data), Bs_Array.makeBy(200, (function (i) { +eq("File \"bs_poly_set_test.ml\", line 126, characters 5-12", Belt_SetDict.toArray(a8.data), Belt_Array.makeBy(200, (function (i) { return i; }))); -eq("File \"bs_poly_set_test.ml\", line 127, characters 5-12", Bs_SetDict.toList(a9.data), Bs_List.makeBy(800, (function (i) { +eq("File \"bs_poly_set_test.ml\", line 127, characters 5-12", Belt_SetDict.toList(a9.data), Belt_List.makeBy(800, (function (i) { return i + 201 | 0; }))); -eq("File \"bs_poly_set_test.ml\", line 128, characters 5-12", Bs_SetDict.minimum(a8.data), /* Some */[0]); +eq("File \"bs_poly_set_test.ml\", line 128, characters 5-12", Belt_SetDict.minimum(a8.data), /* Some */[0]); -eq("File \"bs_poly_set_test.ml\", line 129, characters 5-12", Bs_SetDict.minimum(a9.data), /* Some */[201]); +eq("File \"bs_poly_set_test.ml\", line 129, characters 5-12", Belt_SetDict.minimum(a9.data), /* Some */[201]); -b("File \"bs_poly_set_test.ml\", line 130, characters 4-11", Bs_List.every(/* :: */[ +b("File \"bs_poly_set_test.ml\", line 130, characters 4-11", Belt_List.every(/* :: */[ a0, /* :: */[ a1, @@ -332,27 +332,27 @@ b("File \"bs_poly_set_test.ml\", line 130, characters 4-11", Bs_List.every(/* :: ] ] ], (function (x) { - return Bs_SetDict.checkInvariantInternal(x.data); + return Belt_SetDict.checkInvariantInternal(x.data); }))); -var a = Bs_Set.ofArray(/* int array */[], IntCmp); +var a = Belt_Set.ofArray(/* int array */[], IntCmp); -var m$4 = Bs_Set.keep(a, (function (x) { +var m$4 = Belt_Set.keep(a, (function (x) { return +(x % 2 === 0); })); -b("File \"bs_poly_set_test.ml\", line 135, characters 4-11", Bs_SetDict.isEmpty(m$4.data)); +b("File \"bs_poly_set_test.ml\", line 135, characters 4-11", Belt_SetDict.isEmpty(m$4.data)); -var match$5 = Bs_Set.split({ +var match$5 = Belt_Set.split({ cmp: IntCmp[/* cmp */0], - data: Bs_SetDict.empty + data: Belt_SetDict.empty }, 0); var match$6 = match$5[0]; -b("File \"bs_poly_set_test.ml\", line 139, characters 4-11", Bs_SetDict.isEmpty(match$6[0].data)); +b("File \"bs_poly_set_test.ml\", line 139, characters 4-11", Belt_SetDict.isEmpty(match$6[0].data)); -b("File \"bs_poly_set_test.ml\", line 140, characters 4-11", Bs_SetDict.isEmpty(match$6[1].data)); +b("File \"bs_poly_set_test.ml\", line 140, characters 4-11", Belt_SetDict.isEmpty(match$6[1].data)); b("File \"bs_poly_set_test.ml\", line 141, characters 4-11", 1 - match$5[1]); diff --git a/jscomp/test/bs_poly_set_test.ml b/jscomp/test/bs_poly_set_test.ml index 6085130118..435021a8d2 100644 --- a/jscomp/test/bs_poly_set_test.ml +++ b/jscomp/test/bs_poly_set_test.ml @@ -3,15 +3,15 @@ let test_id = ref 0 let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x let t loc x = Mt.throw_suites ~test_id ~suites loc x -module N = Bs.Set +module N = Belt.Set module I = Array_data_util -module A = Bs.Array +module A = Belt.Array module IntCmp = - (val Bs.Id.comparable (fun (x:int) y -> compare x y)) -module L = Bs.List + (val Belt.Id.comparable (fun (x:int) y -> compare x y)) +module L = Belt.List let () = - let u0 = N.ofArray ~dict:(module IntCmp) (I.range 0 30) in + let u0 = N.ofArray ~id:(module IntCmp) (I.range 0 30) in let u1 = N.remove u0 0 in let u2 = N.remove u1 0 in let u3 = N.remove u2 30 in @@ -54,10 +54,10 @@ let () = b __LOC__ (N.has u15 20000); b __LOC__ (not @@ N.has u15 2000); b __LOC__ (N.isEmpty u16); - let u17 = N.ofArray ~dict:(module IntCmp) (I.randomRange 0 100) in - let u18 = N.ofArray ~dict:(module IntCmp) (I.randomRange 59 200) in + let u17 = N.ofArray ~id:(module IntCmp) (I.randomRange 0 100) in + let u18 = N.ofArray ~id:(module IntCmp) (I.randomRange 59 200) in let u19 = N.union u17 u18 in - let u20 = N.ofArray ~dict:(module IntCmp) (I.randomRange 0 200) in + let u20 = N.ofArray ~id:(module IntCmp) (I.randomRange 0 200) in b __LOC__ (N.eq u19 u20); let u21 = N.intersect u17 u18 in eq __LOC__ (N.toArray u21) (I.range 59 100); @@ -88,7 +88,7 @@ let testIterToList xs = L.reverse !v let () = - let u0 = N.ofArray ~dict:(module IntCmp) (I.randomRange 0 20) in + let u0 = N.ofArray ~id:(module IntCmp) (I.randomRange 0 20) in let u1 = N.remove u0 17 in let u2 = N.add u1 33 in b __LOC__ (L.every2 (testIterToList u0) (L.makeBy 21 (fun i -> i)) (fun x y -> x = y)); @@ -101,7 +101,7 @@ let () = b __LOC__ (N.cmp u0 u1 > 0) let () = - let a0 = N.ofArray ~dict:(module IntCmp) (I.randomRange 0 1000) in + let a0 = N.ofArray ~id:(module IntCmp) (I.randomRange 0 1000) in let a1,a2 = ( N.keep a0 (fun x -> x mod 2 = 0), @@ -131,11 +131,11 @@ let () = let () = - let a = N.ofArray ~dict:(module IntCmp) [||] in + let a = N.ofArray ~id:(module IntCmp) [||] in b __LOC__ (N.isEmpty (N.keep a (fun x -> x mod 2 = 0))) let () = - let (aa,bb), pres = N.split (N.make ~dict:(module IntCmp)) 0 in + let (aa,bb), pres = N.split (N.make ~id:(module IntCmp)) 0 in b __LOC__ (N.isEmpty aa); b __LOC__ (N.isEmpty bb); b __LOC__ (not pres) diff --git a/jscomp/test/bs_queue_test.js b/jscomp/test/bs_queue_test.js index e4c63bc7c0..3e5d7ea911 100644 --- a/jscomp/test/bs_queue_test.js +++ b/jscomp/test/bs_queue_test.js @@ -2,9 +2,9 @@ var Mt = require("./mt.js"); var Curry = require("../../lib/js/curry.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); -var Bs_MutableQueue = require("../../lib/js/bs_MutableQueue.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_MutableQueue = require("../../lib/js/belt_MutableQueue.js"); var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js"); var suites = [/* [] */0]; @@ -30,13 +30,13 @@ function does_raise(f, q) { } function $plus$plus(q, x) { - Bs_MutableQueue.add(q, x); + Belt_MutableQueue.add(q, x); return q; } -var q = Bs_MutableQueue.make(/* () */0); +var q = Belt_MutableQueue.make(/* () */0); -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[]) && q.length === 0)) { +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray(q), /* int array */[]) && q.length === 0)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -47,7 +47,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[]) && q.le ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 1), q)), /* int array */[1]) && q.length === 1)) { +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)), /* int array */[1]) && q.length === 1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -58,7 +58,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 1), q) ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 2), q)), /* int array */[ +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)), /* int array */[ 1, 2 ]) && q.length === 2)) { @@ -72,7 +72,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 2), q) ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 3), q)), /* int array */[ +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)), /* int array */[ 1, 2, 3 @@ -87,7 +87,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 3), q) ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 4), q)), /* int array */[ +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)), /* int array */[ 1, 2, 3, @@ -103,7 +103,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray((Bs_MutableQueue.add(q, 4), q) ]; } -if (Bs_MutableQueue.popExn(q) !== 1) { +if (Belt_MutableQueue.popExn(q) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -114,7 +114,7 @@ if (Bs_MutableQueue.popExn(q) !== 1) { ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[ +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray(q), /* int array */[ 2, 3, 4 @@ -129,7 +129,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[ ]; } -if (Bs_MutableQueue.popExn(q) !== 2) { +if (Belt_MutableQueue.popExn(q) !== 2) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -140,7 +140,7 @@ if (Bs_MutableQueue.popExn(q) !== 2) { ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[ +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray(q), /* int array */[ 3, 4 ]) && q.length === 2)) { @@ -154,7 +154,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[ ]; } -if (Bs_MutableQueue.popExn(q) !== 3) { +if (Belt_MutableQueue.popExn(q) !== 3) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -165,7 +165,7 @@ if (Bs_MutableQueue.popExn(q) !== 3) { ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[4]) && q.length === 1)) { +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray(q), /* int array */[4]) && q.length === 1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -176,7 +176,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[4]) && q.l ]; } -if (Bs_MutableQueue.popExn(q) !== 4) { +if (Belt_MutableQueue.popExn(q) !== 4) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -187,7 +187,7 @@ if (Bs_MutableQueue.popExn(q) !== 4) { ]; } -if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[]) && q.length === 0)) { +if (!(Caml_obj.caml_equal(Belt_MutableQueue.toArray(q), /* int array */[]) && q.length === 0)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -198,7 +198,7 @@ if (!(Caml_obj.caml_equal(Bs_MutableQueue.toArray(q), /* int array */[]) && q.le ]; } -if (!does_raise(Bs_MutableQueue.popExn, q)) { +if (!does_raise(Belt_MutableQueue.popExn, q)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -209,9 +209,9 @@ if (!does_raise(Bs_MutableQueue.popExn, q)) { ]; } -var q$1 = Bs_MutableQueue.make(/* () */0); +var q$1 = Belt_MutableQueue.make(/* () */0); -if (Bs_MutableQueue.popExn((Bs_MutableQueue.add(q$1, 1), q$1)) !== 1) { +if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 1), q$1)) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -222,7 +222,7 @@ if (Bs_MutableQueue.popExn((Bs_MutableQueue.add(q$1, 1), q$1)) !== 1) { ]; } -if (!does_raise(Bs_MutableQueue.popExn, q$1)) { +if (!does_raise(Belt_MutableQueue.popExn, q$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -233,7 +233,7 @@ if (!does_raise(Bs_MutableQueue.popExn, q$1)) { ]; } -if (Bs_MutableQueue.popExn((Bs_MutableQueue.add(q$1, 2), q$1)) !== 2) { +if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 2), q$1)) !== 2) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -244,7 +244,7 @@ if (Bs_MutableQueue.popExn((Bs_MutableQueue.add(q$1, 2), q$1)) !== 2) { ]; } -if (!does_raise(Bs_MutableQueue.popExn, q$1)) { +if (!does_raise(Belt_MutableQueue.popExn, q$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -266,9 +266,9 @@ if (q$1.length !== 0) { ]; } -var q$2 = Bs_MutableQueue.make(/* () */0); +var q$2 = Belt_MutableQueue.make(/* () */0); -if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 1), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -279,7 +279,7 @@ if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 1), q$2)) !== 1) { ]; } -if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 2), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -290,7 +290,7 @@ if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 2), q$2)) !== 1) { ]; } -if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 3), q$2)) !== 1) { +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 3), q$2)) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -301,7 +301,7 @@ if (Bs_MutableQueue.peekExn((Bs_MutableQueue.add(q$2, 3), q$2)) !== 1) { ]; } -if (Bs_MutableQueue.peekExn(q$2) !== 1) { +if (Belt_MutableQueue.peekExn(q$2) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -312,7 +312,7 @@ if (Bs_MutableQueue.peekExn(q$2) !== 1) { ]; } -if (Bs_MutableQueue.popExn(q$2) !== 1) { +if (Belt_MutableQueue.popExn(q$2) !== 1) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -323,7 +323,7 @@ if (Bs_MutableQueue.popExn(q$2) !== 1) { ]; } -if (Bs_MutableQueue.peekExn(q$2) !== 2) { +if (Belt_MutableQueue.peekExn(q$2) !== 2) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -334,7 +334,7 @@ if (Bs_MutableQueue.peekExn(q$2) !== 2) { ]; } -if (Bs_MutableQueue.popExn(q$2) !== 2) { +if (Belt_MutableQueue.popExn(q$2) !== 2) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -345,7 +345,7 @@ if (Bs_MutableQueue.popExn(q$2) !== 2) { ]; } -if (Bs_MutableQueue.peekExn(q$2) !== 3) { +if (Belt_MutableQueue.peekExn(q$2) !== 3) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -356,7 +356,7 @@ if (Bs_MutableQueue.peekExn(q$2) !== 3) { ]; } -if (Bs_MutableQueue.popExn(q$2) !== 3) { +if (Belt_MutableQueue.popExn(q$2) !== 3) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -367,7 +367,7 @@ if (Bs_MutableQueue.popExn(q$2) !== 3) { ]; } -if (!does_raise(Bs_MutableQueue.peekExn, q$2)) { +if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -378,7 +378,7 @@ if (!does_raise(Bs_MutableQueue.peekExn, q$2)) { ]; } -if (!does_raise(Bs_MutableQueue.peekExn, q$2)) { +if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -389,13 +389,13 @@ if (!does_raise(Bs_MutableQueue.peekExn, q$2)) { ]; } -var q$3 = Bs_MutableQueue.make(/* () */0); +var q$3 = Belt_MutableQueue.make(/* () */0); for(var i = 1; i <= 10; ++i){ - Bs_MutableQueue.add(q$3, i); + Belt_MutableQueue.add(q$3, i); } -Bs_MutableQueue.clear(q$3); +Belt_MutableQueue.clear(q$3); if (q$3.length !== 0) { throw [ @@ -408,7 +408,7 @@ if (q$3.length !== 0) { ]; } -if (!does_raise(Bs_MutableQueue.popExn, q$3)) { +if (!does_raise(Belt_MutableQueue.popExn, q$3)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -419,7 +419,7 @@ if (!does_raise(Bs_MutableQueue.popExn, q$3)) { ]; } -if (!Caml_obj.caml_equal(q$3, Bs_MutableQueue.make(/* () */0))) { +if (!Caml_obj.caml_equal(q$3, Belt_MutableQueue.make(/* () */0))) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -430,9 +430,9 @@ if (!Caml_obj.caml_equal(q$3, Bs_MutableQueue.make(/* () */0))) { ]; } -Bs_MutableQueue.add(q$3, 42); +Belt_MutableQueue.add(q$3, 42); -if (Bs_MutableQueue.popExn(q$3) !== 42) { +if (Belt_MutableQueue.popExn(q$3) !== 42) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -443,15 +443,15 @@ if (Bs_MutableQueue.popExn(q$3) !== 42) { ]; } -var q1 = Bs_MutableQueue.make(/* () */0); +var q1 = Belt_MutableQueue.make(/* () */0); for(var i$1 = 1; i$1 <= 10; ++i$1){ - Bs_MutableQueue.add(q1, i$1); + Belt_MutableQueue.add(q1, i$1); } -var q2 = Bs_MutableQueue.copy(q1); +var q2 = Belt_MutableQueue.copy(q1); -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1), /* array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1), /* array */[ 1, 2, 3, @@ -473,7 +473,7 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1), /* array */[ ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2), /* array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2), /* array */[ 1, 2, 3, @@ -518,7 +518,7 @@ if (q2.length !== 10) { } for(var i$2 = 1; i$2 <= 10; ++i$2){ - if (Bs_MutableQueue.popExn(q1) !== i$2) { + if (Belt_MutableQueue.popExn(q1) !== i$2) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -532,7 +532,7 @@ for(var i$2 = 1; i$2 <= 10; ++i$2){ } for(var i$3 = 1; i$3 <= 10; ++i$3){ - if (Bs_MutableQueue.popExn(q2) !== i$3) { + if (Belt_MutableQueue.popExn(q2) !== i$3) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -545,7 +545,7 @@ for(var i$3 = 1; i$3 <= 10; ++i$3){ } -var q$4 = Bs_MutableQueue.make(/* () */0); +var q$4 = Belt_MutableQueue.make(/* () */0); if (q$4.length !== 0) { throw [ @@ -559,7 +559,7 @@ if (q$4.length !== 0) { } for(var i$4 = 1; i$4 <= 10; ++i$4){ - Bs_MutableQueue.add(q$4, i$4); + Belt_MutableQueue.add(q$4, i$4); if (q$4.length !== i$4) { throw [ Caml_builtin_exceptions.assert_failure, @@ -604,7 +604,7 @@ for(var i$5 = 10; i$5 >= 1; --i$5){ ] ]; } - Bs_MutableQueue.popExn(q$4); + Belt_MutableQueue.popExn(q$4); } if (q$4.length !== 0) { @@ -629,15 +629,15 @@ if (q$4.length !== 0) { ]; } -var q$5 = Bs_MutableQueue.make(/* () */0); +var q$5 = Belt_MutableQueue.make(/* () */0); for(var i$6 = 1; i$6 <= 10; ++i$6){ - Bs_MutableQueue.add(q$5, i$6); + Belt_MutableQueue.add(q$5, i$6); } var i$7 = [1]; -Bs_MutableQueue.forEach(q$5, (function (j) { +Belt_MutableQueue.forEach(q$5, (function (j) { if (i$7[0] !== j) { throw [ Caml_builtin_exceptions.assert_failure, @@ -652,9 +652,9 @@ Bs_MutableQueue.forEach(q$5, (function (j) { return /* () */0; })); -var q1$1 = Bs_MutableQueue.make(/* () */0); +var q1$1 = Belt_MutableQueue.make(/* () */0); -var q2$1 = Bs_MutableQueue.make(/* () */0); +var q2$1 = Belt_MutableQueue.make(/* () */0); if (q1$1.length !== 0) { throw [ @@ -667,7 +667,7 @@ if (q1$1.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$1), /* array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$1), /* array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -689,7 +689,7 @@ if (q2$1.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$1), /* array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$1), /* array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -700,7 +700,7 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$1), /* array */[])) { ]; } -Bs_MutableQueue.transfer(q1$1, q2$1); +Belt_MutableQueue.transfer(q1$1, q2$1); if (q1$1.length !== 0) { throw [ @@ -713,7 +713,7 @@ if (q1$1.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$1), /* array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$1), /* array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -735,7 +735,7 @@ if (q2$1.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$1), /* array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$1), /* array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -746,12 +746,12 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$1), /* array */[])) { ]; } -var q1$2 = Bs_MutableQueue.make(/* () */0); +var q1$2 = Belt_MutableQueue.make(/* () */0); -var q2$2 = Bs_MutableQueue.make(/* () */0); +var q2$2 = Belt_MutableQueue.make(/* () */0); for(var i$8 = 1; i$8 <= 4; ++i$8){ - Bs_MutableQueue.add(q1$2, i$8); + Belt_MutableQueue.add(q1$2, i$8); } if (q1$2.length !== 4) { @@ -765,7 +765,7 @@ if (q1$2.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$2), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$2), /* int array */[ 1, 2, 3, @@ -792,7 +792,7 @@ if (q2$2.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$2), /* int array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$2), /* int array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -803,7 +803,7 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$2), /* int array */[])) { ]; } -Bs_MutableQueue.transfer(q1$2, q2$2); +Belt_MutableQueue.transfer(q1$2, q2$2); if (q1$2.length !== 0) { throw [ @@ -816,7 +816,7 @@ if (q1$2.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$2), /* int array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$2), /* int array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -838,7 +838,7 @@ if (q2$2.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$2), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$2), /* int array */[ 1, 2, 3, @@ -854,12 +854,12 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$2), /* int array */[ ]; } -var q1$3 = Bs_MutableQueue.make(/* () */0); +var q1$3 = Belt_MutableQueue.make(/* () */0); -var q2$3 = Bs_MutableQueue.make(/* () */0); +var q2$3 = Belt_MutableQueue.make(/* () */0); for(var i$9 = 5; i$9 <= 8; ++i$9){ - Bs_MutableQueue.add(q2$3, i$9); + Belt_MutableQueue.add(q2$3, i$9); } if (q1$3.length !== 0) { @@ -873,7 +873,7 @@ if (q1$3.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$3), /* int array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$3), /* int array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -895,7 +895,7 @@ if (q2$3.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$3), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$3), /* int array */[ 5, 6, 7, @@ -911,7 +911,7 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$3), /* int array */[ ]; } -Bs_MutableQueue.transfer(q1$3, q2$3); +Belt_MutableQueue.transfer(q1$3, q2$3); if (q1$3.length !== 0) { throw [ @@ -924,7 +924,7 @@ if (q1$3.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$3), /* int array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$3), /* int array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -946,7 +946,7 @@ if (q2$3.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$3), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$3), /* int array */[ 5, 6, 7, @@ -962,16 +962,16 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$3), /* int array */[ ]; } -var q1$4 = Bs_MutableQueue.make(/* () */0); +var q1$4 = Belt_MutableQueue.make(/* () */0); -var q2$4 = Bs_MutableQueue.make(/* () */0); +var q2$4 = Belt_MutableQueue.make(/* () */0); for(var i$10 = 1; i$10 <= 4; ++i$10){ - Bs_MutableQueue.add(q1$4, i$10); + Belt_MutableQueue.add(q1$4, i$10); } for(var i$11 = 5; i$11 <= 8; ++i$11){ - Bs_MutableQueue.add(q2$4, i$11); + Belt_MutableQueue.add(q2$4, i$11); } if (q1$4.length !== 4) { @@ -985,7 +985,7 @@ if (q1$4.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$4), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$4), /* int array */[ 1, 2, 3, @@ -1012,7 +1012,7 @@ if (q2$4.length !== 4) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$4), /* int array */[ +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$4), /* int array */[ 5, 6, 7, @@ -1028,7 +1028,7 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$4), /* int array */[ ]; } -Bs_MutableQueue.transfer(q1$4, q2$4); +Belt_MutableQueue.transfer(q1$4, q2$4); if (q1$4.length !== 0) { throw [ @@ -1041,7 +1041,7 @@ if (q1$4.length !== 0) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q1$4), /* int array */[])) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q1$4), /* int array */[])) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -1074,7 +1074,7 @@ if (q2$4.length !== 8) { ]; } -if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$4), v)) { +if (!Caml_obj.caml_equal(Belt_MutableQueue.toArray(q2$4), v)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -1085,9 +1085,9 @@ if (!Caml_obj.caml_equal(Bs_MutableQueue.toArray(q2$4), v)) { ]; } -if (Bs_MutableQueue.reduce(q2$4, 0, (function (x, y) { +if (Belt_MutableQueue.reduce(q2$4, 0, (function (x, y) { return x - y | 0; - })) !== Bs_Array.reduce(v, 0, (function (x, y) { + })) !== Belt_Array.reduce(v, 0, (function (x, y) { return x - y | 0; }))) { throw [ @@ -1102,29 +1102,29 @@ if (Bs_MutableQueue.reduce(q2$4, 0, (function (x, y) { console.log("OK"); -var q$6 = Bs_MutableQueue.ofArray(/* int array */[ +var q$6 = Belt_MutableQueue.ofArray(/* int array */[ 1, 2, 3, 4 ]); -var q1$5 = Bs_MutableQueue.map(q$6, (function (x) { +var q1$5 = Belt_MutableQueue.map(q$6, (function (x) { return x - 1 | 0; })); -eq("File \"bs_queue_test.ml\", line 154, characters 5-12", Bs_MutableQueue.toArray(q1$5), /* int array */[ +eq("File \"bs_queue_test.ml\", line 154, characters 5-12", Belt_MutableQueue.toArray(q1$5), /* int array */[ 0, 1, 2, 3 ]); -var q$7 = Bs_MutableQueue.ofArray(/* array */[]); +var q$7 = Belt_MutableQueue.ofArray(/* array */[]); b("File \"bs_queue_test.ml\", line 155, characters 4-11", +(q$7.length === 0)); -var q$8 = Bs_MutableQueue.map(Bs_MutableQueue.ofArray(/* int array */[]), (function (x) { +var q$8 = Belt_MutableQueue.map(Belt_MutableQueue.ofArray(/* int array */[]), (function (x) { return x + 1 | 0; })); diff --git a/jscomp/test/bs_queue_test.ml b/jscomp/test/bs_queue_test.ml index 9351b845f1..c3f981adc1 100644 --- a/jscomp/test/bs_queue_test.ml +++ b/jscomp/test/bs_queue_test.ml @@ -6,7 +6,7 @@ let b loc x = Mt.bool_suites ~test_id ~suites loc x (* TEST *) -module Q = Bs.MutableQueue +module Q = Belt.MutableQueue let does_raise f q = try @@ -141,7 +141,7 @@ let () = assert (Q.size q2 = 8); assert (Q.toArray q2 = v ); assert (Q.reduce q2 0 (fun x y -> x - y ) = - Bs.Array.reduce v 0 (fun x y -> x - y) ) + Belt.Array.reduce v 0 (fun x y -> x - y) ) ;; @@ -155,4 +155,4 @@ let () = b __LOC__ (Q.isEmpty (Q.ofArray [||])); b __LOC__ ( Q.isEmpty (Q.map ( (Q.ofArray [||])) (fun x -> x + 1))) -;; Mt.from_pair_suites __FILE__ !suites \ No newline at end of file +;; Mt.from_pair_suites __FILE__ !suites diff --git a/jscomp/test/bs_set_bench.js b/jscomp/test/bs_set_bench.js index 8a2f7f0934..33a1539c80 100644 --- a/jscomp/test/bs_set_bench.js +++ b/jscomp/test/bs_set_bench.js @@ -1,18 +1,18 @@ 'use strict'; -var Bs_SetInt = require("../../lib/js/bs_SetInt.js"); +var Belt_SetInt = require("../../lib/js/belt_SetInt.js"); var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js"); function bench() { - var data = Bs_SetInt.empty; + var data = Belt_SetInt.empty; console.time("bs_set_bench.ml 7"); for(var i = 0; i <= 1000000; ++i){ - data = Bs_SetInt.add(data, i); + data = Belt_SetInt.add(data, i); } console.timeEnd("bs_set_bench.ml 7"); console.time("bs_set_bench.ml 11"); for(var i$1 = 0; i$1 <= 1000000; ++i$1){ - if (!Bs_SetInt.has(data, i$1)) { + if (!Belt_SetInt.has(data, i$1)) { throw [ Caml_builtin_exceptions.assert_failure, [ @@ -27,10 +27,10 @@ function bench() { console.timeEnd("bs_set_bench.ml 11"); console.time("bs_set_bench.ml 14"); for(var i$2 = 0; i$2 <= 1000000; ++i$2){ - data = Bs_SetInt.remove(data, i$2); + data = Belt_SetInt.remove(data, i$2); } console.timeEnd("bs_set_bench.ml 14"); - if (Bs_SetInt.size(data)) { + if (Belt_SetInt.size(data)) { throw [ Caml_builtin_exceptions.assert_failure, [ diff --git a/jscomp/test/bs_set_bench.ml b/jscomp/test/bs_set_bench.ml index 271885750d..7980850455 100644 --- a/jscomp/test/bs_set_bench.ml +++ b/jscomp/test/bs_set_bench.ml @@ -1,7 +1,7 @@ let count = 1_000_000 -module N = Bs.Set.Int +module N = Belt.Set.Int let bench () = let data = ref N.empty in [%time for i = 0 to count do diff --git a/jscomp/test/bs_set_int_test.js b/jscomp/test/bs_set_int_test.js index 707dbd395d..a8806313de 100644 --- a/jscomp/test/bs_set_int_test.js +++ b/jscomp/test/bs_set_int_test.js @@ -3,8 +3,8 @@ var Mt = require("./mt.js"); var List = require("../../lib/js/list.js"); var $$Array = require("../../lib/js/array.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_SetInt = require("../../lib/js/bs_SetInt.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_SetInt = require("../../lib/js/belt_SetInt.js"); var Array_data_util = require("./array_data_util.js"); var suites = [/* [] */0]; @@ -20,11 +20,11 @@ function b(loc, v) { } function $eq$tilde(s, i) { - return Bs_SetInt.eq(Bs_SetInt.ofArray(i), s); + return Belt_SetInt.eq(Belt_SetInt.ofArray(i), s); } function $eq$star(a, b) { - return Bs_SetInt.eq(Bs_SetInt.ofArray(a), Bs_SetInt.ofArray(b)); + return Belt_SetInt.eq(Belt_SetInt.ofArray(a), Belt_SetInt.ofArray(b)); } b("File \"bs_set_int_test.ml\", line 17, characters 4-11", $eq$star(/* int array */[ @@ -37,17 +37,17 @@ b("File \"bs_set_int_test.ml\", line 17, characters 4-11", $eq$star(/* int array 1 ])); -var u = Bs_SetInt.intersect(Bs_SetInt.ofArray(/* int array */[ +var u = Belt_SetInt.intersect(Belt_SetInt.ofArray(/* int array */[ 1, 2, 3 - ]), Bs_SetInt.ofArray(/* int array */[ + ]), Belt_SetInt.ofArray(/* int array */[ 3, 4, 5 ])); -b("File \"bs_set_int_test.ml\", line 23, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(/* int array */[3]), u)); +b("File \"bs_set_int_test.ml\", line 23, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(/* int array */[3]), u)); function range(i, j) { return $$Array.init((j - i | 0) + 1 | 0, (function (k) { @@ -61,67 +61,67 @@ function revRange(i, j) { }))))); } -var v = Bs_SetInt.ofArray($$Array.append(range(100, 1000), revRange(400, 1500))); +var v = Belt_SetInt.ofArray($$Array.append(range(100, 1000), revRange(400, 1500))); var i = range(100, 1500); -b("File \"bs_set_int_test.ml\", line 36, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(i), v)); +b("File \"bs_set_int_test.ml\", line 36, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(i), v)); -var match = Bs_SetInt.partition(v, (function (x) { +var match = Belt_SetInt.partition(v, (function (x) { return +(x % 3 === 0); })); -var l = Bs_SetInt.empty; +var l = Belt_SetInt.empty; -var r = Bs_SetInt.empty; +var r = Belt_SetInt.empty; for(var i$1 = 100; i$1 <= 1500; ++i$1){ if (i$1 % 3) { - r = Bs_SetInt.add(r, i$1); + r = Belt_SetInt.add(r, i$1); } else { - l = Bs_SetInt.add(l, i$1); + l = Belt_SetInt.add(l, i$1); } } -b("File \"bs_set_int_test.ml\", line 47, characters 4-11", Bs_SetInt.eq(match[0], l)); +b("File \"bs_set_int_test.ml\", line 47, characters 4-11", Belt_SetInt.eq(match[0], l)); -b("File \"bs_set_int_test.ml\", line 48, characters 4-11", Bs_SetInt.eq(match[1], r)); +b("File \"bs_set_int_test.ml\", line 48, characters 4-11", Belt_SetInt.eq(match[1], r)); var i$2 = range(50, 100); -var s = Bs_SetInt.intersect(Bs_SetInt.ofArray(range(1, 100)), Bs_SetInt.ofArray(range(50, 200))); +var s = Belt_SetInt.intersect(Belt_SetInt.ofArray(range(1, 100)), Belt_SetInt.ofArray(range(50, 200))); -b("File \"bs_set_int_test.ml\", line 51, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(i$2), s)); +b("File \"bs_set_int_test.ml\", line 51, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(i$2), s)); var i$3 = range(1, 200); -var s$1 = Bs_SetInt.union(Bs_SetInt.ofArray(range(1, 100)), Bs_SetInt.ofArray(range(50, 200))); +var s$1 = Belt_SetInt.union(Belt_SetInt.ofArray(range(1, 100)), Belt_SetInt.ofArray(range(50, 200))); -b("File \"bs_set_int_test.ml\", line 54, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(i$3), s$1)); +b("File \"bs_set_int_test.ml\", line 54, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(i$3), s$1)); var i$4 = range(1, 49); -var s$2 = Bs_SetInt.diff(Bs_SetInt.ofArray(range(1, 100)), Bs_SetInt.ofArray(range(50, 200))); +var s$2 = Belt_SetInt.diff(Belt_SetInt.ofArray(range(1, 100)), Belt_SetInt.ofArray(range(50, 200))); -b("File \"bs_set_int_test.ml\", line 57, characters 6-13", Bs_SetInt.eq(Bs_SetInt.ofArray(i$4), s$2)); +b("File \"bs_set_int_test.ml\", line 57, characters 6-13", Belt_SetInt.eq(Belt_SetInt.ofArray(i$4), s$2)); var i$5 = revRange(50, 100); -var s$3 = Bs_SetInt.intersect(Bs_SetInt.ofArray(revRange(1, 100)), Bs_SetInt.ofArray(revRange(50, 200))); +var s$3 = Belt_SetInt.intersect(Belt_SetInt.ofArray(revRange(1, 100)), Belt_SetInt.ofArray(revRange(50, 200))); -b("File \"bs_set_int_test.ml\", line 60, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(i$5), s$3)); +b("File \"bs_set_int_test.ml\", line 60, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(i$5), s$3)); var i$6 = revRange(1, 200); -var s$4 = Bs_SetInt.union(Bs_SetInt.ofArray(revRange(1, 100)), Bs_SetInt.ofArray(revRange(50, 200))); +var s$4 = Belt_SetInt.union(Belt_SetInt.ofArray(revRange(1, 100)), Belt_SetInt.ofArray(revRange(50, 200))); -b("File \"bs_set_int_test.ml\", line 63, characters 4-11", Bs_SetInt.eq(Bs_SetInt.ofArray(i$6), s$4)); +b("File \"bs_set_int_test.ml\", line 63, characters 4-11", Belt_SetInt.eq(Belt_SetInt.ofArray(i$6), s$4)); var i$7 = revRange(1, 49); -var s$5 = Bs_SetInt.diff(Bs_SetInt.ofArray(revRange(1, 100)), Bs_SetInt.ofArray(revRange(50, 200))); +var s$5 = Belt_SetInt.diff(Belt_SetInt.ofArray(revRange(1, 100)), Belt_SetInt.ofArray(revRange(50, 200))); -b("File \"bs_set_int_test.ml\", line 66, characters 6-13", Bs_SetInt.eq(Bs_SetInt.ofArray(i$7), s$5)); +b("File \"bs_set_int_test.ml\", line 66, characters 6-13", Belt_SetInt.eq(Belt_SetInt.ofArray(i$7), s$5)); var ss = /* array */[ 1, @@ -134,7 +134,7 @@ var ss = /* array */[ -1 ]; -var v$1 = Bs_SetInt.ofArray(/* array */[ +var v$1 = Belt_SetInt.ofArray(/* array */[ 1, 222, 3, @@ -145,17 +145,17 @@ var v$1 = Bs_SetInt.ofArray(/* array */[ -1 ]); -var minv = Bs_SetInt.minUndefined(v$1); +var minv = Belt_SetInt.minUndefined(v$1); -var maxv = Bs_SetInt.maxUndefined(v$1); +var maxv = Belt_SetInt.maxUndefined(v$1); function approx(loc, x, y) { return b(loc, +(x === y)); } -eq("File \"bs_set_int_test.ml\", line 74, characters 5-12", Bs_SetInt.reduce(v$1, 0, (function (x, y) { +eq("File \"bs_set_int_test.ml\", line 74, characters 5-12", Belt_SetInt.reduce(v$1, 0, (function (x, y) { return x + y | 0; - })), Bs_Array.reduce(ss, 0, (function (prim, prim$1) { + })), Belt_Array.reduce(ss, 0, (function (prim, prim$1) { return prim + prim$1 | 0; }))); @@ -163,111 +163,111 @@ approx("File \"bs_set_int_test.ml\", line 75, characters 9-16", -1, minv); approx("File \"bs_set_int_test.ml\", line 76, characters 9-16", 222, maxv); -var v$2 = Bs_SetInt.remove(v$1, 3); +var v$2 = Belt_SetInt.remove(v$1, 3); -var minv$1 = Bs_SetInt.minimum(v$2); +var minv$1 = Belt_SetInt.minimum(v$2); -var maxv$1 = Bs_SetInt.maximum(v$2); +var maxv$1 = Belt_SetInt.maximum(v$2); eq("File \"bs_set_int_test.ml\", line 79, characters 5-12", minv$1, /* Some */[-1]); eq("File \"bs_set_int_test.ml\", line 80, characters 5-12", maxv$1, /* Some */[222]); -var v$3 = Bs_SetInt.remove(v$2, 222); +var v$3 = Belt_SetInt.remove(v$2, 222); -var minv$2 = Bs_SetInt.minimum(v$3); +var minv$2 = Belt_SetInt.minimum(v$3); -var maxv$2 = Bs_SetInt.maximum(v$3); +var maxv$2 = Belt_SetInt.maximum(v$3); eq("File \"bs_set_int_test.ml\", line 83, characters 5-12", minv$2, /* Some */[-1]); eq("File \"bs_set_int_test.ml\", line 84, characters 5-12", maxv$2, /* Some */[33]); -var v$4 = Bs_SetInt.remove(v$3, -1); +var v$4 = Belt_SetInt.remove(v$3, -1); -var minv$3 = Bs_SetInt.minimum(v$4); +var minv$3 = Belt_SetInt.minimum(v$4); -var maxv$3 = Bs_SetInt.maximum(v$4); +var maxv$3 = Belt_SetInt.maximum(v$4); eq("File \"bs_set_int_test.ml\", line 87, characters 5-12", minv$3, /* Some */[0]); eq("File \"bs_set_int_test.ml\", line 88, characters 5-12", maxv$3, /* Some */[33]); -var v$5 = Bs_SetInt.remove(v$4, 0); +var v$5 = Belt_SetInt.remove(v$4, 0); -var v$6 = Bs_SetInt.remove(v$5, 33); +var v$6 = Belt_SetInt.remove(v$5, 33); -var v$7 = Bs_SetInt.remove(v$6, 2); +var v$7 = Belt_SetInt.remove(v$6, 2); -var v$8 = Bs_SetInt.remove(v$7, 3); +var v$8 = Belt_SetInt.remove(v$7, 3); -var v$9 = Bs_SetInt.remove(v$8, 4); +var v$9 = Belt_SetInt.remove(v$8, 4); -var v$10 = Bs_SetInt.remove(v$9, 1); +var v$10 = Belt_SetInt.remove(v$9, 1); -b("File \"bs_set_int_test.ml\", line 95, characters 4-11", Bs_SetInt.isEmpty(v$10)); +b("File \"bs_set_int_test.ml\", line 95, characters 4-11", Belt_SetInt.isEmpty(v$10)); -var v$11 = Bs_Array.makeByAndShuffle(1000000, (function (i) { +var v$11 = Belt_Array.makeByAndShuffle(1000000, (function (i) { return i; })); -var u$1 = Bs_SetInt.ofArray(v$11); +var u$1 = Belt_SetInt.ofArray(v$11); -b("File \"bs_set_int_test.ml\", line 102, characters 4-11", Bs_SetInt.checkInvariantInternal(u$1)); +b("File \"bs_set_int_test.ml\", line 102, characters 4-11", Belt_SetInt.checkInvariantInternal(u$1)); -var firstHalf = Bs_Array.slice(v$11, 0, 2000); +var firstHalf = Belt_Array.slice(v$11, 0, 2000); -var xx = Bs_Array.reduce(firstHalf, u$1, Bs_SetInt.remove); +var xx = Belt_Array.reduce(firstHalf, u$1, Belt_SetInt.remove); -b("File \"bs_set_int_test.ml\", line 105, characters 4-11", Bs_SetInt.checkInvariantInternal(u$1)); +b("File \"bs_set_int_test.ml\", line 105, characters 4-11", Belt_SetInt.checkInvariantInternal(u$1)); -b("File \"bs_set_int_test.ml\", line 106, characters 4-11", Bs_SetInt.eq(Bs_SetInt.union(Bs_SetInt.ofArray(firstHalf), xx), u$1)); +b("File \"bs_set_int_test.ml\", line 106, characters 4-11", Belt_SetInt.eq(Belt_SetInt.union(Belt_SetInt.ofArray(firstHalf), xx), u$1)); -var aa = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 100)); +var aa = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 100)); -var bb = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 200)); +var bb = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 200)); -var cc = Bs_SetInt.ofArray(Array_data_util.randomRange(120, 200)); +var cc = Belt_SetInt.ofArray(Array_data_util.randomRange(120, 200)); -var dd = Bs_SetInt.union(aa, cc); +var dd = Belt_SetInt.union(aa, cc); -b("File \"bs_set_int_test.ml\", line 113, characters 4-11", Bs_SetInt.subset(aa, bb)); +b("File \"bs_set_int_test.ml\", line 113, characters 4-11", Belt_SetInt.subset(aa, bb)); -b("File \"bs_set_int_test.ml\", line 114, characters 4-11", Bs_SetInt.subset(dd, bb)); +b("File \"bs_set_int_test.ml\", line 114, characters 4-11", Belt_SetInt.subset(dd, bb)); -b("File \"bs_set_int_test.ml\", line 115, characters 4-11", Bs_SetInt.subset(Bs_SetInt.add(dd, 200), bb)); +b("File \"bs_set_int_test.ml\", line 115, characters 4-11", Belt_SetInt.subset(Belt_SetInt.add(dd, 200), bb)); -b("File \"bs_set_int_test.ml\", line 116, characters 4-11", +(Bs_SetInt.add(dd, 200) === dd)); +b("File \"bs_set_int_test.ml\", line 116, characters 4-11", +(Belt_SetInt.add(dd, 200) === dd)); -b("File \"bs_set_int_test.ml\", line 117, characters 4-11", +(Bs_SetInt.add(dd, 0) === dd)); +b("File \"bs_set_int_test.ml\", line 117, characters 4-11", +(Belt_SetInt.add(dd, 0) === dd)); -b("File \"bs_set_int_test.ml\", line 118, characters 4-11", 1 - Bs_SetInt.subset(Bs_SetInt.add(dd, 201), bb)); +b("File \"bs_set_int_test.ml\", line 118, characters 4-11", 1 - Belt_SetInt.subset(Belt_SetInt.add(dd, 201), bb)); -var aa$1 = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 100)); +var aa$1 = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 100)); -var bb$1 = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 100)); +var bb$1 = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 100)); -var cc$1 = Bs_SetInt.add(bb$1, 101); +var cc$1 = Belt_SetInt.add(bb$1, 101); -var dd$1 = Bs_SetInt.remove(bb$1, 99); +var dd$1 = Belt_SetInt.remove(bb$1, 99); -var ee = Bs_SetInt.add(dd$1, 101); +var ee = Belt_SetInt.add(dd$1, 101); -b("File \"bs_set_int_test.ml\", line 127, characters 4-11", Bs_SetInt.eq(aa$1, bb$1)); +b("File \"bs_set_int_test.ml\", line 127, characters 4-11", Belt_SetInt.eq(aa$1, bb$1)); -b("File \"bs_set_int_test.ml\", line 128, characters 4-11", 1 - Bs_SetInt.eq(aa$1, cc$1)); +b("File \"bs_set_int_test.ml\", line 128, characters 4-11", 1 - Belt_SetInt.eq(aa$1, cc$1)); -b("File \"bs_set_int_test.ml\", line 129, characters 4-11", 1 - Bs_SetInt.eq(dd$1, cc$1)); +b("File \"bs_set_int_test.ml\", line 129, characters 4-11", 1 - Belt_SetInt.eq(dd$1, cc$1)); -b("File \"bs_set_int_test.ml\", line 130, characters 4-11", 1 - Bs_SetInt.eq(bb$1, ee)); +b("File \"bs_set_int_test.ml\", line 130, characters 4-11", 1 - Belt_SetInt.eq(bb$1, ee)); -var a1 = Bs_SetInt.mergeMany(Bs_SetInt.empty, Array_data_util.randomRange(0, 100)); +var a1 = Belt_SetInt.mergeMany(Belt_SetInt.empty, Array_data_util.randomRange(0, 100)); -var a2 = Bs_SetInt.removeMany(a1, Array_data_util.randomRange(40, 100)); +var a2 = Belt_SetInt.removeMany(a1, Array_data_util.randomRange(40, 100)); -var a3 = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 39)); +var a3 = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 39)); -var match$1 = Bs_SetInt.split(a1, 40); +var match$1 = Belt_SetInt.split(a1, 40); var match$2 = match$1[0]; @@ -275,21 +275,21 @@ var a5 = match$2[1]; var a4 = match$2[0]; -b("File \"bs_set_int_test.ml\", line 138, characters 4-11", Bs_SetInt.eq(a1, Bs_SetInt.ofArray(Array_data_util.randomRange(0, 100)))); +b("File \"bs_set_int_test.ml\", line 138, characters 4-11", Belt_SetInt.eq(a1, Belt_SetInt.ofArray(Array_data_util.randomRange(0, 100)))); -b("File \"bs_set_int_test.ml\", line 139, characters 4-11", Bs_SetInt.eq(a2, a3)); +b("File \"bs_set_int_test.ml\", line 139, characters 4-11", Belt_SetInt.eq(a2, a3)); b("File \"bs_set_int_test.ml\", line 140, characters 4-11", match$1[1]); -b("File \"bs_set_int_test.ml\", line 141, characters 4-11", Bs_SetInt.eq(a3, a4)); +b("File \"bs_set_int_test.ml\", line 141, characters 4-11", Belt_SetInt.eq(a3, a4)); -var a6 = Bs_SetInt.remove(Bs_SetInt.removeMany(a1, Array_data_util.randomRange(0, 39)), 40); +var a6 = Belt_SetInt.remove(Belt_SetInt.removeMany(a1, Array_data_util.randomRange(0, 39)), 40); -b("File \"bs_set_int_test.ml\", line 143, characters 4-11", Bs_SetInt.eq(a5, a6)); +b("File \"bs_set_int_test.ml\", line 143, characters 4-11", Belt_SetInt.eq(a5, a6)); -var a7 = Bs_SetInt.remove(a1, 40); +var a7 = Belt_SetInt.remove(a1, 40); -var match$3 = Bs_SetInt.split(a7, 40); +var match$3 = Belt_SetInt.split(a7, 40); var match$4 = match$3[0]; @@ -297,46 +297,46 @@ var a9 = match$4[1]; b("File \"bs_set_int_test.ml\", line 146, characters 4-11", 1 - match$3[1]); -b("File \"bs_set_int_test.ml\", line 147, characters 4-11", Bs_SetInt.eq(a4, match$4[0])); +b("File \"bs_set_int_test.ml\", line 147, characters 4-11", Belt_SetInt.eq(a4, match$4[0])); -b("File \"bs_set_int_test.ml\", line 148, characters 4-11", Bs_SetInt.eq(a5, a9)); +b("File \"bs_set_int_test.ml\", line 148, characters 4-11", Belt_SetInt.eq(a5, a9)); -var a10 = Bs_SetInt.removeMany(a9, Array_data_util.randomRange(42, 2000)); +var a10 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(42, 2000)); -eq("File \"bs_set_int_test.ml\", line 150, characters 5-12", Bs_SetInt.size(a10), 1); +eq("File \"bs_set_int_test.ml\", line 150, characters 5-12", Belt_SetInt.size(a10), 1); -var a11 = Bs_SetInt.removeMany(a9, Array_data_util.randomRange(0, 2000)); +var a11 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(0, 2000)); -b("File \"bs_set_int_test.ml\", line 152, characters 4-11", Bs_SetInt.isEmpty(a11)); +b("File \"bs_set_int_test.ml\", line 152, characters 4-11", Belt_SetInt.isEmpty(a11)); -var match$5 = Bs_SetInt.split(Bs_SetInt.empty, 0); +var match$5 = Belt_SetInt.split(Belt_SetInt.empty, 0); var match$6 = match$5[0]; -b("File \"bs_set_int_test.ml\", line 156, characters 4-11", Bs_SetInt.isEmpty(match$6[0])); +b("File \"bs_set_int_test.ml\", line 156, characters 4-11", Belt_SetInt.isEmpty(match$6[0])); -b("File \"bs_set_int_test.ml\", line 157, characters 4-11", Bs_SetInt.isEmpty(match$6[1])); +b("File \"bs_set_int_test.ml\", line 157, characters 4-11", Belt_SetInt.isEmpty(match$6[1])); b("File \"bs_set_int_test.ml\", line 158, characters 4-11", 1 - match$5[1]); -var v$12 = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 2000)); +var v$12 = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 2000)); -var v0 = Bs_SetInt.ofArray(Array_data_util.randomRange(0, 2000)); +var v0 = Belt_SetInt.ofArray(Array_data_util.randomRange(0, 2000)); -var v1 = Bs_SetInt.ofArray(Array_data_util.randomRange(1, 2001)); +var v1 = Belt_SetInt.ofArray(Array_data_util.randomRange(1, 2001)); -var v2 = Bs_SetInt.ofArray(Array_data_util.randomRange(3, 2002)); +var v2 = Belt_SetInt.ofArray(Array_data_util.randomRange(3, 2002)); -var v3 = Bs_SetInt.removeMany(v2, /* int array */[ +var v3 = Belt_SetInt.removeMany(v2, /* int array */[ 2002, 2001 ]); -var us = Bs_Array.map(Array_data_util.randomRange(1000, 3000), (function (x) { - return Bs_SetInt.has(v$12, x); +var us = Belt_Array.map(Array_data_util.randomRange(1000, 3000), (function (x) { + return Belt_SetInt.has(v$12, x); })); -var counted = Bs_Array.reduce(us, 0, (function (acc, x) { +var counted = Belt_Array.reduce(us, 0, (function (acc, x) { if (x) { return acc + 1 | 0; } else { @@ -346,21 +346,21 @@ var counted = Bs_Array.reduce(us, 0, (function (acc, x) { eq("File \"bs_set_int_test.ml\", line 168, characters 5-12", counted, 1001); -b("File \"bs_set_int_test.ml\", line 169, characters 4-11", Bs_SetInt.eq(v$12, v0)); +b("File \"bs_set_int_test.ml\", line 169, characters 4-11", Belt_SetInt.eq(v$12, v0)); -b("File \"bs_set_int_test.ml\", line 170, characters 4-11", +(Bs_SetInt.cmp(v$12, v0) === 0)); +b("File \"bs_set_int_test.ml\", line 170, characters 4-11", +(Belt_SetInt.cmp(v$12, v0) === 0)); -b("File \"bs_set_int_test.ml\", line 171, characters 4-11", +(Bs_SetInt.cmp(v$12, v1) < 0)); +b("File \"bs_set_int_test.ml\", line 171, characters 4-11", +(Belt_SetInt.cmp(v$12, v1) < 0)); -b("File \"bs_set_int_test.ml\", line 172, characters 4-11", +(Bs_SetInt.cmp(v$12, v2) > 0)); +b("File \"bs_set_int_test.ml\", line 172, characters 4-11", +(Belt_SetInt.cmp(v$12, v2) > 0)); -b("File \"bs_set_int_test.ml\", line 173, characters 4-11", Bs_SetInt.subset(v3, v0)); +b("File \"bs_set_int_test.ml\", line 173, characters 4-11", Belt_SetInt.subset(v3, v0)); -b("File \"bs_set_int_test.ml\", line 174, characters 4-11", 1 - Bs_SetInt.subset(v1, v0)); +b("File \"bs_set_int_test.ml\", line 174, characters 4-11", 1 - Belt_SetInt.subset(v1, v0)); -eq("File \"bs_set_int_test.ml\", line 175, characters 5-12", Bs_SetInt.get(v$12, 30), /* Some */[30]); +eq("File \"bs_set_int_test.ml\", line 175, characters 5-12", Belt_SetInt.get(v$12, 30), /* Some */[30]); -eq("File \"bs_set_int_test.ml\", line 176, characters 5-12", Bs_SetInt.get(v$12, 3000), /* None */0); +eq("File \"bs_set_int_test.ml\", line 176, characters 5-12", Belt_SetInt.get(v$12, 3000), /* None */0); Mt.from_pair_suites("bs_set_int_test.ml", suites[0]); @@ -370,7 +370,7 @@ var I = 0; var A = 0; -var ofA = Bs_SetInt.ofArray; +var ofA = Belt_SetInt.ofArray; exports.suites = suites; exports.test_id = test_id; diff --git a/jscomp/test/bs_set_int_test.ml b/jscomp/test/bs_set_int_test.ml index f5e6aa43c1..8553739e11 100644 --- a/jscomp/test/bs_set_int_test.ml +++ b/jscomp/test/bs_set_int_test.ml @@ -4,9 +4,9 @@ let eq loc x y = Mt.eq_suites ~suites ~test_id loc x y let b loc v = Mt.bool_suites ~suites ~test_id loc v -module N = Bs.Set.Int +module N = Belt.Set.Int module I = Array_data_util -module A = Bs_Array +module A = Belt.Array let (=~) s i = N.(eq (ofArray i) s) let (=*) a b = @@ -101,7 +101,7 @@ let () = let u = N.ofArray v in b __LOC__ (N.checkInvariantInternal u ); let firstHalf = A.slice v 0 2_000 in - let xx = Bs.Array.reduce firstHalf u N.remove in + let xx = Belt.Array.reduce firstHalf u N.remove in b __LOC__ (N.checkInvariantInternal u); b __LOC__ N.(eq (union (ofArray firstHalf) xx) u) diff --git a/jscomp/test/bs_sort_test.js b/jscomp/test/bs_sort_test.js index c7b9a3ed74..b3a50df4d1 100644 --- a/jscomp/test/bs_sort_test.js +++ b/jscomp/test/bs_sort_test.js @@ -1,12 +1,12 @@ 'use strict'; var Mt = require("./mt.js"); -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_Range = require("../../lib/js/bs_Range.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); -var Bs_SortArray = require("../../lib/js/bs_SortArray.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_Range = require("../../lib/js/belt_Range.js"); +var Belt_SortArray = require("../../lib/js/belt_SortArray.js"); var Array_data_util = require("./array_data_util.js"); -var Bs_SortArrayInt = require("../../lib/js/bs_SortArrayInt.js"); +var Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); var suites = [/* [] */0]; @@ -28,7 +28,7 @@ function unions(xs, ys) { var lenX = xs.length; var lenY = ys.length; var o = new Array(lenX + lenY | 0); - var v = Bs_SortArray.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + var v = Belt_SortArray.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); o.length = v; return o; } @@ -37,7 +37,7 @@ function inters(xs, ys) { var lenX = xs.length; var lenY = ys.length; var o = new Array(lenX); - var v = Bs_SortArray.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + var v = Belt_SortArray.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); o.length = v; return o; } @@ -46,7 +46,7 @@ function diffs(xs, ys) { var lenX = xs.length; var lenY = ys.length; var o = new Array(lenX); - var v = Bs_SortArray.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + var v = Belt_SortArray.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); o.length = v; return o; } @@ -87,61 +87,61 @@ eq("File \"bs_sort_test.ml\", line 48, characters 5-12", diffs(Array_data_util.r 2 ]); -b("File \"bs_sort_test.ml\", line 50, characters 4-11", Bs_Range.every(0, 200, (function (i) { +b("File \"bs_sort_test.ml\", line 50, characters 4-11", Belt_Range.every(0, 200, (function (i) { var v = Array_data_util.randomRange(0, i); - Bs_SortArray.stableSortInPlaceBy(v, cmp); - return Bs_SortArray.isSorted(v, cmp); + Belt_SortArray.stableSortInPlaceBy(v, cmp); + return Belt_SortArray.isSorted(v, cmp); }))); -b("File \"bs_sort_test.ml\", line 56, characters 4-11", Bs_Range.every(0, 200, (function (i) { +b("File \"bs_sort_test.ml\", line 56, characters 4-11", Belt_Range.every(0, 200, (function (i) { var v = Array_data_util.randomRange(0, i); - Bs_SortArray.stableSortInPlaceBy(v, cmp); - return Bs_SortArray.isSorted(v, cmp); + Belt_SortArray.stableSortInPlaceBy(v, cmp); + return Belt_SortArray.isSorted(v, cmp); }))); -b("File \"bs_sort_test.ml\", line 62, characters 4-11", Bs_SortArray.isSorted(/* int array */[], cmp)); +b("File \"bs_sort_test.ml\", line 62, characters 4-11", Belt_SortArray.isSorted(/* int array */[], cmp)); -b("File \"bs_sort_test.ml\", line 65, characters 4-11", Bs_SortArray.isSorted(/* int array */[0], cmp)); +b("File \"bs_sort_test.ml\", line 65, characters 4-11", Belt_SortArray.isSorted(/* int array */[0], cmp)); -b("File \"bs_sort_test.ml\", line 68, characters 4-11", Bs_SortArray.isSorted(/* int array */[ +b("File \"bs_sort_test.ml\", line 68, characters 4-11", Belt_SortArray.isSorted(/* int array */[ 0, 1 ], cmp)); -b("File \"bs_sort_test.ml\", line 70, characters 4-11", 1 - Bs_SortArray.isSorted(/* int array */[ +b("File \"bs_sort_test.ml\", line 70, characters 4-11", 1 - Belt_SortArray.isSorted(/* int array */[ 1, 0 ], cmp)); var u = Array_data_util.randomRange(0, 1000000); -var u1 = Bs_Array.copy(u); +var u1 = Belt_Array.copy(u); -var u2 = Bs_Array.copy(u); +var u2 = Belt_Array.copy(u); console.time("bs_sort_test.ml 80"); -Bs_SortArray.stableSortInPlaceBy(u, cmp); +Belt_SortArray.stableSortInPlaceBy(u, cmp); console.timeEnd("bs_sort_test.ml 80"); -b("File \"bs_sort_test.ml\", line 81, characters 4-11", Bs_SortArray.isSorted(u, cmp)); +b("File \"bs_sort_test.ml\", line 81, characters 4-11", Belt_SortArray.isSorted(u, cmp)); console.time("bs_sort_test.ml 82"); -Bs_SortArrayInt.stableSortInPlace(u2); +Belt_SortArrayInt.stableSortInPlace(u2); console.timeEnd("bs_sort_test.ml 82"); -b("File \"bs_sort_test.ml\", line 83, characters 4-11", Bs_SortArray.isSorted(u2, cmp)); +b("File \"bs_sort_test.ml\", line 83, characters 4-11", Belt_SortArray.isSorted(u2, cmp)); console.time("bs_sort_test.ml 84"); -Bs_SortArray.stableSortInPlaceBy(u1, cmp); +Belt_SortArray.stableSortInPlaceBy(u1, cmp); console.timeEnd("bs_sort_test.ml 84"); -b("File \"bs_sort_test.ml\", line 85, characters 4-11", Bs_SortArray.isSorted(u1, cmp)); +b("File \"bs_sort_test.ml\", line 85, characters 4-11", Belt_SortArray.isSorted(u1, cmp)); var u$1 = /* array */[ /* tuple */[ @@ -158,7 +158,7 @@ var u$1 = /* array */[ ] ]; -eq("File \"bs_sort_test.ml\", line 90, characters 5-12", Bs_SortArray.stableSortBy(u$1, (function (param, param$1) { +eq("File \"bs_sort_test.ml\", line 90, characters 5-12", Belt_SortArray.stableSortBy(u$1, (function (param, param$1) { return param[0] - param$1[0] | 0; })), /* array */[ /* tuple */[ @@ -194,7 +194,7 @@ var u$2 = /* array */[ ] ]; -eq("File \"bs_sort_test.ml\", line 96, characters 5-12", Bs_SortArray.stableSortBy(u$2, (function (param, param$1) { +eq("File \"bs_sort_test.ml\", line 96, characters 5-12", Belt_SortArray.stableSortBy(u$2, (function (param, param$1) { return param[0] - param$1[0] | 0; })), /* array */[ /* tuple */[ @@ -242,7 +242,7 @@ var u$3 = /* array */[ ] ]; -eq("File \"bs_sort_test.ml\", line 102, characters 5-12", Bs_SortArray.stableSortBy(u$3, (function (param, param$1) { +eq("File \"bs_sort_test.ml\", line 102, characters 5-12", Belt_SortArray.stableSortBy(u$3, (function (param, param$1) { return param[0] - param$1[0] | 0; })), /* array */[ /* tuple */[ @@ -271,14 +271,14 @@ eq("File \"bs_sort_test.ml\", line 102, characters 5-12", Bs_SortArray.stableSor ] ]); -eq("File \"bs_sort_test.ml\", line 111, characters 5-12", Bs_SortArray.binarySearchBy(/* int array */[ +eq("File \"bs_sort_test.ml\", line 111, characters 5-12", Belt_SortArray.binarySearchBy(/* int array */[ 1, 3, 5, 7 ], 4, Caml_obj.caml_compare) ^ -1, 2); -eq("File \"bs_sort_test.ml\", line 112, characters 5-12", Bs_SortArray.binarySearchBy(/* array */[ +eq("File \"bs_sort_test.ml\", line 112, characters 5-12", Belt_SortArray.binarySearchBy(/* array */[ 1, 2, 3, @@ -288,7 +288,7 @@ eq("File \"bs_sort_test.ml\", line 112, characters 5-12", Bs_SortArray.binarySea 36 ], 33, cmp), 4); -eq("File \"bs_sort_test.ml\", line 113, characters 5-12", Bs_SortArray.binarySearchBy(/* array */[ +eq("File \"bs_sort_test.ml\", line 113, characters 5-12", Belt_SortArray.binarySearchBy(/* array */[ 1, 2, 3, @@ -298,7 +298,7 @@ eq("File \"bs_sort_test.ml\", line 113, characters 5-12", Bs_SortArray.binarySea 36 ], 1, cmp), 0); -eq("File \"bs_sort_test.ml\", line 114, characters 5-12", Bs_SortArray.binarySearchBy(/* array */[ +eq("File \"bs_sort_test.ml\", line 114, characters 5-12", Belt_SortArray.binarySearchBy(/* array */[ 1, 2, 3, @@ -308,7 +308,7 @@ eq("File \"bs_sort_test.ml\", line 114, characters 5-12", Bs_SortArray.binarySea 36 ], 2, cmp), 1); -eq("File \"bs_sort_test.ml\", line 115, characters 5-12", Bs_SortArray.binarySearchBy(/* array */[ +eq("File \"bs_sort_test.ml\", line 115, characters 5-12", Belt_SortArray.binarySearchBy(/* array */[ 1, 2, 3, @@ -318,7 +318,7 @@ eq("File \"bs_sort_test.ml\", line 115, characters 5-12", Bs_SortArray.binarySea 36 ], 3, cmp), 2); -eq("File \"bs_sort_test.ml\", line 116, characters 5-12", Bs_SortArray.binarySearchBy(/* array */[ +eq("File \"bs_sort_test.ml\", line 116, characters 5-12", Belt_SortArray.binarySearchBy(/* array */[ 1, 2, 3, @@ -330,51 +330,51 @@ eq("File \"bs_sort_test.ml\", line 116, characters 5-12", Bs_SortArray.binarySea var aa = Array_data_util.range(0, 1000); -b("File \"bs_sort_test.ml\", line 118, characters 4-11", Bs_Range.every(0, 1000, (function (i) { - return +(Bs_SortArray.binarySearchBy(aa, i, cmp) === i); +b("File \"bs_sort_test.ml\", line 118, characters 4-11", Belt_Range.every(0, 1000, (function (i) { + return +(Belt_SortArray.binarySearchBy(aa, i, cmp) === i); }))); -var cc = Bs_Array.map(Array_data_util.range(0, 2000), (function (x) { +var cc = Belt_Array.map(Array_data_util.range(0, 2000), (function (x) { return (x << 1); })); -eq("File \"bs_sort_test.ml\", line 123, characters 5-12", Bs_SortArray.binarySearchBy(cc, 5000, cmp) ^ -1, 2001); +eq("File \"bs_sort_test.ml\", line 123, characters 5-12", Belt_SortArray.binarySearchBy(cc, 5000, cmp) ^ -1, 2001); -eq("File \"bs_sort_test.ml\", line 124, characters 5-12", Bs_SortArray.binarySearchBy(cc, -1, cmp) ^ -1, 0); +eq("File \"bs_sort_test.ml\", line 124, characters 5-12", Belt_SortArray.binarySearchBy(cc, -1, cmp) ^ -1, 0); -eq("File \"bs_sort_test.ml\", line 125, characters 5-12", Bs_SortArray.binarySearchBy(cc, 0, cmp), 0); +eq("File \"bs_sort_test.ml\", line 125, characters 5-12", Belt_SortArray.binarySearchBy(cc, 0, cmp), 0); -eq("File \"bs_sort_test.ml\", line 127, characters 5-12", Bs_SortArray.binarySearchBy(cc, 1, cmp) ^ -1, 1); +eq("File \"bs_sort_test.ml\", line 127, characters 5-12", Belt_SortArray.binarySearchBy(cc, 1, cmp) ^ -1, 1); -b("File \"bs_sort_test.ml\", line 128, characters 4-11", Bs_Range.every(0, 1999, (function (i) { - return +((Bs_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp) ^ -1) === (i + 1 | 0)); +b("File \"bs_sort_test.ml\", line 128, characters 4-11", Belt_Range.every(0, 1999, (function (i) { + return +((Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp) ^ -1) === (i + 1 | 0)); }))); function lt(x, y) { return +(x < y); } -eq("File \"bs_sort_test.ml\", line 135, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[], lt), 0); +eq("File \"bs_sort_test.ml\", line 135, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[], lt), 0); -eq("File \"bs_sort_test.ml\", line 136, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[1], lt), 1); +eq("File \"bs_sort_test.ml\", line 136, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[1], lt), 1); -eq("File \"bs_sort_test.ml\", line 137, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[ +eq("File \"bs_sort_test.ml\", line 137, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[ 1, 1 ], lt), 1); -eq("File \"bs_sort_test.ml\", line 138, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[ +eq("File \"bs_sort_test.ml\", line 138, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[ 1, 1, 2 ], lt), 1); -eq("File \"bs_sort_test.ml\", line 139, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[ +eq("File \"bs_sort_test.ml\", line 139, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[ 1, 2 ], lt), 2); -eq("File \"bs_sort_test.ml\", line 140, characters 5-12", Bs_SortArray.strictlySortedLength(/* array */[ +eq("File \"bs_sort_test.ml\", line 140, characters 5-12", Belt_SortArray.strictlySortedLength(/* array */[ 1, 2, 3, @@ -382,7 +382,7 @@ eq("File \"bs_sort_test.ml\", line 140, characters 5-12", Bs_SortArray.strictlyS 3 ], lt), 4); -eq("File \"bs_sort_test.ml\", line 141, characters 5-12", Bs_SortArray.strictlySortedLength(/* array */[ +eq("File \"bs_sort_test.ml\", line 141, characters 5-12", Belt_SortArray.strictlySortedLength(/* array */[ 4, 4, 3, @@ -390,14 +390,14 @@ eq("File \"bs_sort_test.ml\", line 141, characters 5-12", Bs_SortArray.strictlyS 1 ], lt), 1); -eq("File \"bs_sort_test.ml\", line 142, characters 5-12", Bs_SortArray.strictlySortedLength(/* int array */[ +eq("File \"bs_sort_test.ml\", line 142, characters 5-12", Belt_SortArray.strictlySortedLength(/* int array */[ 4, 3, 2, 1 ], lt), -4); -eq("File \"bs_sort_test.ml\", line 143, characters 5-12", Bs_SortArray.strictlySortedLength(/* array */[ +eq("File \"bs_sort_test.ml\", line 143, characters 5-12", Belt_SortArray.strictlySortedLength(/* array */[ 4, 3, 2, diff --git a/jscomp/test/bs_sort_test.ml b/jscomp/test/bs_sort_test.ml index 966ce3afb3..eac26dee3a 100644 --- a/jscomp/test/bs_sort_test.ml +++ b/jscomp/test/bs_sort_test.ml @@ -4,26 +4,26 @@ let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y let b loc x = Mt.bool_suites ~test_id ~suites loc x module I = Array_data_util -module S = Bs.SortArray -module R = Bs_Range +module S = Belt.SortArray +module R = Belt.Range let cmp = fun x y -> x - y -module A = Bs.Array +module A = Belt.Array let unions xs ys = let lenX, lenY = A.length xs, A.length ys in - let o = Bs_Array.makeUninitializedUnsafe (lenX + lenY) in + let o = A.makeUninitializedUnsafe (lenX + lenY) in let v = S.union xs 0 lenX ys 0 lenY o 0 cmp in A.truncateToLengthUnsafe o v ; o let inters xs ys = let lenX, lenY = A.length xs, A.length ys in - let o = Bs_Array.makeUninitializedUnsafe lenX in + let o = A.makeUninitializedUnsafe lenX in let v = S.intersect xs 0 lenX ys 0 lenY o 0 cmp in A.truncateToLengthUnsafe o v ; o let diffs xs ys = let lenX, lenY = A.length xs, A.length ys in - let o = Bs_Array.makeUninitializedUnsafe lenX in + let o = A.makeUninitializedUnsafe lenX in let v = S.diff xs 0 lenX ys 0 lenY o 0 cmp in A.truncateToLengthUnsafe o v ; o @@ -71,7 +71,7 @@ let () = (not @@ S.isSorted [|1;0|] cmp) -module SI = Bs.SortArray.Int +module SI = Belt.SortArray.Int let () = let u = I.randomRange 0 1_000_000 in let u1 = A.copy u in diff --git a/jscomp/test/bs_stack_test.js b/jscomp/test/bs_stack_test.js index 2025baffa9..6b29fa24c9 100644 --- a/jscomp/test/bs_stack_test.js +++ b/jscomp/test/bs_stack_test.js @@ -1,32 +1,32 @@ 'use strict'; var Js_undefined = require("../../lib/js/js_undefined.js"); -var Bs_MutableQueue = require("../../lib/js/bs_MutableQueue.js"); -var Bs_MutableStack = require("../../lib/js/bs_MutableStack.js"); +var Belt_MutableQueue = require("../../lib/js/belt_MutableQueue.js"); +var Belt_MutableStack = require("../../lib/js/belt_MutableStack.js"); function inOrder(v) { var current = v; var s = { root: null }; - var q = Bs_MutableQueue.make(/* () */0); + var q = Belt_MutableQueue.make(/* () */0); while(current !== undefined) { var v$1 = current; - Bs_MutableStack.push(s, v$1); + Belt_MutableStack.push(s, v$1); current = v$1.left; }; while(s.root !== null) { - current = Bs_MutableStack.popUndefined(s); + current = Belt_MutableStack.popUndefined(s); var v$2 = current; - Bs_MutableQueue.add(q, v$2.value); + Belt_MutableQueue.add(q, v$2.value); current = v$2.right; while(current !== undefined) { var v$3 = current; - Bs_MutableStack.push(s, v$3); + Belt_MutableStack.push(s, v$3); current = v$3.left; }; }; - return Bs_MutableQueue.toArray(q); + return Belt_MutableQueue.toArray(q); } function inOrder3(v) { @@ -34,23 +34,23 @@ function inOrder3(v) { var s = { root: null }; - var q = Bs_MutableQueue.make(/* () */0); + var q = Belt_MutableQueue.make(/* () */0); while(current !== undefined) { var v$1 = current; - Bs_MutableStack.push(s, v$1); + Belt_MutableStack.push(s, v$1); current = v$1.left; }; - Bs_MutableStack.dynamicPopIter(s, (function (popped) { - Bs_MutableQueue.add(q, popped.value); + Belt_MutableStack.dynamicPopIter(s, (function (popped) { + Belt_MutableQueue.add(q, popped.value); var current = popped.right; while(current !== undefined) { var v = current; - Bs_MutableStack.push(s, v); + Belt_MutableStack.push(s, v); current = v.left; }; return /* () */0; })); - return Bs_MutableQueue.toArray(q); + return Belt_MutableQueue.toArray(q); } function inOrder2(v) { @@ -59,16 +59,16 @@ function inOrder2(v) { var s = { root: null }; - var q = Bs_MutableQueue.make(/* () */0); + var q = Belt_MutableQueue.make(/* () */0); while(todo) { if (cursor !== undefined) { var v$1 = cursor; - Bs_MutableStack.push(s, v$1); + Belt_MutableStack.push(s, v$1); cursor = v$1.left; } else if (s.root !== null) { - cursor = Bs_MutableStack.popUndefined(s); + cursor = Belt_MutableStack.popUndefined(s); var current = cursor; - Bs_MutableQueue.add(q, current.value); + Belt_MutableQueue.add(q, current.value); cursor = current.right; } else { todo = /* false */0; @@ -91,7 +91,7 @@ function pushAllLeft(st1, s1) { var current = st1; while(current !== undefined) { var v = current; - Bs_MutableStack.push(s1, v); + Belt_MutableStack.push(s1, v); current = v.left; }; return /* () */0; diff --git a/jscomp/test/bs_stack_test.ml b/jscomp/test/bs_stack_test.ml index dd745bb92b..3ddc16765d 100644 --- a/jscomp/test/bs_stack_test.ml +++ b/jscomp/test/bs_stack_test.ml @@ -10,8 +10,8 @@ and t = node Js.undefined -module S = Bs.MutableStack -module Q = Bs.MutableQueue +module S = Belt.MutableStack +module Q = Belt.MutableQueue let inOrder (v : t) = let current = ref v in diff --git a/jscomp/test/derive_type_test.js b/jscomp/test/derive_type_test.js deleted file mode 100644 index e959d873f2..0000000000 --- a/jscomp/test/derive_type_test.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -var Block = require("../../lib/js/block.js"); -var Bs_dyn = require("../../lib/js/bs_dyn.js"); - -var shape = /* array */[ - "x", - "y" -]; - -function vv_to_value(x) { - var args = x; - return /* Record */Block.__(12, [ - shape, - /* array */[ - Bs_dyn.int_to_value(args[/* x */0]), - Bs_dyn.string_to_value(args[/* y */1]) - ] - ]); -} - -var x = 3; - -exports.x = x; -exports.vv_to_value = vv_to_value; -/* No side effect */ diff --git a/jscomp/test/gpr_2487.js b/jscomp/test/gpr_2487.js index 8a5e2d4a2b..1d2fdd3fe8 100644 --- a/jscomp/test/gpr_2487.js +++ b/jscomp/test/gpr_2487.js @@ -1,9 +1,9 @@ 'use strict'; -var Bs_Array = require("../../lib/js/bs_Array.js"); var Caml_obj = require("../../lib/js/caml_obj.js"); +var Belt_Array = require("../../lib/js/belt_Array.js"); -var b = Bs_Array.eq(/* int array */[ +var b = Belt_Array.eq(/* int array */[ 1, 2, 3 diff --git a/jscomp/test/gpr_2487.ml b/jscomp/test/gpr_2487.ml index c83c6fcb7d..8a759e4235 100644 --- a/jscomp/test/gpr_2487.ml +++ b/jscomp/test/gpr_2487.ml @@ -1,6 +1,6 @@ -module A = Bs.Array +module A = Belt.Array let b = - A.eq [|1;2;3|] [|1;2;3|] (=) \ No newline at end of file + A.eq [|1;2;3|] [|1;2;3|] (=) diff --git a/jscomp/test/imm_map_bench.js b/jscomp/test/imm_map_bench.js index 8e50a9bdef..db0761289e 100644 --- a/jscomp/test/imm_map_bench.js +++ b/jscomp/test/imm_map_bench.js @@ -1,8 +1,8 @@ 'use strict'; -var Bs_Array = require("../../lib/js/bs_Array.js"); -var Bs_MapInt = require("../../lib/js/bs_MapInt.js"); var Immutable = require("immutable"); +var Belt_Array = require("../../lib/js/belt_Array.js"); +var Belt_MapInt = require("../../lib/js/belt_MapInt.js"); var empty = new Immutable.OrderedMap(); @@ -23,7 +23,7 @@ function should(b) { } } -var shuffledDataAdd = Bs_Array.makeByAndShuffle(1000001, (function (i) { +var shuffledDataAdd = Belt_Array.makeByAndShuffle(1000001, (function (i) { return /* tuple */[ i, i @@ -39,9 +39,9 @@ function test() { } function test2() { - var v = Bs_MapInt.ofArray(shuffledDataAdd); + var v = Belt_MapInt.ofArray(shuffledDataAdd); for(var j = 0; j <= 1000000; ++j){ - should(Bs_MapInt.has(v, j)); + should(Belt_MapInt.has(v, j)); } return /* () */0; } diff --git a/jscomp/test/imm_map_bench.ml b/jscomp/test/imm_map_bench.ml index 89a66917d7..8a533cd39b 100644 --- a/jscomp/test/imm_map_bench.ml +++ b/jscomp/test/imm_map_bench.ml @@ -6,7 +6,7 @@ external get : map -> int -> int option = "get" [@@bs.send] [@@bs.return undefin external mem : map -> int -> bool = "has" [@@bs.send] -module A = Bs_Array +module A = Belt.Array let empty = empty () let ofArray kvs = let v = ref empty in @@ -31,7 +31,7 @@ let test () = should (mem v j) done -module M = Bs.Map.Int +module M = Belt.Map.Int let test2 () = diff --git a/jscomp/test/simple_derive_test.js b/jscomp/test/simple_derive_test.js deleted file mode 100644 index 560e408ac1..0000000000 --- a/jscomp/test/simple_derive_test.js +++ /dev/null @@ -1,175 +0,0 @@ -'use strict'; - -var Block = require("../../lib/js/block.js"); -var Bs_dyn = require("../../lib/js/bs_dyn.js"); -var Bs_dyn_lib = require("../../lib/js/bs_dyn_lib.js"); - -var shape = /* array */[ - "x", - "y", - "a", - "b", - "c", - "tuple" -]; - -function vv_to_value(x) { - var args = x; - return /* Record */Block.__(12, [ - shape, - /* array */[ - Bs_dyn.int_to_value(args[/* x */0]), - Bs_dyn.string_to_value(args[/* y */1]), - Bs_dyn.int_to_value(args[/* a */2]), - Bs_dyn.float_to_value(args[/* b */3]), - Bs_dyn.int32_to_value(args[/* c */4]), - Bs_dyn.tuple_6_to_value(Bs_dyn.int_to_value, Bs_dyn.string_to_value, Bs_dyn.list_to_value(Bs_dyn.string_to_value), Bs_dyn.list_to_value(Bs_dyn.float_to_value), Bs_dyn.array_to_value(Bs_dyn.array_to_value(Bs_dyn.string_to_value)), Bs_dyn.int_to_value)(args[/* tuple */5]) - ] - ]); -} - -var shape_000 = /* constructors : array */[ - "A", - "B", - "C", - "D", - "E" -]; - -var shape_001 = /* arities : array */[ - 1, - 2, - 2, - 1, - 1 -]; - -var shape$1 = /* record */[ - shape_000, - shape_001 -]; - -function uu_to_value(x) { - var param = x; - switch (param.tag | 0) { - case 0 : - return /* Variant */Block.__(13, [ - shape$1, - 0, - /* array */[Bs_dyn.int_to_value(param[0])] - ]); - case 1 : - return /* Variant */Block.__(13, [ - shape$1, - 1, - /* array */[ - Bs_dyn.int_to_value(param[0]), - Bs_dyn.string_to_value(param[1]) - ] - ]); - case 2 : - return /* Variant */Block.__(13, [ - shape$1, - 2, - /* array */[ - vv_to_value(param[0]), - Bs_dyn.option_to_value(Bs_dyn.option_to_value(Bs_dyn.int_to_value))(param[1]) - ] - ]); - case 3 : - return /* Variant */Block.__(13, [ - shape$1, - 3, - /* array */[Bs_dyn.array_to_value(Bs_dyn.array_to_value(Bs_dyn.int_to_value))(param[0])] - ]); - case 4 : - return /* Variant */Block.__(13, [ - shape$1, - 4, - /* array */[Bs_dyn.tuple_2_to_value(Bs_dyn.int_to_value, Bs_dyn.int_to_value)(param[0])] - ]); - - } -} - -var tt_to_value = Bs_dyn.list_to_value(Bs_dyn.tuple_2_to_value(Bs_dyn.int_to_value, Bs_dyn.string_to_value)); - -var u = Bs_dyn.int_to_value(3); - -var h = Bs_dyn.array_to_value(Bs_dyn.list_to_value(Bs_dyn.list_to_value(Bs_dyn.int_to_value)))(/* array */[/* :: */[ - /* :: */[ - 3, - /* [] */0 - ], - /* [] */0 - ]]); - -var hh = Bs_dyn.array_to_value(Bs_dyn.list_to_value(Bs_dyn.list_to_value(tt_to_value)))(/* array */[/* :: */[ - /* :: */[ - /* :: */[ - /* tuple */[ - 3, - "3" - ], - /* [] */0 - ], - /* [] */0 - ], - /* [] */0 - ]]); - -console.log(Bs_dyn_lib.to_string(hh)); - -var shape_000$1 = /* constructors : array */[ - "A", - "B", - "C" -]; - -var shape_001$1 = /* arities : int array */[ - 0, - 0, - 1 -]; - -var shape$2 = /* record */[ - shape_000$1, - shape_001$1 -]; - -function enum_to_value(x) { - var param = x; - if (typeof param === "number") { - if (param !== 0) { - return /* Variant */Block.__(13, [ - shape$2, - 1, - /* array */[] - ]); - } else { - return /* Variant */Block.__(13, [ - shape$2, - 0, - /* array */[] - ]); - } - } else { - return /* Variant */Block.__(13, [ - shape$2, - 2, - /* array */[Bs_dyn.int_to_value(param[0])] - ]); - } -} - -console.log(Bs_dyn_lib.to_string(enum_to_value(/* C */[3]))); - -var t_to_value = Bs_dyn.int_to_value; - -exports.vv_to_value = vv_to_value; -exports.uu_to_value = uu_to_value; -exports.t_to_value = t_to_value; -exports.u = u; -exports.h = h; -exports.hh = hh; -/* tt_to_value Not a pure module */ diff --git a/jscomp/test/simple_derive_test.ml b/jscomp/test/simple_derive_test.ml index c51d69cf7d..50e6f3afdb 100644 --- a/jscomp/test/simple_derive_test.ml +++ b/jscomp/test/simple_derive_test.ml @@ -31,7 +31,7 @@ let h = [%bs.deriving.dynval: t list list array] [|[[3]]|] [@bs] let hh = [%bs.deriving.dynval: tt list list array] [|[[[3,"3"]]]|] [@bs] -let () = Js.log (Bs.Dyn_lib.to_string hh) +let () = Js.log (Belt.Dyn_lib.to_string hh) type nonrec enum = | A @@ -39,7 +39,7 @@ type nonrec enum = | C of t [@@bs.deriving{dynval}] -let () = Js.log (Bs.Dyn_lib.to_string ([%bs.deriving.dynval: enum] (C 3 ) [@bs])) +let () = Js.log (Belt.Dyn_lib.to_string ([%bs.deriving.dynval: enum] (C 3 ) [@bs])) (** imagine: diff --git a/lib/bsb.ml b/lib/bsb.ml index 6910c63a7c..d5d286fdf9 100644 --- a/lib/bsb.ml +++ b/lib/bsb.ml @@ -12992,8 +12992,10 @@ let root = OCamlRes.Res.([ \ ],\n\ \ \"warnings\": {\n\ \ \"error\" : \"+101\"\n\ - \ }\n\ - }") ; + \ },\n\ + \ \"refmt\": 3\n\ + }\n\ + ") ; Dir (".vscode", [ File ("tasks.json", "{\n\ diff --git a/lib/js/bs.js b/lib/js/belt.js similarity index 100% rename from lib/js/bs.js rename to lib/js/belt.js diff --git a/lib/js/bs_Array.js b/lib/js/belt_Array.js similarity index 96% rename from lib/js/bs_Array.js rename to lib/js/belt_Array.js index 5b14f63e14..de5915f3ee 100644 --- a/lib/js/bs_Array.js +++ b/lib/js/belt_Array.js @@ -14,7 +14,7 @@ function get(arr, i) { function getExn(arr, i) { if (!(i >= 0 && i < arr.length)) { - throw new Error("File \"bs_Array.ml\", line 25, characters 6-12"); + throw new Error("File \"belt_Array.ml\", line 25, characters 6-12"); } return arr[i]; } @@ -30,7 +30,7 @@ function set(arr, i, v) { function setExn(arr, i, v) { if (!(i >= 0 && i < arr.length)) { - throw new Error("File \"bs_Array.ml\", line 31, characters 4-10"); + throw new Error("File \"belt_Array.ml\", line 31, characters 4-10"); } arr[i] = v; return /* () */0; @@ -402,6 +402,19 @@ function reduceReverse(a, x, f) { return reduceReverseU(a, x, Curry.__2(f)); } +function reduceReverse2U(a, b, x, f) { + var r = x; + var len = Caml_primitive.caml_int_min(a.length, b.length); + for(var i = len - 1 | 0; i >= 0; --i){ + r = f(r, a[i], b[i]); + } + return r; +} + +function reduceReverse2(a, b, x, f) { + return reduceReverse2U(a, b, x, Curry.__3(f)); +} + function everyU(arr, b) { var len = arr.length; var arr$1 = arr; @@ -587,6 +600,8 @@ exports.reduceU = reduceU; exports.reduce = reduce; exports.reduceReverseU = reduceReverseU; exports.reduceReverse = reduceReverse; +exports.reduceReverse2U = reduceReverse2U; +exports.reduceReverse2 = reduceReverse2; exports.someU = someU; exports.some = some; exports.everyU = everyU; diff --git a/lib/js/bs_HashMap.js b/lib/js/belt_HashMap.js similarity index 84% rename from lib/js/bs_HashMap.js rename to lib/js/belt_HashMap.js index d789bae05e..439e5eb6a9 100644 --- a/lib/js/bs_HashMap.js +++ b/lib/js/belt_HashMap.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_internalBuckets = require("./bs_internalBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalBuckets = require("./belt_internalBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function size(prim) { return prim.size; @@ -66,7 +66,7 @@ function set0(h, key, value, eq, hash) { h_buckets[i] = { key: key, value: value, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; h.size = h.size + 1 | 0; } @@ -86,7 +86,7 @@ function set0(h, key, value, eq, hash) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -222,15 +222,15 @@ function has(h, key) { } } -function make(initialize_size, dict) { - return Bs_internalBucketsType.make(dict[/* hash */0], dict[/* eq */1], initialize_size); +function make(hintSize, id) { + return Belt_internalBucketsType.make(id[/* hash */0], id[/* eq */1], hintSize); } -function ofArray(arr, dict) { - var hash = dict[/* hash */0]; - var eq = dict[/* eq */1]; +function ofArray(arr, id) { + var hash = id[/* hash */0]; + var eq = id[/* eq */1]; var len = arr.length; - var v = Bs_internalBucketsType.make(hash, eq, len); + var v = Belt_internalBucketsType.make(hash, eq, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ var match = arr[i]; set0(v, match[0], match[1], eq, hash); @@ -249,38 +249,40 @@ function mergeMany(h, arr) { return /* () */0; } -var clear = Bs_internalBucketsType.clear; +var Int = 0; -var isEmpty = Bs_internalBucketsType.isEmpty; +var $$String = 0; -var copy = Bs_internalBuckets.copy; +var clear = Belt_internalBucketsType.clear; -var forEachU = Bs_internalBuckets.forEachU; +var isEmpty = Belt_internalBucketsType.isEmpty; -var forEach = Bs_internalBuckets.forEach; +var copy = Belt_internalBuckets.copy; -var reduceU = Bs_internalBuckets.reduceU; +var forEachU = Belt_internalBuckets.forEachU; -var reduce = Bs_internalBuckets.reduce; +var forEach = Belt_internalBuckets.forEach; -var keepMapInPlaceU = Bs_internalBuckets.keepMapInPlaceU; +var reduceU = Belt_internalBuckets.reduceU; -var keepMapInPlace = Bs_internalBuckets.keepMapInPlace; +var reduce = Belt_internalBuckets.reduce; -var toArray = Bs_internalBuckets.toArray; +var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; -var keysToArray = Bs_internalBuckets.keysToArray; +var keepMapInPlace = Belt_internalBuckets.keepMapInPlace; -var valuesToArray = Bs_internalBuckets.valuesToArray; +var toArray = Belt_internalBuckets.toArray; -var getBucketHistogram = Bs_internalBuckets.getBucketHistogram; +var keysToArray = Belt_internalBuckets.keysToArray; -var logStats = Bs_internalBuckets.logStats; +var valuesToArray = Belt_internalBuckets.valuesToArray; -var Int = 0; +var getBucketHistogram = Belt_internalBuckets.getBucketHistogram; -var $$String = 0; +var logStats = Belt_internalBuckets.logStats; +exports.Int = Int; +exports.$$String = $$String; exports.make = make; exports.clear = clear; exports.isEmpty = isEmpty; @@ -303,6 +305,4 @@ exports.ofArray = ofArray; exports.mergeMany = mergeMany; exports.getBucketHistogram = getBucketHistogram; exports.logStats = logStats; -exports.Int = Int; -exports.$$String = $$String; /* No side effect */ diff --git a/lib/js/bs_HashMapInt.js b/lib/js/belt_HashMapInt.js similarity index 85% rename from lib/js/bs_HashMapInt.js rename to lib/js/belt_HashMapInt.js index 9cfe71b6f1..9e485ce2c1 100644 --- a/lib/js/bs_HashMapInt.js +++ b/lib/js/belt_HashMapInt.js @@ -1,8 +1,8 @@ 'use strict'; var Caml_hash = require("./caml_hash.js"); -var Bs_internalBuckets = require("./bs_internalBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalBuckets = require("./belt_internalBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { while(true) { @@ -64,7 +64,7 @@ function set(h, key, value) { h_buckets[i] = { key: key, value: value, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; h.size = h.size + 1 | 0; } @@ -83,7 +83,7 @@ function set(h, key, value) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -210,8 +210,8 @@ function has(h, key) { } } -function make(size) { - return Bs_internalBucketsType.make(/* () */0, /* () */0, size); +function make(hintSize) { + return Belt_internalBucketsType.make(/* () */0, /* () */0, hintSize); } function size(prim) { @@ -220,7 +220,7 @@ function size(prim) { function ofArray(arr) { var len = arr.length; - var v = Bs_internalBucketsType.make(/* () */0, /* () */0, len); + var v = Belt_internalBucketsType.make(/* () */0, /* () */0, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ var match = arr[i]; set(v, match[0], match[1]); @@ -237,33 +237,33 @@ function mergeMany(h, arr) { return /* () */0; } -var clear = Bs_internalBucketsType.clear; +var clear = Belt_internalBucketsType.clear; -var isEmpty = Bs_internalBucketsType.isEmpty; +var isEmpty = Belt_internalBucketsType.isEmpty; -var copy = Bs_internalBuckets.copy; +var copy = Belt_internalBuckets.copy; -var forEachU = Bs_internalBuckets.forEachU; +var forEachU = Belt_internalBuckets.forEachU; -var forEach = Bs_internalBuckets.forEach; +var forEach = Belt_internalBuckets.forEach; -var reduceU = Bs_internalBuckets.reduceU; +var reduceU = Belt_internalBuckets.reduceU; -var reduce = Bs_internalBuckets.reduce; +var reduce = Belt_internalBuckets.reduce; -var keepMapInPlaceU = Bs_internalBuckets.keepMapInPlaceU; +var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; -var keepMapInPlace = Bs_internalBuckets.keepMapInPlace; +var keepMapInPlace = Belt_internalBuckets.keepMapInPlace; -var toArray = Bs_internalBuckets.toArray; +var toArray = Belt_internalBuckets.toArray; -var keysToArray = Bs_internalBuckets.keysToArray; +var keysToArray = Belt_internalBuckets.keysToArray; -var valuesToArray = Bs_internalBuckets.valuesToArray; +var valuesToArray = Belt_internalBuckets.valuesToArray; -var getBucketHistogram = Bs_internalBuckets.getBucketHistogram; +var getBucketHistogram = Belt_internalBuckets.getBucketHistogram; -var logStats = Bs_internalBuckets.logStats; +var logStats = Belt_internalBuckets.logStats; exports.make = make; exports.clear = clear; diff --git a/lib/js/bs_HashMapString.js b/lib/js/belt_HashMapString.js similarity index 85% rename from lib/js/bs_HashMapString.js rename to lib/js/belt_HashMapString.js index 3ab2fbc661..556f78edd0 100644 --- a/lib/js/bs_HashMapString.js +++ b/lib/js/belt_HashMapString.js @@ -1,8 +1,8 @@ 'use strict'; var Caml_hash = require("./caml_hash.js"); -var Bs_internalBuckets = require("./bs_internalBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalBuckets = require("./belt_internalBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) { while(true) { @@ -64,7 +64,7 @@ function set(h, key, value) { h_buckets[i] = { key: key, value: value, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; h.size = h.size + 1 | 0; } @@ -83,7 +83,7 @@ function set(h, key, value) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -210,8 +210,8 @@ function has(h, key) { } } -function make(size) { - return Bs_internalBucketsType.make(/* () */0, /* () */0, size); +function make(hintSize) { + return Belt_internalBucketsType.make(/* () */0, /* () */0, hintSize); } function size(prim) { @@ -220,7 +220,7 @@ function size(prim) { function ofArray(arr) { var len = arr.length; - var v = Bs_internalBucketsType.make(/* () */0, /* () */0, len); + var v = Belt_internalBucketsType.make(/* () */0, /* () */0, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ var match = arr[i]; set(v, match[0], match[1]); @@ -237,33 +237,33 @@ function mergeMany(h, arr) { return /* () */0; } -var clear = Bs_internalBucketsType.clear; +var clear = Belt_internalBucketsType.clear; -var isEmpty = Bs_internalBucketsType.isEmpty; +var isEmpty = Belt_internalBucketsType.isEmpty; -var copy = Bs_internalBuckets.copy; +var copy = Belt_internalBuckets.copy; -var forEachU = Bs_internalBuckets.forEachU; +var forEachU = Belt_internalBuckets.forEachU; -var forEach = Bs_internalBuckets.forEach; +var forEach = Belt_internalBuckets.forEach; -var reduceU = Bs_internalBuckets.reduceU; +var reduceU = Belt_internalBuckets.reduceU; -var reduce = Bs_internalBuckets.reduce; +var reduce = Belt_internalBuckets.reduce; -var keepMapInPlaceU = Bs_internalBuckets.keepMapInPlaceU; +var keepMapInPlaceU = Belt_internalBuckets.keepMapInPlaceU; -var keepMapInPlace = Bs_internalBuckets.keepMapInPlace; +var keepMapInPlace = Belt_internalBuckets.keepMapInPlace; -var toArray = Bs_internalBuckets.toArray; +var toArray = Belt_internalBuckets.toArray; -var keysToArray = Bs_internalBuckets.keysToArray; +var keysToArray = Belt_internalBuckets.keysToArray; -var valuesToArray = Bs_internalBuckets.valuesToArray; +var valuesToArray = Belt_internalBuckets.valuesToArray; -var getBucketHistogram = Bs_internalBuckets.getBucketHistogram; +var getBucketHistogram = Belt_internalBuckets.getBucketHistogram; -var logStats = Bs_internalBuckets.logStats; +var logStats = Belt_internalBuckets.logStats; exports.make = make; exports.clear = clear; diff --git a/lib/js/bs_HashSet.js b/lib/js/belt_HashSet.js similarity index 81% rename from lib/js/bs_HashSet.js rename to lib/js/belt_HashSet.js index 5e5541991b..e9e4281bc8 100644 --- a/lib/js/bs_HashSet.js +++ b/lib/js/belt_HashSet.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_internalSetBuckets = require("./bs_internalSetBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalSetBuckets = require("./belt_internalSetBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyBucket(hash, h_buckets, ndata_tail, _old_bucket) { while(true) { @@ -81,7 +81,7 @@ function addBucket(h, key, _cell, eq) { h.size = h.size + 1 | 0; cell.next = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; return /* () */0; } @@ -100,7 +100,7 @@ function add0(h, key, hash, eq) { h.size = h.size + 1 | 0; h_buckets[i] = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; } if (h.size > (buckets_len << 1)) { @@ -119,7 +119,7 @@ function add0(h, key, hash, eq) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -165,19 +165,19 @@ function has(h, key) { } } -function make(initialize_size, dict) { - return Bs_internalBucketsType.make(dict[/* hash */0], dict[/* eq */1], initialize_size); +function make(hintSize, id) { + return Belt_internalBucketsType.make(id[/* hash */0], id[/* eq */1], hintSize); } function size(prim) { return prim.size; } -function ofArray(arr, dict) { - var eq = dict[/* eq */1]; - var hash = dict[/* hash */0]; +function ofArray(arr, id) { + var eq = id[/* eq */1]; + var hash = id[/* hash */0]; var len = arr.length; - var v = Bs_internalBucketsType.make(hash, eq, len); + var v = Belt_internalBucketsType.make(hash, eq, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ add0(v, arr[i], hash, eq); } @@ -198,25 +198,25 @@ var Int = 0; var $$String = 0; -var clear = Bs_internalBucketsType.clear; +var clear = Belt_internalBucketsType.clear; -var isEmpty = Bs_internalBucketsType.isEmpty; +var isEmpty = Belt_internalBucketsType.isEmpty; -var copy = Bs_internalSetBuckets.copy; +var copy = Belt_internalSetBuckets.copy; -var forEachU = Bs_internalSetBuckets.forEachU; +var forEachU = Belt_internalSetBuckets.forEachU; -var forEach = Bs_internalSetBuckets.forEach; +var forEach = Belt_internalSetBuckets.forEach; -var reduceU = Bs_internalSetBuckets.reduceU; +var reduceU = Belt_internalSetBuckets.reduceU; -var reduce = Bs_internalSetBuckets.reduce; +var reduce = Belt_internalSetBuckets.reduce; -var logStats = Bs_internalSetBuckets.logStats; +var logStats = Belt_internalSetBuckets.logStats; -var toArray = Bs_internalSetBuckets.toArray; +var toArray = Belt_internalSetBuckets.toArray; -var getBucketHistogram = Bs_internalSetBuckets.getBucketHistogram; +var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; exports.Int = Int; exports.$$String = $$String; diff --git a/lib/js/bs_HashSetInt.js b/lib/js/belt_HashSetInt.js similarity index 82% rename from lib/js/bs_HashSetInt.js rename to lib/js/belt_HashSetInt.js index 6701aa7ba0..0cd7089dce 100644 --- a/lib/js/bs_HashSetInt.js +++ b/lib/js/belt_HashSetInt.js @@ -1,8 +1,8 @@ 'use strict'; var Caml_hash = require("./caml_hash.js"); -var Bs_internalSetBuckets = require("./bs_internalSetBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalSetBuckets = require("./belt_internalSetBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyBucket(h_buckets, ndata_tail, _old_bucket) { while(true) { @@ -79,7 +79,7 @@ function addBucket(h, key, _cell) { h.size = h.size + 1 | 0; cell.next = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; return /* () */0; } @@ -99,7 +99,7 @@ function add(h, key) { } else { h_buckets[i] = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; h.size = h.size + 1 | 0; } @@ -118,7 +118,7 @@ function add(h, key) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -158,8 +158,8 @@ function has(h, key) { } } -function make(size) { - return Bs_internalBucketsType.make(/* () */0, /* () */0, size); +function make(hintSize) { + return Belt_internalBucketsType.make(/* () */0, /* () */0, hintSize); } function size(prim) { @@ -168,7 +168,7 @@ function size(prim) { function ofArray(arr) { var len = arr.length; - var v = Bs_internalBucketsType.make(/* () */0, /* () */0, len); + var v = Belt_internalBucketsType.make(/* () */0, /* () */0, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ add(v, arr[i]); } @@ -183,25 +183,25 @@ function mergeMany(h, arr) { return /* () */0; } -var clear = Bs_internalBucketsType.clear; +var clear = Belt_internalBucketsType.clear; -var isEmpty = Bs_internalBucketsType.isEmpty; +var isEmpty = Belt_internalBucketsType.isEmpty; -var copy = Bs_internalSetBuckets.copy; +var copy = Belt_internalSetBuckets.copy; -var forEachU = Bs_internalSetBuckets.forEachU; +var forEachU = Belt_internalSetBuckets.forEachU; -var forEach = Bs_internalSetBuckets.forEach; +var forEach = Belt_internalSetBuckets.forEach; -var reduceU = Bs_internalSetBuckets.reduceU; +var reduceU = Belt_internalSetBuckets.reduceU; -var reduce = Bs_internalSetBuckets.reduce; +var reduce = Belt_internalSetBuckets.reduce; -var logStats = Bs_internalSetBuckets.logStats; +var logStats = Belt_internalSetBuckets.logStats; -var toArray = Bs_internalSetBuckets.toArray; +var toArray = Belt_internalSetBuckets.toArray; -var getBucketHistogram = Bs_internalSetBuckets.getBucketHistogram; +var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; exports.make = make; exports.clear = clear; diff --git a/lib/js/bs_HashSetString.js b/lib/js/belt_HashSetString.js similarity index 82% rename from lib/js/bs_HashSetString.js rename to lib/js/belt_HashSetString.js index f20ee582a6..8483e541cb 100644 --- a/lib/js/bs_HashSetString.js +++ b/lib/js/belt_HashSetString.js @@ -1,8 +1,8 @@ 'use strict'; var Caml_hash = require("./caml_hash.js"); -var Bs_internalSetBuckets = require("./bs_internalSetBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_internalSetBuckets = require("./belt_internalSetBuckets.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyBucket(h_buckets, ndata_tail, _old_bucket) { while(true) { @@ -79,7 +79,7 @@ function addBucket(h, key, _cell) { h.size = h.size + 1 | 0; cell.next = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; return /* () */0; } @@ -99,7 +99,7 @@ function add(h, key) { } else { h_buckets[i] = { key: key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; h.size = h.size + 1 | 0; } @@ -118,7 +118,7 @@ function add(h, key) { for(var i$2 = 0 ,i_finish$1 = nsize - 1 | 0; i$2 <= i_finish$1; ++i$2){ var match = ndata_tail[i$2]; if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; + match.next = Belt_internalBucketsType.emptyOpt; } } @@ -158,8 +158,8 @@ function has(h, key) { } } -function make(size) { - return Bs_internalBucketsType.make(/* () */0, /* () */0, size); +function make(hintSize) { + return Belt_internalBucketsType.make(/* () */0, /* () */0, hintSize); } function size(prim) { @@ -168,7 +168,7 @@ function size(prim) { function ofArray(arr) { var len = arr.length; - var v = Bs_internalBucketsType.make(/* () */0, /* () */0, len); + var v = Belt_internalBucketsType.make(/* () */0, /* () */0, len); for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ add(v, arr[i]); } @@ -183,25 +183,25 @@ function mergeMany(h, arr) { return /* () */0; } -var clear = Bs_internalBucketsType.clear; +var clear = Belt_internalBucketsType.clear; -var isEmpty = Bs_internalBucketsType.isEmpty; +var isEmpty = Belt_internalBucketsType.isEmpty; -var copy = Bs_internalSetBuckets.copy; +var copy = Belt_internalSetBuckets.copy; -var forEachU = Bs_internalSetBuckets.forEachU; +var forEachU = Belt_internalSetBuckets.forEachU; -var forEach = Bs_internalSetBuckets.forEach; +var forEach = Belt_internalSetBuckets.forEach; -var reduceU = Bs_internalSetBuckets.reduceU; +var reduceU = Belt_internalSetBuckets.reduceU; -var reduce = Bs_internalSetBuckets.reduce; +var reduce = Belt_internalSetBuckets.reduce; -var logStats = Bs_internalSetBuckets.logStats; +var logStats = Belt_internalSetBuckets.logStats; -var toArray = Bs_internalSetBuckets.toArray; +var toArray = Belt_internalSetBuckets.toArray; -var getBucketHistogram = Bs_internalSetBuckets.getBucketHistogram; +var getBucketHistogram = Belt_internalSetBuckets.getBucketHistogram; exports.make = make; exports.clear = clear; diff --git a/lib/js/bs_Id.js b/lib/js/belt_Id.js similarity index 100% rename from lib/js/bs_Id.js rename to lib/js/belt_Id.js diff --git a/lib/js/bs_List.js b/lib/js/belt_List.js similarity index 96% rename from lib/js/bs_List.js rename to lib/js/belt_List.js index c3b9bb1857..00ad4b76fe 100644 --- a/lib/js/bs_List.js +++ b/lib/js/belt_List.js @@ -1,6 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); +var Belt_Array = require("./belt_Array.js"); function head(x) { if (x) { @@ -855,14 +856,23 @@ function reduce(l, accu, f) { return reduceU(l, accu, Curry.__2(f)); } -function reduceReverseU(l, accu, f) { +function reduceReverseUnsafeU(l, accu, f) { if (l) { - return f(l[0], reduceReverseU(l[1], accu, f)); + return f(reduceReverseUnsafeU(l[1], accu, f), l[0]); } else { return accu; } } +function reduceReverseU(l, acc, f) { + var len = length(l); + if (len < 1000) { + return reduceReverseUnsafeU(l, acc, f); + } else { + return Belt_Array.reduceReverseU(toArray(l), acc, f); + } +} + function reduceReverse(l, accu, f) { return reduceReverseU(l, accu, Curry.__2(f)); } @@ -948,14 +958,23 @@ function reduce2(l1, l2, acc, f) { return reduce2U(l1, l2, acc, Curry.__3(f)); } -function reduceReverse2U(l1, l2, accu, f) { +function reduceReverse2UnsafeU(l1, l2, accu, f) { if (l1 && l2) { - return f(l1[0], l2[0], reduceReverse2U(l1[1], l2[1], accu, f)); + return f(reduceReverse2UnsafeU(l1[1], l2[1], accu, f), l1[0], l2[0]); } else { return accu; } } +function reduceReverse2U(l1, l2, acc, f) { + var len = length(l1); + if (len < 1000) { + return reduceReverse2UnsafeU(l1, l2, acc, f); + } else { + return Belt_Array.reduceReverse2U(toArray(l1), toArray(l2), acc, f); + } +} + function reduceReverse2(l1, l2, acc, f) { return reduceReverse2U(l1, l2, acc, Curry.__3(f)); } @@ -1029,6 +1048,27 @@ function every2(l1, l2, p) { return every2U(l1, l2, Curry.__2(p)); } +function cmpByLength(_l1, _l2) { + while(true) { + var l2 = _l2; + var l1 = _l1; + if (l1) { + if (l2) { + _l2 = l2[1]; + _l1 = l1[1]; + continue ; + + } else { + return 1; + } + } else if (l2) { + return -1; + } else { + return 0; + } + }; +} + function cmpU(_l1, _l2, p) { while(true) { var l2 = _l2; @@ -1454,6 +1494,7 @@ exports.every2U = every2U; exports.every2 = every2; exports.some2U = some2U; exports.some2 = some2; +exports.cmpByLength = cmpByLength; exports.cmpU = cmpU; exports.cmp = cmp; exports.eqU = eqU; diff --git a/lib/js/bs_Map.js b/lib/js/belt_Map.js similarity index 70% rename from lib/js/bs_Map.js rename to lib/js/belt_Map.js index bfc74064d9..d070743831 100644 --- a/lib/js/bs_Map.js +++ b/lib/js/belt_Map.js @@ -1,20 +1,20 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_MapDict = require("./bs_MapDict.js"); +var Belt_MapDict = require("./belt_MapDict.js"); function ofArray(data, id) { var cmp = id[/* cmp */0]; return { cmp: cmp, - data: Bs_MapDict.ofArray(data, cmp) + data: Belt_MapDict.ofArray(data, cmp) }; } function remove(m, x) { var cmp = m.cmp; var odata = m.data; - var newData = Bs_MapDict.remove(odata, x, cmp); + var newData = Belt_MapDict.remove(odata, x, cmp); if (newData === odata) { return m; } else { @@ -28,7 +28,7 @@ function remove(m, x) { function removeMany(m, x) { var cmp = m.cmp; var odata = m.data; - var newData = Bs_MapDict.removeMany(odata, x, cmp); + var newData = Belt_MapDict.removeMany(odata, x, cmp); return { cmp: cmp, data: newData @@ -39,7 +39,7 @@ function set(m, key, d) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_MapDict.set(m.data, key, d, cmp) + data: Belt_MapDict.set(m.data, key, d, cmp) }; } @@ -47,7 +47,7 @@ function mergeMany(m, e) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_MapDict.mergeMany(m.data, e, cmp) + data: Belt_MapDict.mergeMany(m.data, e, cmp) }; } @@ -55,7 +55,7 @@ function updateU(m, key, f) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_MapDict.updateU(m.data, key, f, cmp) + data: Belt_MapDict.updateU(m.data, key, f, cmp) }; } @@ -65,7 +65,7 @@ function update(m, key, f) { function split(m, x) { var cmp = m.cmp; - var match = Bs_MapDict.split(m.data, x, cmp); + var match = Belt_MapDict.split(m.data, x, cmp); var match$1 = match[0]; return /* tuple */[ /* tuple */[ @@ -86,7 +86,7 @@ function mergeU(s1, s2, f) { var cmp = s1.cmp; return { cmp: cmp, - data: Bs_MapDict.mergeU(s1.data, s2.data, f, cmp) + data: Belt_MapDict.mergeU(s1.data, s2.data, f, cmp) }; } @@ -97,24 +97,24 @@ function merge(s1, s2, f) { function make(id) { return { cmp: id[/* cmp */0], - data: Bs_MapDict.empty + data: Belt_MapDict.empty }; } function isEmpty(map) { - return Bs_MapDict.isEmpty(map.data); + return Belt_MapDict.isEmpty(map.data); } function forEachU(m, f) { - return Bs_MapDict.forEachU(m.data, f); + return Belt_MapDict.forEachU(m.data, f); } function forEach(m, f) { - return Bs_MapDict.forEachU(m.data, Curry.__2(f)); + return Belt_MapDict.forEachU(m.data, Curry.__2(f)); } function reduceU(m, acc, f) { - return Bs_MapDict.reduceU(m.data, acc, f); + return Belt_MapDict.reduceU(m.data, acc, f); } function reduce(m, acc, f) { @@ -122,25 +122,25 @@ function reduce(m, acc, f) { } function everyU(m, f) { - return Bs_MapDict.everyU(m.data, f); + return Belt_MapDict.everyU(m.data, f); } function every(m, f) { - return Bs_MapDict.everyU(m.data, Curry.__2(f)); + return Belt_MapDict.everyU(m.data, Curry.__2(f)); } function someU(m, f) { - return Bs_MapDict.someU(m.data, f); + return Belt_MapDict.someU(m.data, f); } function some(m, f) { - return Bs_MapDict.someU(m.data, Curry.__2(f)); + return Belt_MapDict.someU(m.data, Curry.__2(f)); } function keepU(m, f) { return { cmp: m.cmp, - data: Bs_MapDict.keepU(m.data, f) + data: Belt_MapDict.keepU(m.data, f) }; } @@ -150,7 +150,7 @@ function keep(m, f) { function partitionU(m, p) { var cmp = m.cmp; - var match = Bs_MapDict.partitionU(m.data, p); + var match = Belt_MapDict.partitionU(m.data, p); return /* tuple */[ { cmp: cmp, @@ -170,7 +170,7 @@ function partition(m, p) { function mapU(m, f) { return { cmp: m.cmp, - data: Bs_MapDict.mapU(m.data, f) + data: Belt_MapDict.mapU(m.data, f) }; } @@ -181,7 +181,7 @@ function map(m, f) { function mapWithKeyU(m, f) { return { cmp: m.cmp, - data: Bs_MapDict.mapWithKeyU(m.data, f) + data: Belt_MapDict.mapWithKeyU(m.data, f) }; } @@ -190,83 +190,83 @@ function mapWithKey(m, f) { } function size(map) { - return Bs_MapDict.size(map.data); + return Belt_MapDict.size(map.data); } function toList(map) { - return Bs_MapDict.toList(map.data); + return Belt_MapDict.toList(map.data); } function toArray(m) { - return Bs_MapDict.toArray(m.data); + return Belt_MapDict.toArray(m.data); } function keysToArray(m) { - return Bs_MapDict.keysToArray(m.data); + return Belt_MapDict.keysToArray(m.data); } function valuesToArray(m) { - return Bs_MapDict.valuesToArray(m.data); + return Belt_MapDict.valuesToArray(m.data); } function minKey(m) { - return Bs_MapDict.minKey(m.data); + return Belt_MapDict.minKey(m.data); } function minKeyUndefined(m) { - return Bs_MapDict.minKeyUndefined(m.data); + return Belt_MapDict.minKeyUndefined(m.data); } function maxKey(m) { - return Bs_MapDict.maxKey(m.data); + return Belt_MapDict.maxKey(m.data); } function maxKeyUndefined(m) { - return Bs_MapDict.maxKeyUndefined(m.data); + return Belt_MapDict.maxKeyUndefined(m.data); } function minimum(m) { - return Bs_MapDict.minimum(m.data); + return Belt_MapDict.minimum(m.data); } function minUndefined(m) { - return Bs_MapDict.minUndefined(m.data); + return Belt_MapDict.minUndefined(m.data); } function maximum(m) { - return Bs_MapDict.maximum(m.data); + return Belt_MapDict.maximum(m.data); } function maxUndefined(m) { - return Bs_MapDict.maxUndefined(m.data); + return Belt_MapDict.maxUndefined(m.data); } function get(map, x) { - return Bs_MapDict.get(map.data, x, map.cmp); + return Belt_MapDict.get(map.data, x, map.cmp); } function getUndefined(map, x) { - return Bs_MapDict.getUndefined(map.data, x, map.cmp); + return Belt_MapDict.getUndefined(map.data, x, map.cmp); } function getWithDefault(map, x, def) { - return Bs_MapDict.getWithDefault(map.data, x, def, map.cmp); + return Belt_MapDict.getWithDefault(map.data, x, def, map.cmp); } function getExn(map, x) { - return Bs_MapDict.getExn(map.data, x, map.cmp); + return Belt_MapDict.getExn(map.data, x, map.cmp); } function has(map, x) { - return Bs_MapDict.has(map.data, x, map.cmp); + return Belt_MapDict.has(map.data, x, map.cmp); } function checkInvariantInternal(m) { - return Bs_MapDict.checkInvariantInternal(m.data); + return Belt_MapDict.checkInvariantInternal(m.data); } function eqU(m1, m2, veq) { - return Bs_MapDict.eqU(m1.data, m2.data, m1.cmp, veq); + return Belt_MapDict.eqU(m1.data, m2.data, m1.cmp, veq); } function eq(m1, m2, veq) { @@ -274,7 +274,7 @@ function eq(m1, m2, veq) { } function cmpU(m1, m2, vcmp) { - return Bs_MapDict.cmpU(m1.data, m2.data, m1.cmp, vcmp); + return Belt_MapDict.cmpU(m1.data, m2.data, m1.cmp, vcmp); } function cmp(m1, m2, vcmp) { @@ -345,9 +345,9 @@ exports.removeMany = removeMany; exports.set = set; exports.updateU = updateU; exports.update = update; +exports.mergeMany = mergeMany; exports.mergeU = mergeU; exports.merge = merge; -exports.mergeMany = mergeMany; exports.keepU = keepU; exports.keep = keep; exports.partitionU = partitionU; diff --git a/lib/js/bs_MapDict.js b/lib/js/belt_MapDict.js similarity index 64% rename from lib/js/bs_MapDict.js rename to lib/js/belt_MapDict.js index 6daa127ab0..efc2ddbc7a 100644 --- a/lib/js/bs_MapDict.js +++ b/lib/js/belt_MapDict.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function set(t, newK, newD, cmp) { if (t !== null) { @@ -12,15 +12,15 @@ function set(t, newK, newD, cmp) { var r = t.right; var v = t.value; if (c < 0) { - return Bs_internalAVLtree.bal(set(l, newK, newD, cmp), k, v, r); + return Belt_internalAVLtree.bal(set(l, newK, newD, cmp), k, v, r); } else { - return Bs_internalAVLtree.bal(l, k, v, set(r, newK, newD, cmp)); + return Belt_internalAVLtree.bal(l, k, v, set(r, newK, newD, cmp)); } } else { - return Bs_internalAVLtree.updateValue(t, newD); + return Belt_internalAVLtree.updateValue(t, newD); } } else { - return Bs_internalAVLtree.singleton(newK, newD); + return Belt_internalAVLtree.singleton(newK, newD); } } @@ -37,20 +37,20 @@ function updateU(t, newK, f, cmp) { if (l === ll) { return t; } else { - return Bs_internalAVLtree.bal(ll, k, v, r); + return Belt_internalAVLtree.bal(ll, k, v, r); } } else { var rr = updateU(r, newK, f, cmp); if (r === rr) { return t; } else { - return Bs_internalAVLtree.bal(l, k, v, rr); + return Belt_internalAVLtree.bal(l, k, v, rr); } } } else { var match = f(/* Some */[t.value]); if (match) { - return Bs_internalAVLtree.updateValue(t, match[0]); + return Belt_internalAVLtree.updateValue(t, match[0]); } else { var l$1 = t.left; var r$1 = t.right; @@ -58,8 +58,8 @@ function updateU(t, newK, f, cmp) { if (r$1 !== null) { var kr = [r$1.key]; var vr = [r$1.value]; - var r$2 = Bs_internalAVLtree.removeMinAuxWithRef(r$1, kr, vr); - return Bs_internalAVLtree.bal(l$1, kr[0], vr[0], r$2); + var r$2 = Belt_internalAVLtree.removeMinAuxWithRef(r$1, kr, vr); + return Belt_internalAVLtree.bal(l$1, kr[0], vr[0], r$2); } else { return l$1; } @@ -71,7 +71,7 @@ function updateU(t, newK, f, cmp) { } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(newK, match$1[0]); + return Belt_internalAVLtree.singleton(newK, match$1[0]); } else { return t; } @@ -94,7 +94,7 @@ function removeAux0(n, x, cmp) { if (ll === l) { return n; } else { - return Bs_internalAVLtree.bal(ll, v, n.value, r); + return Belt_internalAVLtree.bal(ll, v, n.value, r); } } else { return n; @@ -104,7 +104,7 @@ function removeAux0(n, x, cmp) { if (rr === r) { return n; } else { - return Bs_internalAVLtree.bal(l, v, n.value, rr); + return Belt_internalAVLtree.bal(l, v, n.value, rr); } } else { return n; @@ -113,8 +113,8 @@ function removeAux0(n, x, cmp) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -127,7 +127,7 @@ function remove(n, x, cmp) { if (n !== null) { return removeAux0(n, x, cmp); } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -153,24 +153,24 @@ function splitAuxPivot(n, x, pres, cmp) { var match = splitAuxPivot(l, x, pres, cmp); return /* tuple */[ match[0], - Bs_internalAVLtree.join(match[1], v, d, r) + Belt_internalAVLtree.join(match[1], v, d, r) ]; } else { return /* tuple */[ - Bs_internalAVLtree.empty, + Belt_internalAVLtree.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxPivot(r, x, pres, cmp); return /* tuple */[ - Bs_internalAVLtree.join(l, v, d, match$1[0]), + Belt_internalAVLtree.join(l, v, d, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty ]; } } else { @@ -193,8 +193,8 @@ function split(n, x, cmp) { } else { return /* tuple */[ /* tuple */[ - Bs_internalAVLtree.empty, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty, + Belt_internalAVLtree.empty ], /* None */0 ]; @@ -215,7 +215,7 @@ function mergeU(s1, s2, f, cmp) { var newLeft = mergeU(l1, match[0], f, cmp); var newD = f(v1, /* Some */[d1], d2$1); var newRight = mergeU(r1, match[1], f, cmp); - return Bs_internalAVLtree.concatOrJoin(newLeft, v1, newD, newRight); + return Belt_internalAVLtree.concatOrJoin(newLeft, v1, newD, newRight); } else { var l2 = s2.left; var v2 = s2.key; @@ -227,19 +227,19 @@ function mergeU(s1, s2, f, cmp) { var newLeft$1 = mergeU(match$1[0], l2, f, cmp); var newD$1 = f(v2, d1$2, /* Some */[d2$2]); var newRight$1 = mergeU(match$1[1], r2, f, cmp); - return Bs_internalAVLtree.concatOrJoin(newLeft$1, v2, newD$1, newRight$1); + return Belt_internalAVLtree.concatOrJoin(newLeft$1, v2, newD$1, newRight$1); } } else { - return Bs_internalAVLtree.keepMapU(s1, (function (k, v) { + return Belt_internalAVLtree.keepMapU(s1, (function (k, v) { return f(k, /* Some */[v], /* None */0); })); } } else if (s2 !== null) { - return Bs_internalAVLtree.keepMapU(s2, (function (k, v) { + return Belt_internalAVLtree.keepMapU(s2, (function (k, v) { return f(k, /* None */0, /* Some */[v]); })); } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -274,93 +274,93 @@ function removeMany(t, keys, cmp) { } }; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } -var empty = Bs_internalAVLtree.empty; +var empty = Belt_internalAVLtree.empty; -var isEmpty = Bs_internalAVLtree.isEmpty; +var isEmpty = Belt_internalAVLtree.isEmpty; -var has = Bs_internalAVLtree.has; +var has = Belt_internalAVLtree.has; -var cmpU = Bs_internalAVLtree.cmpU; +var cmpU = Belt_internalAVLtree.cmpU; -var cmp = Bs_internalAVLtree.cmp; +var cmp = Belt_internalAVLtree.cmp; -var eqU = Bs_internalAVLtree.eqU; +var eqU = Belt_internalAVLtree.eqU; -var eq = Bs_internalAVLtree.eq; +var eq = Belt_internalAVLtree.eq; -var forEachU = Bs_internalAVLtree.forEachU; +var forEachU = Belt_internalAVLtree.forEachU; -var forEach = Bs_internalAVLtree.forEach; +var forEach = Belt_internalAVLtree.forEach; -var reduceU = Bs_internalAVLtree.reduceU; +var reduceU = Belt_internalAVLtree.reduceU; -var reduce = Bs_internalAVLtree.reduce; +var reduce = Belt_internalAVLtree.reduce; -var everyU = Bs_internalAVLtree.everyU; +var everyU = Belt_internalAVLtree.everyU; -var every = Bs_internalAVLtree.every; +var every = Belt_internalAVLtree.every; -var someU = Bs_internalAVLtree.someU; +var someU = Belt_internalAVLtree.someU; -var some = Bs_internalAVLtree.some; +var some = Belt_internalAVLtree.some; -var size = Bs_internalAVLtree.size; +var size = Belt_internalAVLtree.size; -var toList = Bs_internalAVLtree.toList; +var toList = Belt_internalAVLtree.toList; -var toArray = Bs_internalAVLtree.toArray; +var toArray = Belt_internalAVLtree.toArray; -var ofArray = Bs_internalAVLtree.ofArray; +var ofArray = Belt_internalAVLtree.ofArray; -var keysToArray = Bs_internalAVLtree.keysToArray; +var keysToArray = Belt_internalAVLtree.keysToArray; -var valuesToArray = Bs_internalAVLtree.valuesToArray; +var valuesToArray = Belt_internalAVLtree.valuesToArray; -var minKey = Bs_internalAVLtree.minKey; +var minKey = Belt_internalAVLtree.minKey; -var minKeyUndefined = Bs_internalAVLtree.minKeyUndefined; +var minKeyUndefined = Belt_internalAVLtree.minKeyUndefined; -var maxKey = Bs_internalAVLtree.maxKey; +var maxKey = Belt_internalAVLtree.maxKey; -var maxKeyUndefined = Bs_internalAVLtree.maxKeyUndefined; +var maxKeyUndefined = Belt_internalAVLtree.maxKeyUndefined; -var minimum = Bs_internalAVLtree.minimum; +var minimum = Belt_internalAVLtree.minimum; -var minUndefined = Bs_internalAVLtree.minUndefined; +var minUndefined = Belt_internalAVLtree.minUndefined; -var maximum = Bs_internalAVLtree.maximum; +var maximum = Belt_internalAVLtree.maximum; -var maxUndefined = Bs_internalAVLtree.maxUndefined; +var maxUndefined = Belt_internalAVLtree.maxUndefined; -var get = Bs_internalAVLtree.get; +var get = Belt_internalAVLtree.get; -var getUndefined = Bs_internalAVLtree.getUndefined; +var getUndefined = Belt_internalAVLtree.getUndefined; -var getWithDefault = Bs_internalAVLtree.getWithDefault; +var getWithDefault = Belt_internalAVLtree.getWithDefault; -var getExn = Bs_internalAVLtree.getExn; +var getExn = Belt_internalAVLtree.getExn; -var checkInvariantInternal = Bs_internalAVLtree.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; -var keepU = Bs_internalAVLtree.keepSharedU; +var keepU = Belt_internalAVLtree.keepSharedU; -var keep = Bs_internalAVLtree.keepShared; +var keep = Belt_internalAVLtree.keepShared; -var partitionU = Bs_internalAVLtree.partitionSharedU; +var partitionU = Belt_internalAVLtree.partitionSharedU; -var partition = Bs_internalAVLtree.partitionShared; +var partition = Belt_internalAVLtree.partitionShared; -var mapU = Bs_internalAVLtree.mapU; +var mapU = Belt_internalAVLtree.mapU; -var map = Bs_internalAVLtree.map; +var map = Belt_internalAVLtree.map; -var mapWithKeyU = Bs_internalAVLtree.mapWithKeyU; +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; -var mapWithKey = Bs_internalAVLtree.mapWithKey; +var mapWithKey = Belt_internalAVLtree.mapWithKey; exports.empty = empty; exports.isEmpty = isEmpty; diff --git a/lib/js/bs_MapInt.js b/lib/js/belt_MapInt.js similarity index 56% rename from lib/js/bs_MapInt.js rename to lib/js/belt_MapInt.js index 181f2b8a90..662e79e2b9 100644 --- a/lib/js/bs_MapInt.js +++ b/lib/js/belt_MapInt.js @@ -1,24 +1,24 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalMapInt = require("./bs_internalMapInt.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalMapInt = require("./belt_internalMapInt.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function set(t, newK, newD) { if (t !== null) { var k = t.key; if (newK === k) { - return Bs_internalAVLtree.updateValue(t, newD); + return Belt_internalAVLtree.updateValue(t, newD); } else { var v = t.value; if (newK < k) { - return Bs_internalAVLtree.bal(set(t.left, newK, newD), k, v, t.right); + return Belt_internalAVLtree.bal(set(t.left, newK, newD), k, v, t.right); } else { - return Bs_internalAVLtree.bal(t.left, k, v, set(t.right, newK, newD)); + return Belt_internalAVLtree.bal(t.left, k, v, set(t.right, newK, newD)); } } } else { - return Bs_internalAVLtree.singleton(newK, newD); + return Belt_internalAVLtree.singleton(newK, newD); } } @@ -28,7 +28,7 @@ function updateU(t, x, f) { if (x === k) { var match = f(/* Some */[t.value]); if (match) { - return Bs_internalAVLtree.updateValue(t, match[0]); + return Belt_internalAVLtree.updateValue(t, match[0]); } else { var l = t.left; var r = t.right; @@ -36,8 +36,8 @@ function updateU(t, x, f) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -54,21 +54,21 @@ function updateU(t, x, f) { if (l$1 === ll) { return t; } else { - return Bs_internalAVLtree.bal(ll, k, v, r$2); + return Belt_internalAVLtree.bal(ll, k, v, r$2); } } else { var rr = updateU(r$2, x, f); if (r$2 === rr) { return t; } else { - return Bs_internalAVLtree.bal(l$1, k, v, rr); + return Belt_internalAVLtree.bal(l$1, k, v, rr); } } } } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); + return Belt_internalAVLtree.singleton(x, match$1[0]); } else { return t; } @@ -88,8 +88,8 @@ function removeAux(n, x) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -102,14 +102,14 @@ function removeAux(n, x) { if (ll === l) { return n; } else { - return Bs_internalAVLtree.bal(ll, v, n.value, r); + return Belt_internalAVLtree.bal(ll, v, n.value, r); } } else { return n; } } else if (r !== null) { var rr = removeAux(r, x); - return Bs_internalAVLtree.bal(l, v, n.value, rr); + return Belt_internalAVLtree.bal(l, v, n.value, rr); } else { return n; } @@ -119,7 +119,7 @@ function remove(n, x) { if (n !== null) { return removeAux(n, x); } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -149,7 +149,7 @@ function removeMany(t, keys) { } }; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -163,95 +163,95 @@ function mergeArray(h, arr) { return v; } -var empty = Bs_internalAVLtree.empty; +var empty = Belt_internalAVLtree.empty; -var isEmpty = Bs_internalAVLtree.isEmpty; +var isEmpty = Belt_internalAVLtree.isEmpty; -var has = Bs_internalMapInt.has; +var has = Belt_internalMapInt.has; -var cmpU = Bs_internalMapInt.cmpU; +var cmpU = Belt_internalMapInt.cmpU; -var cmp = Bs_internalMapInt.cmp; +var cmp = Belt_internalMapInt.cmp; -var eqU = Bs_internalMapInt.eqU; +var eqU = Belt_internalMapInt.eqU; -var eq = Bs_internalMapInt.eq; +var eq = Belt_internalMapInt.eq; -var forEachU = Bs_internalAVLtree.forEachU; +var forEachU = Belt_internalAVLtree.forEachU; -var forEach = Bs_internalAVLtree.forEach; +var forEach = Belt_internalAVLtree.forEach; -var reduceU = Bs_internalAVLtree.reduceU; +var reduceU = Belt_internalAVLtree.reduceU; -var reduce = Bs_internalAVLtree.reduce; +var reduce = Belt_internalAVLtree.reduce; -var everyU = Bs_internalAVLtree.everyU; +var everyU = Belt_internalAVLtree.everyU; -var every = Bs_internalAVLtree.every; +var every = Belt_internalAVLtree.every; -var someU = Bs_internalAVLtree.someU; +var someU = Belt_internalAVLtree.someU; -var some = Bs_internalAVLtree.some; +var some = Belt_internalAVLtree.some; -var size = Bs_internalAVLtree.size; +var size = Belt_internalAVLtree.size; -var toList = Bs_internalAVLtree.toList; +var toList = Belt_internalAVLtree.toList; -var toArray = Bs_internalAVLtree.toArray; +var toArray = Belt_internalAVLtree.toArray; -var ofArray = Bs_internalMapInt.ofArray; +var ofArray = Belt_internalMapInt.ofArray; -var keysToArray = Bs_internalAVLtree.keysToArray; +var keysToArray = Belt_internalAVLtree.keysToArray; -var valuesToArray = Bs_internalAVLtree.valuesToArray; +var valuesToArray = Belt_internalAVLtree.valuesToArray; -var minKey = Bs_internalAVLtree.minKey; +var minKey = Belt_internalAVLtree.minKey; -var minKeyUndefined = Bs_internalAVLtree.minKeyUndefined; +var minKeyUndefined = Belt_internalAVLtree.minKeyUndefined; -var maxKey = Bs_internalAVLtree.maxKey; +var maxKey = Belt_internalAVLtree.maxKey; -var maxKeyUndefined = Bs_internalAVLtree.maxKeyUndefined; +var maxKeyUndefined = Belt_internalAVLtree.maxKeyUndefined; -var minimum = Bs_internalAVLtree.minimum; +var minimum = Belt_internalAVLtree.minimum; -var minUndefined = Bs_internalAVLtree.minUndefined; +var minUndefined = Belt_internalAVLtree.minUndefined; -var maximum = Bs_internalAVLtree.maximum; +var maximum = Belt_internalAVLtree.maximum; -var maxUndefined = Bs_internalAVLtree.maxUndefined; +var maxUndefined = Belt_internalAVLtree.maxUndefined; -var get = Bs_internalMapInt.get; +var get = Belt_internalMapInt.get; -var getUndefined = Bs_internalMapInt.getUndefined; +var getUndefined = Belt_internalMapInt.getUndefined; -var getWithDefault = Bs_internalMapInt.getWithDefault; +var getWithDefault = Belt_internalMapInt.getWithDefault; -var getExn = Bs_internalMapInt.getExn; +var getExn = Belt_internalMapInt.getExn; -var mergeU = Bs_internalMapInt.mergeU; +var mergeU = Belt_internalMapInt.mergeU; -var merge = Bs_internalMapInt.merge; +var merge = Belt_internalMapInt.merge; -var keepU = Bs_internalAVLtree.keepSharedU; +var keepU = Belt_internalAVLtree.keepSharedU; -var keep = Bs_internalAVLtree.keepShared; +var keep = Belt_internalAVLtree.keepShared; -var partitionU = Bs_internalAVLtree.partitionSharedU; +var partitionU = Belt_internalAVLtree.partitionSharedU; -var partition = Bs_internalAVLtree.partitionShared; +var partition = Belt_internalAVLtree.partitionShared; -var split = Bs_internalMapInt.split; +var split = Belt_internalMapInt.split; -var mapU = Bs_internalAVLtree.mapU; +var mapU = Belt_internalAVLtree.mapU; -var map = Bs_internalAVLtree.map; +var map = Belt_internalAVLtree.map; -var mapWithKeyU = Bs_internalAVLtree.mapWithKeyU; +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; -var mapWithKey = Bs_internalAVLtree.mapWithKey; +var mapWithKey = Belt_internalAVLtree.mapWithKey; -var checkInvariantInternal = Bs_internalAVLtree.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; exports.empty = empty; exports.isEmpty = isEmpty; diff --git a/lib/js/bs_MapString.js b/lib/js/belt_MapString.js similarity index 55% rename from lib/js/bs_MapString.js rename to lib/js/belt_MapString.js index 0f06c62441..e9294180cb 100644 --- a/lib/js/bs_MapString.js +++ b/lib/js/belt_MapString.js @@ -1,24 +1,24 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); -var Bs_internalMapString = require("./bs_internalMapString.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); +var Belt_internalMapString = require("./belt_internalMapString.js"); function set(t, newK, newD) { if (t !== null) { var k = t.key; if (newK === k) { - return Bs_internalAVLtree.updateValue(t, newD); + return Belt_internalAVLtree.updateValue(t, newD); } else { var v = t.value; if (newK < k) { - return Bs_internalAVLtree.bal(set(t.left, newK, newD), k, v, t.right); + return Belt_internalAVLtree.bal(set(t.left, newK, newD), k, v, t.right); } else { - return Bs_internalAVLtree.bal(t.left, k, v, set(t.right, newK, newD)); + return Belt_internalAVLtree.bal(t.left, k, v, set(t.right, newK, newD)); } } } else { - return Bs_internalAVLtree.singleton(newK, newD); + return Belt_internalAVLtree.singleton(newK, newD); } } @@ -28,7 +28,7 @@ function updateU(t, x, f) { if (x === k) { var match = f(/* Some */[t.value]); if (match) { - return Bs_internalAVLtree.updateValue(t, match[0]); + return Belt_internalAVLtree.updateValue(t, match[0]); } else { var l = t.left; var r = t.right; @@ -36,8 +36,8 @@ function updateU(t, x, f) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -54,21 +54,21 @@ function updateU(t, x, f) { if (l$1 === ll) { return t; } else { - return Bs_internalAVLtree.bal(ll, k, v, r$2); + return Belt_internalAVLtree.bal(ll, k, v, r$2); } } else { var rr = updateU(r$2, x, f); if (r$2 === rr) { return t; } else { - return Bs_internalAVLtree.bal(l$1, k, v, rr); + return Belt_internalAVLtree.bal(l$1, k, v, rr); } } } } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); + return Belt_internalAVLtree.singleton(x, match$1[0]); } else { return t; } @@ -88,8 +88,8 @@ function removeAux(n, x) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -102,14 +102,14 @@ function removeAux(n, x) { if (ll === l) { return n; } else { - return Bs_internalAVLtree.bal(ll, v, n.value, r); + return Belt_internalAVLtree.bal(ll, v, n.value, r); } } else { return n; } } else if (r !== null) { var rr = removeAux(r, x); - return Bs_internalAVLtree.bal(l, v, n.value, rr); + return Belt_internalAVLtree.bal(l, v, n.value, rr); } else { return n; } @@ -119,7 +119,7 @@ function remove(n, x) { if (n !== null) { return removeAux(n, x); } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -149,7 +149,7 @@ function removeMany(t, keys) { } }; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } @@ -163,95 +163,95 @@ function mergeArray(h, arr) { return v; } -var empty = Bs_internalAVLtree.empty; +var empty = Belt_internalAVLtree.empty; -var isEmpty = Bs_internalAVLtree.isEmpty; +var isEmpty = Belt_internalAVLtree.isEmpty; -var has = Bs_internalMapString.has; +var has = Belt_internalMapString.has; -var cmpU = Bs_internalMapString.cmpU; +var cmpU = Belt_internalMapString.cmpU; -var cmp = Bs_internalMapString.cmp; +var cmp = Belt_internalMapString.cmp; -var eqU = Bs_internalMapString.eqU; +var eqU = Belt_internalMapString.eqU; -var eq = Bs_internalMapString.eq; +var eq = Belt_internalMapString.eq; -var forEachU = Bs_internalAVLtree.forEachU; +var forEachU = Belt_internalAVLtree.forEachU; -var forEach = Bs_internalAVLtree.forEach; +var forEach = Belt_internalAVLtree.forEach; -var reduceU = Bs_internalAVLtree.reduceU; +var reduceU = Belt_internalAVLtree.reduceU; -var reduce = Bs_internalAVLtree.reduce; +var reduce = Belt_internalAVLtree.reduce; -var everyU = Bs_internalAVLtree.everyU; +var everyU = Belt_internalAVLtree.everyU; -var every = Bs_internalAVLtree.every; +var every = Belt_internalAVLtree.every; -var someU = Bs_internalAVLtree.someU; +var someU = Belt_internalAVLtree.someU; -var some = Bs_internalAVLtree.some; +var some = Belt_internalAVLtree.some; -var size = Bs_internalAVLtree.size; +var size = Belt_internalAVLtree.size; -var toList = Bs_internalAVLtree.toList; +var toList = Belt_internalAVLtree.toList; -var toArray = Bs_internalAVLtree.toArray; +var toArray = Belt_internalAVLtree.toArray; -var ofArray = Bs_internalMapString.ofArray; +var ofArray = Belt_internalMapString.ofArray; -var keysToArray = Bs_internalAVLtree.keysToArray; +var keysToArray = Belt_internalAVLtree.keysToArray; -var valuesToArray = Bs_internalAVLtree.valuesToArray; +var valuesToArray = Belt_internalAVLtree.valuesToArray; -var minKey = Bs_internalAVLtree.minKey; +var minKey = Belt_internalAVLtree.minKey; -var minKeyUndefined = Bs_internalAVLtree.minKeyUndefined; +var minKeyUndefined = Belt_internalAVLtree.minKeyUndefined; -var maxKey = Bs_internalAVLtree.maxKey; +var maxKey = Belt_internalAVLtree.maxKey; -var maxKeyUndefined = Bs_internalAVLtree.maxKeyUndefined; +var maxKeyUndefined = Belt_internalAVLtree.maxKeyUndefined; -var minimum = Bs_internalAVLtree.minimum; +var minimum = Belt_internalAVLtree.minimum; -var minUndefined = Bs_internalAVLtree.minUndefined; +var minUndefined = Belt_internalAVLtree.minUndefined; -var maximum = Bs_internalAVLtree.maximum; +var maximum = Belt_internalAVLtree.maximum; -var maxUndefined = Bs_internalAVLtree.maxUndefined; +var maxUndefined = Belt_internalAVLtree.maxUndefined; -var get = Bs_internalMapString.get; +var get = Belt_internalMapString.get; -var getUndefined = Bs_internalMapString.getUndefined; +var getUndefined = Belt_internalMapString.getUndefined; -var getWithDefault = Bs_internalMapString.getWithDefault; +var getWithDefault = Belt_internalMapString.getWithDefault; -var getExn = Bs_internalMapString.getExn; +var getExn = Belt_internalMapString.getExn; -var mergeU = Bs_internalMapString.mergeU; +var mergeU = Belt_internalMapString.mergeU; -var merge = Bs_internalMapString.merge; +var merge = Belt_internalMapString.merge; -var keepU = Bs_internalAVLtree.keepSharedU; +var keepU = Belt_internalAVLtree.keepSharedU; -var keep = Bs_internalAVLtree.keepShared; +var keep = Belt_internalAVLtree.keepShared; -var partitionU = Bs_internalAVLtree.partitionSharedU; +var partitionU = Belt_internalAVLtree.partitionSharedU; -var partition = Bs_internalAVLtree.partitionShared; +var partition = Belt_internalAVLtree.partitionShared; -var split = Bs_internalMapString.split; +var split = Belt_internalMapString.split; -var mapU = Bs_internalAVLtree.mapU; +var mapU = Belt_internalAVLtree.mapU; -var map = Bs_internalAVLtree.map; +var map = Belt_internalAVLtree.map; -var mapWithKeyU = Bs_internalAVLtree.mapWithKeyU; +var mapWithKeyU = Belt_internalAVLtree.mapWithKeyU; -var mapWithKey = Bs_internalAVLtree.mapWithKey; +var mapWithKey = Belt_internalAVLtree.mapWithKey; -var checkInvariantInternal = Bs_internalAVLtree.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLtree.checkInvariantInternal; exports.empty = empty; exports.isEmpty = isEmpty; diff --git a/lib/js/bs_MutableMap.js b/lib/js/belt_MutableMap.js similarity index 70% rename from lib/js/bs_MutableMap.js rename to lib/js/belt_MutableMap.js index 28bcacbfa3..66f9182c23 100644 --- a/lib/js/bs_MutableMap.js +++ b/lib/js/belt_MutableMap.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function removeMutateAux(nt, x, cmp) { var k = nt.key; @@ -11,7 +11,7 @@ function removeMutateAux(nt, x, cmp) { var match = nt.left; if (match !== null) { nt.left = removeMutateAux(match, x, cmp); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -19,7 +19,7 @@ function removeMutateAux(nt, x, cmp) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeMutateAux(match$1, x, cmp); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -29,8 +29,8 @@ function removeMutateAux(nt, x, cmp) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); + nt.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLtree.balMutate(nt); } else { return l; } @@ -70,7 +70,7 @@ function removeArrayMutateAux(_t, xs, _i, len, cmp) { continue ; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } else { return t; @@ -107,7 +107,7 @@ function updateDone(t, x, f, cmp) { } else { t.right = updateDone(r, x, f, cmp); } - return Bs_internalAVLtree.balMutate(t); + return Belt_internalAVLtree.balMutate(t); } else { var match = f(/* Some */[t.value]); if (match) { @@ -118,8 +118,8 @@ function updateDone(t, x, f, cmp) { var r$1 = t.right; if (l$1 !== null) { if (r$1 !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r$1); - return Bs_internalAVLtree.balMutate(t); + t.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(t, r$1); + return Belt_internalAVLtree.balMutate(t); } else { return l$1; } @@ -133,7 +133,7 @@ function updateDone(t, x, f, cmp) { } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); + return Belt_internalAVLtree.singleton(x, match$1[0]); } else { return t; } @@ -155,64 +155,64 @@ function update(t, x, f) { return updateU(t, x, Curry.__1(f)); } -function make(dict) { +function make(id) { return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLtree.empty + cmp: id[/* cmp */0], + data: Belt_internalAVLtree.empty }; } function clear(m) { - m.data = Bs_internalAVLtree.empty; + m.data = Belt_internalAVLtree.empty; return /* () */0; } function isEmpty(d) { - return Bs_internalAVLtree.isEmpty(d.data); + return Belt_internalAVLtree.isEmpty(d.data); } function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); + return Belt_internalAVLtree.minKey(m.data); } function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); + return Belt_internalAVLtree.minKeyUndefined(m.data); } function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); + return Belt_internalAVLtree.maxKey(m.data); } function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); + return Belt_internalAVLtree.maxKeyUndefined(m.data); } function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); + return Belt_internalAVLtree.minimum(m.data); } function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); + return Belt_internalAVLtree.minUndefined(m.data); } function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); + return Belt_internalAVLtree.maximum(m.data); } function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); + return Belt_internalAVLtree.maxUndefined(m.data); } function forEachU(d, f) { - return Bs_internalAVLtree.forEachU(d.data, f); + return Belt_internalAVLtree.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLtree.forEachU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); } function reduceU(d, acc, cb) { - return Bs_internalAVLtree.reduceU(d.data, acc, cb); + return Belt_internalAVLtree.reduceU(d.data, acc, cb); } function reduce(d, acc, cb) { @@ -220,47 +220,47 @@ function reduce(d, acc, cb) { } function everyU(d, p) { - return Bs_internalAVLtree.everyU(d.data, p); + return Belt_internalAVLtree.everyU(d.data, p); } function every(d, p) { - return Bs_internalAVLtree.everyU(d.data, Curry.__2(p)); + return Belt_internalAVLtree.everyU(d.data, Curry.__2(p)); } function someU(d, p) { - return Bs_internalAVLtree.someU(d.data, p); + return Belt_internalAVLtree.someU(d.data, p); } function some(d, p) { - return Bs_internalAVLtree.someU(d.data, Curry.__2(p)); + return Belt_internalAVLtree.someU(d.data, Curry.__2(p)); } function size(d) { - return Bs_internalAVLtree.size(d.data); + return Belt_internalAVLtree.size(d.data); } function toList(d) { - return Bs_internalAVLtree.toList(d.data); + return Belt_internalAVLtree.toList(d.data); } function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); + return Belt_internalAVLtree.toArray(d.data); } function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); + return Belt_internalAVLtree.keysToArray(d.data); } function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); + return Belt_internalAVLtree.valuesToArray(d.data); } function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); + return Belt_internalAVLtree.checkInvariantInternal(d.data); } function cmpU(m1, m2, cmp) { - return Bs_internalAVLtree.cmpU(m1.data, m2.data, m1.cmp, cmp); + return Belt_internalAVLtree.cmpU(m1.data, m2.data, m1.cmp, cmp); } function cmp(m1, m2, cmp$1) { @@ -268,7 +268,7 @@ function cmp(m1, m2, cmp$1) { } function eqU(m1, m2, cmp) { - return Bs_internalAVLtree.eqU(m1.data, m2.data, m1.cmp, cmp); + return Belt_internalAVLtree.eqU(m1.data, m2.data, m1.cmp, cmp); } function eq(m1, m2, cmp) { @@ -278,7 +278,7 @@ function eq(m1, m2, cmp) { function mapU(m, f) { return { cmp: m.cmp, - data: Bs_internalAVLtree.mapU(m.data, f) + data: Belt_internalAVLtree.mapU(m.data, f) }; } @@ -289,7 +289,7 @@ function map(m, f) { function mapWithKeyU(m, f) { return { cmp: m.cmp, - data: Bs_internalAVLtree.mapWithKeyU(m.data, f) + data: Belt_internalAVLtree.mapWithKeyU(m.data, f) }; } @@ -298,36 +298,36 @@ function mapWithKey(m, f) { } function get(m, x) { - return Bs_internalAVLtree.get(m.data, x, m.cmp); + return Belt_internalAVLtree.get(m.data, x, m.cmp); } function getUndefined(m, x) { - return Bs_internalAVLtree.getUndefined(m.data, x, m.cmp); + return Belt_internalAVLtree.getUndefined(m.data, x, m.cmp); } function getWithDefault(m, x, def) { - return Bs_internalAVLtree.getWithDefault(m.data, x, def, m.cmp); + return Belt_internalAVLtree.getWithDefault(m.data, x, def, m.cmp); } function getExn(m, x) { - return Bs_internalAVLtree.getExn(m.data, x, m.cmp); + return Belt_internalAVLtree.getExn(m.data, x, m.cmp); } function has(m, x) { - return Bs_internalAVLtree.has(m.data, x, m.cmp); + return Belt_internalAVLtree.has(m.data, x, m.cmp); } -function ofArray(data, dict) { - var cmp = dict[/* cmp */0]; +function ofArray(data, id) { + var cmp = id[/* cmp */0]; return { cmp: cmp, - data: Bs_internalAVLtree.ofArray(data, cmp) + data: Belt_internalAVLtree.ofArray(data, cmp) }; } function set(m, e, v) { var oldRoot = m.data; - var newRoot = Bs_internalAVLtree.updateMutate(oldRoot, e, v, m.cmp); + var newRoot = Belt_internalAVLtree.updateMutate(oldRoot, e, v, m.cmp); if (newRoot !== oldRoot) { m.data = newRoot; return /* () */0; @@ -340,7 +340,7 @@ function mergeArrayAux(t, xs, cmp) { var v = t; for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ var match = xs[i]; - v = Bs_internalAVLtree.updateMutate(v, match[0], match[1], cmp); + v = Belt_internalAVLtree.updateMutate(v, match[0], match[1], cmp); } return v; } diff --git a/lib/js/bs_MutableMapString.js b/lib/js/belt_MutableMapInt.js similarity index 69% rename from lib/js/bs_MutableMapString.js rename to lib/js/belt_MutableMapInt.js index fbb004ab42..07cb228cd9 100644 --- a/lib/js/bs_MutableMapString.js +++ b/lib/js/belt_MutableMapInt.js @@ -1,59 +1,59 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); -var Bs_internalMapString = require("./bs_internalMapString.js"); +var Belt_internalMapInt = require("./belt_internalMapInt.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function make() { return { - data: Bs_internalAVLtree.empty + data: Belt_internalAVLtree.empty }; } function isEmpty(m) { - return Bs_internalAVLtree.isEmpty(m.data); + return Belt_internalAVLtree.isEmpty(m.data); } function clear(m) { - m.data = Bs_internalAVLtree.empty; + m.data = Belt_internalAVLtree.empty; return /* () */0; } function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); + return Belt_internalAVLtree.minKeyUndefined(m.data); } function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); + return Belt_internalAVLtree.minKey(m.data); } function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); + return Belt_internalAVLtree.maxKeyUndefined(m.data); } function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); + return Belt_internalAVLtree.maxKey(m.data); } function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); + return Belt_internalAVLtree.minimum(m.data); } function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); + return Belt_internalAVLtree.minUndefined(m.data); } function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); + return Belt_internalAVLtree.maximum(m.data); } function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); + return Belt_internalAVLtree.maxUndefined(m.data); } function set(m, k, v) { var old_data = m.data; - var v$1 = Bs_internalMapString.addMutate(old_data, k, v); + var v$1 = Belt_internalMapInt.addMutate(old_data, k, v); if (v$1 !== old_data) { m.data = v$1; return /* () */0; @@ -63,16 +63,16 @@ function set(m, k, v) { } function forEachU(d, f) { - return Bs_internalAVLtree.forEachU(d.data, f); + return Belt_internalAVLtree.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLtree.forEachU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); } function mapU(d, f) { return { - data: Bs_internalAVLtree.mapU(d.data, f) + data: Belt_internalAVLtree.mapU(d.data, f) }; } @@ -82,7 +82,7 @@ function map(d, f) { function mapWithKeyU(d, f) { return { - data: Bs_internalAVLtree.mapWithKeyU(d.data, f) + data: Belt_internalAVLtree.mapWithKeyU(d.data, f) }; } @@ -91,7 +91,7 @@ function mapWithKey(d, f) { } function reduceU(d, acc, f) { - return Bs_internalAVLtree.reduceU(d.data, acc, f); + return Belt_internalAVLtree.reduceU(d.data, acc, f); } function reduce(d, acc, f) { @@ -99,47 +99,47 @@ function reduce(d, acc, f) { } function everyU(d, f) { - return Bs_internalAVLtree.everyU(d.data, f); + return Belt_internalAVLtree.everyU(d.data, f); } function every(d, f) { - return Bs_internalAVLtree.everyU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); } function someU(d, f) { - return Bs_internalAVLtree.someU(d.data, f); + return Belt_internalAVLtree.someU(d.data, f); } function some(d, f) { - return Bs_internalAVLtree.someU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); } function size(d) { - return Bs_internalAVLtree.size(d.data); + return Belt_internalAVLtree.size(d.data); } function toList(d) { - return Bs_internalAVLtree.toList(d.data); + return Belt_internalAVLtree.toList(d.data); } function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); + return Belt_internalAVLtree.toArray(d.data); } function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); + return Belt_internalAVLtree.keysToArray(d.data); } function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); + return Belt_internalAVLtree.valuesToArray(d.data); } function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); + return Belt_internalAVLtree.checkInvariantInternal(d.data); } function has(d, v) { - return Bs_internalMapString.has(d.data, v); + return Belt_internalMapInt.has(d.data, v); } function removeMutateAux(nt, x) { @@ -149,8 +149,8 @@ function removeMutateAux(nt, x) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); + nt.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLtree.balMutate(nt); } else { return l; } @@ -161,7 +161,7 @@ function removeMutateAux(nt, x) { var match = nt.left; if (match !== null) { nt.left = removeMutateAux(match, x); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -169,7 +169,7 @@ function removeMutateAux(nt, x) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeMutateAux(match$1, x); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -204,8 +204,8 @@ function updateDone(t, x, f) { var r = t.right; if (l !== null) { if (r !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r); - return Bs_internalAVLtree.balMutate(t); + t.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(t, r); + return Belt_internalAVLtree.balMutate(t); } else { return l; } @@ -222,12 +222,12 @@ function updateDone(t, x, f) { } else { t.right = updateDone(r$1, x, f); } - return Bs_internalAVLtree.balMutate(t); + return Belt_internalAVLtree.balMutate(t); } } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); + return Belt_internalAVLtree.singleton(x, match$1[0]); } else { return t; } @@ -262,7 +262,7 @@ function removeArrayMutateAux(_t, xs, _i, len) { continue ; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } else { return t; @@ -288,12 +288,12 @@ function removeMany(d, xs) { function ofArray(xs) { return { - data: Bs_internalMapString.ofArray(xs) + data: Belt_internalMapInt.ofArray(xs) }; } function cmpU(d0, d1, f) { - return Bs_internalMapString.cmpU(d0.data, d1.data, f); + return Belt_internalMapInt.cmpU(d0.data, d1.data, f); } function cmp(d0, d1, f) { @@ -301,7 +301,7 @@ function cmp(d0, d1, f) { } function eqU(d0, d1, f) { - return Bs_internalMapString.eqU(d0.data, d1.data, f); + return Belt_internalMapInt.eqU(d0.data, d1.data, f); } function eq(d0, d1, f) { @@ -309,19 +309,19 @@ function eq(d0, d1, f) { } function get(d, x) { - return Bs_internalMapString.get(d.data, x); + return Belt_internalMapInt.get(d.data, x); } function getUndefined(d, x) { - return Bs_internalMapString.getUndefined(d.data, x); + return Belt_internalMapInt.getUndefined(d.data, x); } function getWithDefault(d, x, def) { - return Bs_internalMapString.getWithDefault(d.data, x, def); + return Belt_internalMapInt.getWithDefault(d.data, x, def); } function getExn(d, x) { - return Bs_internalMapString.getExn(d.data, x); + return Belt_internalMapInt.getExn(d.data, x); } exports.make = make; diff --git a/lib/js/bs_MutableMapInt.js b/lib/js/belt_MutableMapString.js similarity index 69% rename from lib/js/bs_MutableMapInt.js rename to lib/js/belt_MutableMapString.js index 56f9451947..e0bd409b20 100644 --- a/lib/js/bs_MutableMapInt.js +++ b/lib/js/belt_MutableMapString.js @@ -1,59 +1,59 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalMapInt = require("./bs_internalMapInt.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); +var Belt_internalMapString = require("./belt_internalMapString.js"); function make() { return { - data: Bs_internalAVLtree.empty + data: Belt_internalAVLtree.empty }; } function isEmpty(m) { - return Bs_internalAVLtree.isEmpty(m.data); + return Belt_internalAVLtree.isEmpty(m.data); } function clear(m) { - m.data = Bs_internalAVLtree.empty; + m.data = Belt_internalAVLtree.empty; return /* () */0; } function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); + return Belt_internalAVLtree.minKeyUndefined(m.data); } function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); + return Belt_internalAVLtree.minKey(m.data); } function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); + return Belt_internalAVLtree.maxKeyUndefined(m.data); } function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); + return Belt_internalAVLtree.maxKey(m.data); } function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); + return Belt_internalAVLtree.minimum(m.data); } function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); + return Belt_internalAVLtree.minUndefined(m.data); } function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); + return Belt_internalAVLtree.maximum(m.data); } function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); + return Belt_internalAVLtree.maxUndefined(m.data); } function set(m, k, v) { var old_data = m.data; - var v$1 = Bs_internalMapInt.addMutate(old_data, k, v); + var v$1 = Belt_internalMapString.addMutate(old_data, k, v); if (v$1 !== old_data) { m.data = v$1; return /* () */0; @@ -63,16 +63,16 @@ function set(m, k, v) { } function forEachU(d, f) { - return Bs_internalAVLtree.forEachU(d.data, f); + return Belt_internalAVLtree.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLtree.forEachU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.forEachU(d.data, Curry.__2(f)); } function mapU(d, f) { return { - data: Bs_internalAVLtree.mapU(d.data, f) + data: Belt_internalAVLtree.mapU(d.data, f) }; } @@ -82,7 +82,7 @@ function map(d, f) { function mapWithKeyU(d, f) { return { - data: Bs_internalAVLtree.mapWithKeyU(d.data, f) + data: Belt_internalAVLtree.mapWithKeyU(d.data, f) }; } @@ -91,7 +91,7 @@ function mapWithKey(d, f) { } function reduceU(d, acc, f) { - return Bs_internalAVLtree.reduceU(d.data, acc, f); + return Belt_internalAVLtree.reduceU(d.data, acc, f); } function reduce(d, acc, f) { @@ -99,47 +99,47 @@ function reduce(d, acc, f) { } function everyU(d, f) { - return Bs_internalAVLtree.everyU(d.data, f); + return Belt_internalAVLtree.everyU(d.data, f); } function every(d, f) { - return Bs_internalAVLtree.everyU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.everyU(d.data, Curry.__2(f)); } function someU(d, f) { - return Bs_internalAVLtree.someU(d.data, f); + return Belt_internalAVLtree.someU(d.data, f); } function some(d, f) { - return Bs_internalAVLtree.someU(d.data, Curry.__2(f)); + return Belt_internalAVLtree.someU(d.data, Curry.__2(f)); } function size(d) { - return Bs_internalAVLtree.size(d.data); + return Belt_internalAVLtree.size(d.data); } function toList(d) { - return Bs_internalAVLtree.toList(d.data); + return Belt_internalAVLtree.toList(d.data); } function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); + return Belt_internalAVLtree.toArray(d.data); } function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); + return Belt_internalAVLtree.keysToArray(d.data); } function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); + return Belt_internalAVLtree.valuesToArray(d.data); } function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); + return Belt_internalAVLtree.checkInvariantInternal(d.data); } function has(d, v) { - return Bs_internalMapInt.has(d.data, v); + return Belt_internalMapString.has(d.data, v); } function removeMutateAux(nt, x) { @@ -149,8 +149,8 @@ function removeMutateAux(nt, x) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); + nt.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLtree.balMutate(nt); } else { return l; } @@ -161,7 +161,7 @@ function removeMutateAux(nt, x) { var match = nt.left; if (match !== null) { nt.left = removeMutateAux(match, x); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -169,7 +169,7 @@ function removeMutateAux(nt, x) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeMutateAux(match$1, x); - return Bs_internalAVLtree.balMutate(nt); + return Belt_internalAVLtree.balMutate(nt); } else { return nt; } @@ -204,8 +204,8 @@ function updateDone(t, x, f) { var r = t.right; if (l !== null) { if (r !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r); - return Bs_internalAVLtree.balMutate(t); + t.right = Belt_internalAVLtree.removeMinAuxWithRootMutate(t, r); + return Belt_internalAVLtree.balMutate(t); } else { return l; } @@ -222,12 +222,12 @@ function updateDone(t, x, f) { } else { t.right = updateDone(r$1, x, f); } - return Bs_internalAVLtree.balMutate(t); + return Belt_internalAVLtree.balMutate(t); } } else { var match$1 = f(/* None */0); if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); + return Belt_internalAVLtree.singleton(x, match$1[0]); } else { return t; } @@ -262,7 +262,7 @@ function removeArrayMutateAux(_t, xs, _i, len) { continue ; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } else { return t; @@ -288,12 +288,12 @@ function removeMany(d, xs) { function ofArray(xs) { return { - data: Bs_internalMapInt.ofArray(xs) + data: Belt_internalMapString.ofArray(xs) }; } function cmpU(d0, d1, f) { - return Bs_internalMapInt.cmpU(d0.data, d1.data, f); + return Belt_internalMapString.cmpU(d0.data, d1.data, f); } function cmp(d0, d1, f) { @@ -301,7 +301,7 @@ function cmp(d0, d1, f) { } function eqU(d0, d1, f) { - return Bs_internalMapInt.eqU(d0.data, d1.data, f); + return Belt_internalMapString.eqU(d0.data, d1.data, f); } function eq(d0, d1, f) { @@ -309,19 +309,19 @@ function eq(d0, d1, f) { } function get(d, x) { - return Bs_internalMapInt.get(d.data, x); + return Belt_internalMapString.get(d.data, x); } function getUndefined(d, x) { - return Bs_internalMapInt.getUndefined(d.data, x); + return Belt_internalMapString.getUndefined(d.data, x); } function getWithDefault(d, x, def) { - return Bs_internalMapInt.getWithDefault(d.data, x, def); + return Belt_internalMapString.getWithDefault(d.data, x, def); } function getExn(d, x) { - return Bs_internalMapInt.getExn(d.data, x); + return Belt_internalMapString.getExn(d.data, x); } exports.make = make; diff --git a/lib/js/bs_MutableQueue.js b/lib/js/belt_MutableQueue.js similarity index 98% rename from lib/js/bs_MutableQueue.js rename to lib/js/belt_MutableQueue.js index ec875c8fbe..fabdc354d6 100644 --- a/lib/js/bs_MutableQueue.js +++ b/lib/js/belt_MutableQueue.js @@ -61,7 +61,7 @@ function peekExn(q) { if (match !== null) { return match.content; } else { - throw new Error("Bs.Queue.Empty"); + throw new Error("Belt.Queue.Empty"); } } @@ -95,7 +95,7 @@ function popExn(q) { return match.content; } } else { - throw new Error("Bs.Queue.Empty"); + throw new Error("Empty"); } } diff --git a/lib/js/bs_MutableSet.js b/lib/js/belt_MutableSet.js similarity index 64% rename from lib/js/bs_MutableSet.js rename to lib/js/belt_MutableSet.js index ccf68e4275..24a4758b61 100644 --- a/lib/js/bs_MutableSet.js +++ b/lib/js/belt_MutableSet.js @@ -1,8 +1,8 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArray = require("./bs_SortArray.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); +var Belt_SortArray = require("./belt_SortArray.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); function remove0(nt, x, cmp) { var k = nt.key; @@ -12,7 +12,7 @@ function remove0(nt, x, cmp) { var match = nt.left; if (match !== null) { nt.left = remove0(match, x, cmp); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -20,7 +20,7 @@ function remove0(nt, x, cmp) { var match$1 = nt.right; if (match$1 !== null) { nt.right = remove0(match$1, x, cmp); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -30,8 +30,8 @@ function remove0(nt, x, cmp) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -69,7 +69,7 @@ function removeMany0(_t, xs, _i, len, cmp) { continue ; } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { return t; @@ -96,7 +96,7 @@ function removeCheck0(nt, x, removed, cmp) { var match = nt.left; if (match !== null) { nt.left = removeCheck0(match, x, removed, cmp); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -104,7 +104,7 @@ function removeCheck0(nt, x, removed, cmp) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeCheck0(match$1, x, removed, cmp); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -115,8 +115,8 @@ function removeCheck0(nt, x, removed, cmp) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -153,13 +153,13 @@ function addCheck0(t, x, added, cmp) { } else { t.right = addCheck0(r, x, added, cmp); } - return Bs_internalAVLset.balMutate(t); + return Belt_internalAVLset.balMutate(t); } else { return t; } } else { added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -175,7 +175,7 @@ function addCheck(m, e) { function add(m, e) { var oldRoot = m.data; - var newRoot = Bs_internalAVLset.addMutate(m.cmp, oldRoot, e); + var newRoot = Belt_internalAVLset.addMutate(m.cmp, oldRoot, e); if (newRoot !== oldRoot) { m.data = newRoot; return /* () */0; @@ -187,7 +187,7 @@ function add(m, e) { function addArrayMutate(t, xs, cmp) { var v = t; for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalAVLset.addMutate(cmp, v, xs[i]); + v = Belt_internalAVLset.addMutate(cmp, v, xs[i]); } return v; } @@ -197,43 +197,43 @@ function mergeMany(d, xs) { return /* () */0; } -function make(dict) { +function make(id) { return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLset.empty + cmp: id[/* cmp */0], + data: Belt_internalAVLset.empty }; } function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); + return Belt_internalAVLset.isEmpty(d.data); } function minimum(d) { - return Bs_internalAVLset.minimum(d.data); + return Belt_internalAVLset.minimum(d.data); } function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); + return Belt_internalAVLset.minUndefined(d.data); } function maximum(d) { - return Bs_internalAVLset.maximum(d.data); + return Belt_internalAVLset.maximum(d.data); } function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); + return Belt_internalAVLset.maxUndefined(d.data); } function forEachU(d, f) { - return Bs_internalAVLset.forEachU(d.data, f); + return Belt_internalAVLset.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLset.forEachU(d.data, Curry.__1(f)); + return Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); } function reduceU(d, acc, cb) { - return Bs_internalAVLset.reduceU(d.data, acc, cb); + return Belt_internalAVLset.reduceU(d.data, acc, cb); } function reduce(d, acc, cb) { @@ -241,76 +241,76 @@ function reduce(d, acc, cb) { } function everyU(d, p) { - return Bs_internalAVLset.everyU(d.data, p); + return Belt_internalAVLset.everyU(d.data, p); } function every(d, p) { - return Bs_internalAVLset.everyU(d.data, Curry.__1(p)); + return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); } function someU(d, p) { - return Bs_internalAVLset.someU(d.data, p); + return Belt_internalAVLset.someU(d.data, p); } function some(d, p) { - return Bs_internalAVLset.someU(d.data, Curry.__1(p)); + return Belt_internalAVLset.someU(d.data, Curry.__1(p)); } function size(d) { - return Bs_internalAVLset.size(d.data); + return Belt_internalAVLset.size(d.data); } function toList(d) { - return Bs_internalAVLset.toList(d.data); + return Belt_internalAVLset.toList(d.data); } function toArray(d) { - return Bs_internalAVLset.toArray(d.data); + return Belt_internalAVLset.toArray(d.data); } -function ofSortedArrayUnsafe(xs, dict) { +function ofSortedArrayUnsafe(xs, id) { return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) + cmp: id[/* cmp */0], + data: Belt_internalAVLset.ofSortedArrayUnsafe(xs) }; } function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); + return Belt_internalAVLset.checkInvariantInternal(d.data); } -function ofArray(data, dict) { - var cmp = dict[/* cmp */0]; +function ofArray(data, id) { + var cmp = id[/* cmp */0]; return { cmp: cmp, - data: Bs_internalAVLset.ofArray(data, cmp) + data: Belt_internalAVLset.ofArray(data, cmp) }; } function cmp(d0, d1) { - return Bs_internalAVLset.cmp(d0.data, d1.data, d0.cmp); + return Belt_internalAVLset.cmp(d0.data, d1.data, d0.cmp); } function eq(d0, d1) { - return Bs_internalAVLset.eq(d0.data, d1.data, d0.cmp); + return Belt_internalAVLset.eq(d0.data, d1.data, d0.cmp); } function get(d, x) { - return Bs_internalAVLset.get(d.data, x, d.cmp); + return Belt_internalAVLset.get(d.data, x, d.cmp); } function getUndefined(d, x) { - return Bs_internalAVLset.getUndefined(d.data, x, d.cmp); + return Belt_internalAVLset.getUndefined(d.data, x, d.cmp); } function getExn(d, x) { - return Bs_internalAVLset.getExn(d.data, x, d.cmp); + return Belt_internalAVLset.getExn(d.data, x, d.cmp); } function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); + var arr = Belt_internalAVLset.toArray(d.data); var cmp = d.cmp; - var i = Bs_SortArray.binarySearchByU(arr, key, cmp); + var i = Belt_SortArray.binarySearchByU(arr, key, cmp); var len = arr.length; if (i < 0) { var next = (-i | 0) - 1 | 0; @@ -318,11 +318,11 @@ function split(d, key) { /* tuple */[ { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, next) }, { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) } ], /* false */0 @@ -332,11 +332,11 @@ function split(d, key) { /* tuple */[ { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, i) }, { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) } ], /* true */1 @@ -347,7 +347,7 @@ function split(d, key) { function keepU(d, p) { return { cmp: d.cmp, - data: Bs_internalAVLset.keepCopyU(d.data, p) + data: Belt_internalAVLset.keepCopyU(d.data, p) }; } @@ -357,7 +357,7 @@ function keep(d, p) { function partitionU(d, p) { var cmp = d.cmp; - var match = Bs_internalAVLset.partitionCopyU(d.data, p); + var match = Belt_internalAVLset.partitionCopyU(d.data, p); return /* tuple */[ { cmp: cmp, @@ -375,7 +375,7 @@ function partition(d, p) { } function subset(a, b) { - return Bs_internalAVLset.subset(a.data, b.data, a.cmp); + return Belt_internalAVLset.subset(a.data, b.data, a.cmp); } function intersect(a, b) { @@ -384,35 +384,35 @@ function intersect(a, b) { var match$1 = b.data; if (match !== null) { if (match$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(match); - var sizeb = Bs_internalAVLset.lengthNode(match$1); + var sizea = Belt_internalAVLset.lengthNode(match); + var sizeb = Belt_internalAVLset.lengthNode(match$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(match, 0, tmp); - Bs_internalAVLset.fillArray(match$1, sizea, tmp); + Belt_internalAVLset.fillArray(match, 0, tmp); + Belt_internalAVLset.fillArray(match$1, sizea, tmp); if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0 || cmp(tmp[totalSize - 1 | 0], tmp[0]) < 0) { return { cmp: cmp, - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } else { var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArray.intersectU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); + var k = Belt_SortArray.intersectU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); return { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -423,35 +423,35 @@ function diff(a, b) { var match = b.data; if (dataa !== null) { if (match !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa); - var sizeb = Bs_internalAVLset.lengthNode(match); + var sizea = Belt_internalAVLset.lengthNode(dataa); + var sizeb = Belt_internalAVLset.lengthNode(match); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa, 0, tmp); - Bs_internalAVLset.fillArray(match, sizea, tmp); + Belt_internalAVLset.fillArray(dataa, 0, tmp); + Belt_internalAVLset.fillArray(match, sizea, tmp); if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0 || cmp(tmp[totalSize - 1 | 0], tmp[0]) < 0) { return { cmp: cmp, - data: Bs_internalAVLset.copy(dataa) + data: Belt_internalAVLset.copy(dataa) }; } else { var tmp2 = new Array(sizea); - var k = Bs_SortArray.diffU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); + var k = Belt_SortArray.diffU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); return { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.copy(dataa) + data: Belt_internalAVLset.copy(dataa) }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -462,47 +462,47 @@ function union(a, b) { var datab = b.data; if (dataa !== null) { if (datab !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa); - var sizeb = Bs_internalAVLset.lengthNode(datab); + var sizea = Belt_internalAVLset.lengthNode(dataa); + var sizeb = Belt_internalAVLset.lengthNode(datab); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa, 0, tmp); - Bs_internalAVLset.fillArray(datab, sizea, tmp); + Belt_internalAVLset.fillArray(dataa, 0, tmp); + Belt_internalAVLset.fillArray(datab, sizea, tmp); if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0) { return { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) + data: Belt_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) }; } else { var tmp2 = new Array(totalSize); - var k = Bs_SortArray.unionU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); + var k = Belt_SortArray.unionU(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); return { cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.copy(dataa) + data: Belt_internalAVLset.copy(dataa) }; } } else { return { cmp: cmp, - data: Bs_internalAVLset.copy(datab) + data: Belt_internalAVLset.copy(datab) }; } } function has(d, x) { - return Bs_internalAVLset.has(d.data, x, d.cmp); + return Belt_internalAVLset.has(d.data, x, d.cmp); } function copy(d) { return { cmp: d.cmp, - data: Bs_internalAVLset.copy(d.data) + data: Belt_internalAVLset.copy(d.data) }; } diff --git a/lib/js/bs_MutableSetString.js b/lib/js/belt_MutableSetInt.js similarity index 63% rename from lib/js/bs_MutableSetString.js rename to lib/js/belt_MutableSetInt.js index bab4e4dec6..26577bfd2c 100644 --- a/lib/js/bs_MutableSetString.js +++ b/lib/js/belt_MutableSetInt.js @@ -1,9 +1,9 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_SortArrayString = require("./bs_SortArrayString.js"); -var Bs_internalSetString = require("./bs_internalSetString.js"); +var Belt_SortArrayInt = require("./belt_SortArrayInt.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); +var Belt_internalSetInt = require("./belt_internalSetInt.js"); function remove0(nt, x) { var k = nt.key; @@ -12,8 +12,8 @@ function remove0(nt, x) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -24,7 +24,7 @@ function remove0(nt, x) { var match = nt.left; if (match !== null) { nt.left = remove0(match, x); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -32,7 +32,7 @@ function remove0(nt, x) { var match$1 = nt.right; if (match$1 !== null) { nt.right = remove0(match$1, x); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -67,7 +67,7 @@ function removeMany0(_t, xs, _i, len) { continue ; } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { return t; @@ -94,8 +94,8 @@ function removeCheck0(nt, x, removed) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -106,7 +106,7 @@ function removeCheck0(nt, x, removed) { var match = nt.left; if (match !== null) { nt.left = removeCheck0(match, x, removed); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -114,7 +114,7 @@ function removeCheck0(nt, x, removed) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeCheck0(match$1, x, removed); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -149,11 +149,11 @@ function addCheck0(t, x, added) { } else { t.right = addCheck0(r, x, added); } - return Bs_internalAVLset.balMutate(t); + return Belt_internalAVLset.balMutate(t); } } else { added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -169,7 +169,7 @@ function addCheck(m, e) { function add(d, k) { var oldRoot = d.data; - var v = Bs_internalSetString.addMutate(oldRoot, k); + var v = Belt_internalSetInt.addMutate(oldRoot, k); if (v !== oldRoot) { d.data = v; return /* () */0; @@ -181,7 +181,7 @@ function add(d, k) { function addArrayMutate(t, xs) { var v = t; for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalSetString.addMutate(v, xs[i]); + v = Belt_internalSetInt.addMutate(v, xs[i]); } return v; } @@ -193,40 +193,40 @@ function mergeMany(d, arr) { function make() { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); + return Belt_internalAVLset.isEmpty(d.data); } function minimum(d) { - return Bs_internalAVLset.minimum(d.data); + return Belt_internalAVLset.minimum(d.data); } function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); + return Belt_internalAVLset.minUndefined(d.data); } function maximum(d) { - return Bs_internalAVLset.maximum(d.data); + return Belt_internalAVLset.maximum(d.data); } function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); + return Belt_internalAVLset.maxUndefined(d.data); } function forEachU(d, f) { - return Bs_internalAVLset.forEachU(d.data, f); + return Belt_internalAVLset.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLset.forEachU(d.data, Curry.__1(f)); + return Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); } function reduceU(d, acc, cb) { - return Bs_internalAVLset.reduceU(d.data, acc, cb); + return Belt_internalAVLset.reduceU(d.data, acc, cb); } function reduce(d, acc, cb) { @@ -234,82 +234,82 @@ function reduce(d, acc, cb) { } function everyU(d, p) { - return Bs_internalAVLset.everyU(d.data, p); + return Belt_internalAVLset.everyU(d.data, p); } function every(d, p) { - return Bs_internalAVLset.everyU(d.data, Curry.__1(p)); + return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); } function someU(d, p) { - return Bs_internalAVLset.someU(d.data, p); + return Belt_internalAVLset.someU(d.data, p); } function some(d, p) { - return Bs_internalAVLset.someU(d.data, Curry.__1(p)); + return Belt_internalAVLset.someU(d.data, Curry.__1(p)); } function size(d) { - return Bs_internalAVLset.size(d.data); + return Belt_internalAVLset.size(d.data); } function toList(d) { - return Bs_internalAVLset.toList(d.data); + return Belt_internalAVLset.toList(d.data); } function toArray(d) { - return Bs_internalAVLset.toArray(d.data); + return Belt_internalAVLset.toArray(d.data); } function ofSortedArrayUnsafe(xs) { return { - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) + data: Belt_internalAVLset.ofSortedArrayUnsafe(xs) }; } function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); + return Belt_internalAVLset.checkInvariantInternal(d.data); } function ofArray(xs) { return { - data: Bs_internalSetString.ofArray(xs) + data: Belt_internalSetInt.ofArray(xs) }; } function cmp(d0, d1) { - return Bs_internalSetString.cmp(d0.data, d1.data); + return Belt_internalSetInt.cmp(d0.data, d1.data); } function eq(d0, d1) { - return Bs_internalSetString.eq(d0.data, d1.data); + return Belt_internalSetInt.eq(d0.data, d1.data); } function get(d, x) { - return Bs_internalSetString.get(d.data, x); + return Belt_internalSetInt.get(d.data, x); } function getUndefined(d, x) { - return Bs_internalSetString.getUndefined(d.data, x); + return Belt_internalSetInt.getUndefined(d.data, x); } function getExn(d, x) { - return Bs_internalSetString.getExn(d.data, x); + return Belt_internalSetInt.getExn(d.data, x); } function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); - var i = Bs_SortArrayString.binarySearch(arr, key); + var arr = Belt_internalAVLset.toArray(d.data); + var i = Belt_SortArrayInt.binarySearch(arr, key); var len = arr.length; if (i < 0) { var next = (-i | 0) - 1 | 0; return /* tuple */[ /* tuple */[ { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, next) }, { - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) } ], /* false */0 @@ -318,10 +318,10 @@ function split(d, key) { return /* tuple */[ /* tuple */[ { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, i) }, { - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) } ], /* true */1 @@ -331,7 +331,7 @@ function split(d, key) { function keepU(d, p) { return { - data: Bs_internalAVLset.keepCopyU(d.data, p) + data: Belt_internalAVLset.keepCopyU(d.data, p) }; } @@ -340,7 +340,7 @@ function keep(d, p) { } function partitionU(d, p) { - var match = Bs_internalAVLset.partitionCopyU(d.data, p); + var match = Belt_internalAVLset.partitionCopyU(d.data, p); return /* tuple */[ { data: match[0] @@ -356,7 +356,7 @@ function partition(d, p) { } function subset(a, b) { - return Bs_internalSetString.subset(a.data, b.data); + return Belt_internalSetInt.subset(a.data, b.data); } function intersect(dataa, datab) { @@ -364,31 +364,31 @@ function intersect(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } else { var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArrayString.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayInt.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -398,31 +398,31 @@ function diff(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } else { var tmp2 = new Array(sizea); - var k = Bs_SortArrayString.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayInt.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -432,42 +432,42 @@ function union(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea]) { return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) + data: Belt_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) }; } else { var tmp2 = new Array(totalSize); - var k = Bs_SortArrayString.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayInt.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } } else { return { - data: Bs_internalAVLset.copy(datab$1) + data: Belt_internalAVLset.copy(datab$1) }; } } function has(d, x) { - return Bs_internalSetString.has(d.data, x); + return Belt_internalSetInt.has(d.data, x); } function copy(d) { return { - data: Bs_internalAVLset.copy(d.data) + data: Belt_internalAVLset.copy(d.data) }; } diff --git a/lib/js/bs_MutableSetInt.js b/lib/js/belt_MutableSetString.js similarity index 62% rename from lib/js/bs_MutableSetInt.js rename to lib/js/belt_MutableSetString.js index fde48f9830..88d40c1602 100644 --- a/lib/js/bs_MutableSetInt.js +++ b/lib/js/belt_MutableSetString.js @@ -1,9 +1,9 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArrayInt = require("./bs_SortArrayInt.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_internalSetInt = require("./bs_internalSetInt.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); +var Belt_SortArrayString = require("./belt_SortArrayString.js"); +var Belt_internalSetString = require("./belt_internalSetString.js"); function remove0(nt, x) { var k = nt.key; @@ -12,8 +12,8 @@ function remove0(nt, x) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -24,7 +24,7 @@ function remove0(nt, x) { var match = nt.left; if (match !== null) { nt.left = remove0(match, x); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -32,7 +32,7 @@ function remove0(nt, x) { var match$1 = nt.right; if (match$1 !== null) { nt.right = remove0(match$1, x); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -67,7 +67,7 @@ function removeMany0(_t, xs, _i, len) { continue ; } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { return t; @@ -94,8 +94,8 @@ function removeCheck0(nt, x, removed) { var r = nt.right; if (l !== null) { if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); + nt.right = Belt_internalAVLset.removeMinAuxWithRootMutate(nt, r); + return Belt_internalAVLset.balMutate(nt); } else { return l; } @@ -106,7 +106,7 @@ function removeCheck0(nt, x, removed) { var match = nt.left; if (match !== null) { nt.left = removeCheck0(match, x, removed); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -114,7 +114,7 @@ function removeCheck0(nt, x, removed) { var match$1 = nt.right; if (match$1 !== null) { nt.right = removeCheck0(match$1, x, removed); - return Bs_internalAVLset.balMutate(nt); + return Belt_internalAVLset.balMutate(nt); } else { return nt; } @@ -149,11 +149,11 @@ function addCheck0(t, x, added) { } else { t.right = addCheck0(r, x, added); } - return Bs_internalAVLset.balMutate(t); + return Belt_internalAVLset.balMutate(t); } } else { added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -169,7 +169,7 @@ function addCheck(m, e) { function add(d, k) { var oldRoot = d.data; - var v = Bs_internalSetInt.addMutate(oldRoot, k); + var v = Belt_internalSetString.addMutate(oldRoot, k); if (v !== oldRoot) { d.data = v; return /* () */0; @@ -181,7 +181,7 @@ function add(d, k) { function addArrayMutate(t, xs) { var v = t; for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalSetInt.addMutate(v, xs[i]); + v = Belt_internalSetString.addMutate(v, xs[i]); } return v; } @@ -193,40 +193,40 @@ function mergeMany(d, arr) { function make() { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); + return Belt_internalAVLset.isEmpty(d.data); } function minimum(d) { - return Bs_internalAVLset.minimum(d.data); + return Belt_internalAVLset.minimum(d.data); } function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); + return Belt_internalAVLset.minUndefined(d.data); } function maximum(d) { - return Bs_internalAVLset.maximum(d.data); + return Belt_internalAVLset.maximum(d.data); } function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); + return Belt_internalAVLset.maxUndefined(d.data); } function forEachU(d, f) { - return Bs_internalAVLset.forEachU(d.data, f); + return Belt_internalAVLset.forEachU(d.data, f); } function forEach(d, f) { - return Bs_internalAVLset.forEachU(d.data, Curry.__1(f)); + return Belt_internalAVLset.forEachU(d.data, Curry.__1(f)); } function reduceU(d, acc, cb) { - return Bs_internalAVLset.reduceU(d.data, acc, cb); + return Belt_internalAVLset.reduceU(d.data, acc, cb); } function reduce(d, acc, cb) { @@ -234,82 +234,82 @@ function reduce(d, acc, cb) { } function everyU(d, p) { - return Bs_internalAVLset.everyU(d.data, p); + return Belt_internalAVLset.everyU(d.data, p); } function every(d, p) { - return Bs_internalAVLset.everyU(d.data, Curry.__1(p)); + return Belt_internalAVLset.everyU(d.data, Curry.__1(p)); } function someU(d, p) { - return Bs_internalAVLset.someU(d.data, p); + return Belt_internalAVLset.someU(d.data, p); } function some(d, p) { - return Bs_internalAVLset.someU(d.data, Curry.__1(p)); + return Belt_internalAVLset.someU(d.data, Curry.__1(p)); } function size(d) { - return Bs_internalAVLset.size(d.data); + return Belt_internalAVLset.size(d.data); } function toList(d) { - return Bs_internalAVLset.toList(d.data); + return Belt_internalAVLset.toList(d.data); } function toArray(d) { - return Bs_internalAVLset.toArray(d.data); + return Belt_internalAVLset.toArray(d.data); } function ofSortedArrayUnsafe(xs) { return { - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) + data: Belt_internalAVLset.ofSortedArrayUnsafe(xs) }; } function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); + return Belt_internalAVLset.checkInvariantInternal(d.data); } function ofArray(xs) { return { - data: Bs_internalSetInt.ofArray(xs) + data: Belt_internalSetString.ofArray(xs) }; } function cmp(d0, d1) { - return Bs_internalSetInt.cmp(d0.data, d1.data); + return Belt_internalSetString.cmp(d0.data, d1.data); } function eq(d0, d1) { - return Bs_internalSetInt.eq(d0.data, d1.data); + return Belt_internalSetString.eq(d0.data, d1.data); } function get(d, x) { - return Bs_internalSetInt.get(d.data, x); + return Belt_internalSetString.get(d.data, x); } function getUndefined(d, x) { - return Bs_internalSetInt.getUndefined(d.data, x); + return Belt_internalSetString.getUndefined(d.data, x); } function getExn(d, x) { - return Bs_internalSetInt.getExn(d.data, x); + return Belt_internalSetString.getExn(d.data, x); } function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); - var i = Bs_SortArrayInt.binarySearch(arr, key); + var arr = Belt_internalAVLset.toArray(d.data); + var i = Belt_SortArrayString.binarySearch(arr, key); var len = arr.length; if (i < 0) { var next = (-i | 0) - 1 | 0; return /* tuple */[ /* tuple */[ { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, next) }, { - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) } ], /* false */0 @@ -318,10 +318,10 @@ function split(d, key) { return /* tuple */[ /* tuple */[ { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) + data: Belt_internalAVLset.ofSortedArrayAux(arr, 0, i) }, { - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) + data: Belt_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) } ], /* true */1 @@ -331,7 +331,7 @@ function split(d, key) { function keepU(d, p) { return { - data: Bs_internalAVLset.keepCopyU(d.data, p) + data: Belt_internalAVLset.keepCopyU(d.data, p) }; } @@ -340,7 +340,7 @@ function keep(d, p) { } function partitionU(d, p) { - var match = Bs_internalAVLset.partitionCopyU(d.data, p); + var match = Belt_internalAVLset.partitionCopyU(d.data, p); return /* tuple */[ { data: match[0] @@ -356,7 +356,7 @@ function partition(d, p) { } function subset(a, b) { - return Bs_internalSetInt.subset(a.data, b.data); + return Belt_internalSetString.subset(a.data, b.data); } function intersect(dataa, datab) { @@ -364,31 +364,31 @@ function intersect(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } else { var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArrayInt.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayString.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -398,31 +398,31 @@ function diff(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } else { var tmp2 = new Array(sizea); - var k = Bs_SortArrayInt.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayString.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } } else { return { - data: Bs_internalAVLset.empty + data: Belt_internalAVLset.empty }; } } @@ -432,74 +432,63 @@ function union(dataa, datab) { var datab$1 = datab.data; if (dataa$1 !== null) { if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); + var sizea = Belt_internalAVLset.lengthNode(dataa$1); + var sizeb = Belt_internalAVLset.lengthNode(datab$1); var totalSize = sizea + sizeb | 0; var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); + Belt_internalAVLset.fillArray(dataa$1, 0, tmp); + Belt_internalAVLset.fillArray(datab$1, sizea, tmp); if (tmp[sizea - 1 | 0] < tmp[sizea]) { return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) + data: Belt_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) }; } else { var tmp2 = new Array(totalSize); - var k = Bs_SortArrayInt.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); + var k = Belt_SortArrayString.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) + data: Belt_internalAVLset.ofSortedArrayAux(tmp2, 0, k) }; } } else { return { - data: Bs_internalAVLset.copy(dataa$1) + data: Belt_internalAVLset.copy(dataa$1) }; } } else { return { - data: Bs_internalAVLset.copy(datab$1) + data: Belt_internalAVLset.copy(datab$1) }; } } function has(d, x) { - return Bs_internalSetInt.has(d.data, x); + return Belt_internalSetString.has(d.data, x); } function copy(d) { return { - data: Bs_internalAVLset.copy(d.data) + data: Belt_internalAVLset.copy(d.data) }; } -var I = 0; - -var S = 0; - -var N = 0; - -var A = 0; - -exports.I = I; -exports.S = S; -exports.N = N; -exports.A = A; -exports.remove0 = remove0; -exports.remove = remove; -exports.removeMany0 = removeMany0; -exports.removeMany = removeMany; -exports.removeCheck0 = removeCheck0; -exports.removeCheck = removeCheck; -exports.addCheck0 = addCheck0; -exports.addCheck = addCheck; -exports.add = add; -exports.addArrayMutate = addArrayMutate; -exports.mergeMany = mergeMany; exports.make = make; +exports.ofArray = ofArray; +exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; +exports.copy = copy; exports.isEmpty = isEmpty; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; +exports.has = has; +exports.add = add; +exports.addCheck = addCheck; +exports.mergeMany = mergeMany; +exports.remove = remove; +exports.removeCheck = removeCheck; +exports.removeMany = removeMany; +exports.union = union; +exports.intersect = intersect; +exports.diff = diff; +exports.subset = subset; +exports.cmp = cmp; +exports.eq = eq; exports.forEachU = forEachU; exports.forEach = forEach; exports.reduceU = reduceU; @@ -508,26 +497,20 @@ exports.everyU = everyU; exports.every = every; exports.someU = someU; exports.some = some; +exports.keepU = keepU; +exports.keep = keep; +exports.partitionU = partitionU; +exports.partition = partition; exports.size = size; exports.toList = toList; exports.toArray = toArray; -exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; -exports.checkInvariantInternal = checkInvariantInternal; -exports.ofArray = ofArray; -exports.cmp = cmp; -exports.eq = eq; +exports.minimum = minimum; +exports.minUndefined = minUndefined; +exports.maximum = maximum; +exports.maxUndefined = maxUndefined; exports.get = get; exports.getUndefined = getUndefined; exports.getExn = getExn; exports.split = split; -exports.keepU = keepU; -exports.keep = keep; -exports.partitionU = partitionU; -exports.partition = partition; -exports.subset = subset; -exports.intersect = intersect; -exports.diff = diff; -exports.union = union; -exports.has = has; -exports.copy = copy; +exports.checkInvariantInternal = checkInvariantInternal; /* No side effect */ diff --git a/lib/js/bs_MutableStack.js b/lib/js/belt_MutableStack.js similarity index 100% rename from lib/js/bs_MutableStack.js rename to lib/js/belt_MutableStack.js diff --git a/lib/js/bs_Range.js b/lib/js/belt_Range.js similarity index 100% rename from lib/js/bs_Range.js rename to lib/js/belt_Range.js diff --git a/lib/js/bs_Set.js b/lib/js/belt_Set.js similarity index 66% rename from lib/js/bs_Set.js rename to lib/js/belt_Set.js index b7412da0c4..555e718c32 100644 --- a/lib/js/bs_Set.js +++ b/lib/js/belt_Set.js @@ -1,20 +1,20 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SetDict = require("./bs_SetDict.js"); +var Belt_SetDict = require("./belt_SetDict.js"); -function ofArray(data, dict) { - var cmp = dict[/* cmp */0]; +function ofArray(data, id) { + var cmp = id[/* cmp */0]; return { cmp: cmp, - data: Bs_SetDict.ofArray(data, cmp) + data: Belt_SetDict.ofArray(data, cmp) }; } function remove(m, e) { var cmp = m.cmp; var data = m.data; - var newData = Bs_SetDict.remove(data, e, cmp); + var newData = Belt_SetDict.remove(data, e, cmp); if (newData === data) { return m; } else { @@ -28,7 +28,7 @@ function remove(m, e) { function add(m, e) { var cmp = m.cmp; var data = m.data; - var newData = Bs_SetDict.add(data, e, cmp); + var newData = Belt_SetDict.add(data, e, cmp); if (newData === data) { return m; } else { @@ -43,7 +43,7 @@ function mergeMany(m, e) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_SetDict.mergeMany(m.data, e, cmp) + data: Belt_SetDict.mergeMany(m.data, e, cmp) }; } @@ -51,7 +51,7 @@ function removeMany(m, e) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_SetDict.removeMany(m.data, e, cmp) + data: Belt_SetDict.removeMany(m.data, e, cmp) }; } @@ -59,7 +59,7 @@ function union(m, n) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_SetDict.union(m.data, n.data, cmp) + data: Belt_SetDict.union(m.data, n.data, cmp) }; } @@ -67,7 +67,7 @@ function intersect(m, n) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_SetDict.intersect(m.data, n.data, cmp) + data: Belt_SetDict.intersect(m.data, n.data, cmp) }; } @@ -75,18 +75,18 @@ function diff(m, n) { var cmp = m.cmp; return { cmp: cmp, - data: Bs_SetDict.diff(m.data, n.data, cmp) + data: Belt_SetDict.diff(m.data, n.data, cmp) }; } function subset(m, n) { var cmp = m.cmp; - return Bs_SetDict.subset(m.data, n.data, cmp); + return Belt_SetDict.subset(m.data, n.data, cmp); } function split(m, e) { var cmp = m.cmp; - var match = Bs_SetDict.split(m.data, e, cmp); + var match = Belt_SetDict.split(m.data, e, cmp); var match$1 = match[0]; return /* tuple */[ /* tuple */[ @@ -103,36 +103,36 @@ function split(m, e) { ]; } -function make(dict) { +function make(id) { return { - cmp: dict[/* cmp */0], - data: Bs_SetDict.empty + cmp: id[/* cmp */0], + data: Belt_SetDict.empty }; } function isEmpty(m) { - return Bs_SetDict.isEmpty(m.data); + return Belt_SetDict.isEmpty(m.data); } function cmp(m, n) { var cmp$1 = m.cmp; - return Bs_SetDict.cmp(m.data, n.data, cmp$1); + return Belt_SetDict.cmp(m.data, n.data, cmp$1); } function eq(m, n) { - return Bs_SetDict.eq(m.data, n.data, m.cmp); + return Belt_SetDict.eq(m.data, n.data, m.cmp); } function forEachU(m, f) { - return Bs_SetDict.forEachU(m.data, f); + return Belt_SetDict.forEachU(m.data, f); } function forEach(m, f) { - return Bs_SetDict.forEachU(m.data, Curry.__1(f)); + return Belt_SetDict.forEachU(m.data, Curry.__1(f)); } function reduceU(m, acc, f) { - return Bs_SetDict.reduceU(m.data, acc, f); + return Belt_SetDict.reduceU(m.data, acc, f); } function reduce(m, acc, f) { @@ -140,25 +140,25 @@ function reduce(m, acc, f) { } function everyU(m, f) { - return Bs_SetDict.everyU(m.data, f); + return Belt_SetDict.everyU(m.data, f); } function every(m, f) { - return Bs_SetDict.everyU(m.data, Curry.__1(f)); + return Belt_SetDict.everyU(m.data, Curry.__1(f)); } function someU(m, f) { - return Bs_SetDict.someU(m.data, f); + return Belt_SetDict.someU(m.data, f); } function some(m, f) { - return Bs_SetDict.someU(m.data, Curry.__1(f)); + return Belt_SetDict.someU(m.data, Curry.__1(f)); } function keepU(m, f) { return { cmp: m.cmp, - data: Bs_SetDict.keepU(m.data, f) + data: Belt_SetDict.keepU(m.data, f) }; } @@ -167,7 +167,7 @@ function keep(m, f) { } function partitionU(m, f) { - var match = Bs_SetDict.partitionU(m.data, f); + var match = Belt_SetDict.partitionU(m.data, f); var cmp = m.cmp; return /* tuple */[ { @@ -186,53 +186,53 @@ function partition(m, f) { } function size(m) { - return Bs_SetDict.size(m.data); + return Belt_SetDict.size(m.data); } function toList(m) { - return Bs_SetDict.toList(m.data); + return Belt_SetDict.toList(m.data); } function toArray(m) { - return Bs_SetDict.toArray(m.data); + return Belt_SetDict.toArray(m.data); } function minimum(m) { - return Bs_SetDict.minimum(m.data); + return Belt_SetDict.minimum(m.data); } function minUndefined(m) { - return Bs_SetDict.minUndefined(m.data); + return Belt_SetDict.minUndefined(m.data); } function maximum(m) { - return Bs_SetDict.maximum(m.data); + return Belt_SetDict.maximum(m.data); } function maxUndefined(m) { - return Bs_SetDict.maxUndefined(m.data); + return Belt_SetDict.maxUndefined(m.data); } function get(m, e) { - return Bs_SetDict.get(m.data, e, m.cmp); + return Belt_SetDict.get(m.data, e, m.cmp); } function getUndefined(m, e) { - return Bs_SetDict.getUndefined(m.data, e, m.cmp); + return Belt_SetDict.getUndefined(m.data, e, m.cmp); } function getExn(m, e) { - return Bs_SetDict.getExn(m.data, e, m.cmp); + return Belt_SetDict.getExn(m.data, e, m.cmp); } function has(m, e) { - return Bs_SetDict.has(m.data, e, m.cmp); + return Belt_SetDict.has(m.data, e, m.cmp); } -function ofSortedArrayUnsafe(xs, dict) { +function ofSortedArrayUnsafe(xs, id) { return { - cmp: dict[/* cmp */0], - data: Bs_SetDict.ofSortedArrayUnsafe(xs) + cmp: id[/* cmp */0], + data: Belt_SetDict.ofSortedArrayUnsafe(xs) }; } @@ -245,15 +245,15 @@ function getDict(m) { return /* module */[/* cmp */cmp]; } -function packDictData(dict, data) { +function packDictData(id, data) { return { - cmp: dict[/* cmp */0], + cmp: id[/* cmp */0], data: data }; } function checkInvariantInternal(d) { - return Bs_SetDict.checkInvariantInternal(d.data); + return Belt_SetDict.checkInvariantInternal(d.data); } var Int = 0; diff --git a/lib/js/bs_SetDict.js b/lib/js/belt_SetDict.js similarity index 67% rename from lib/js/bs_SetDict.js rename to lib/js/belt_SetDict.js index 045cb9a4d4..50b46f6cff 100644 --- a/lib/js/bs_SetDict.js +++ b/lib/js/belt_SetDict.js @@ -1,6 +1,6 @@ 'use strict'; -var Bs_internalAVLset = require("./bs_internalAVLset.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); function add(t, x, cmp) { if (t !== null) { @@ -14,21 +14,21 @@ function add(t, x, cmp) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, k, r); + return Belt_internalAVLset.bal(ll, k, r); } } else { var rr = add(r, x, cmp); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, k, rr); + return Belt_internalAVLset.bal(l, k, rr); } } } else { return t; } } else { - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -44,21 +44,21 @@ function remove(t, x, cmp) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, v, r); + return Belt_internalAVLset.bal(ll, v, r); } } else { var rr = remove(r, x, cmp); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, v, rr); + return Belt_internalAVLset.bal(l, v, rr); } } } else if (l !== null) { if (r !== null) { var v$1 = [r.key]; - var r$1 = Bs_internalAVLset.removeMinAuxWithRef(r, v$1); - return Bs_internalAVLset.bal(l, v$1[0], r$1); + var r$1 = Belt_internalAVLset.removeMinAuxWithRef(r, v$1); + return Belt_internalAVLset.bal(l, v$1[0], r$1); } else { return l; } @@ -101,24 +101,24 @@ function splitAuxNoPivot(cmp, n, x) { var match = splitAuxNoPivot(cmp, l, x); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxNoPivot(cmp, r, x); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } else { @@ -140,24 +140,24 @@ function splitAuxPivot(cmp, n, x, pres) { var match = splitAuxPivot(cmp, l, x, pres); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxPivot(cmp, r, x, pres); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } else { @@ -180,8 +180,8 @@ function split(t, x, cmp) { } else { return /* tuple */[ /* tuple */[ - Bs_internalAVLset.empty, - Bs_internalAVLset.empty + Belt_internalAVLset.empty, + Belt_internalAVLset.empty ], /* false */0 ]; @@ -201,7 +201,7 @@ function union(s1, s2, cmp) { var v1 = s1.key; var r1 = s1.right; var match = splitAuxNoPivot(cmp, s2, v1); - return Bs_internalAVLset.joinShared(union(l1, match[0], cmp), v1, union(r1, match[1], cmp)); + return Belt_internalAVLset.joinShared(union(l1, match[0], cmp), v1, union(r1, match[1], cmp)); } } else if (h1 === 1) { return add(s2, s1.key, cmp); @@ -210,7 +210,7 @@ function union(s1, s2, cmp) { var v2 = s2.key; var r2 = s2.right; var match$1 = splitAuxNoPivot(cmp, s1, v2); - return Bs_internalAVLset.joinShared(union(match$1[0], l2, cmp), v2, union(match$1[1], r2, cmp)); + return Belt_internalAVLset.joinShared(union(match$1[0], l2, cmp), v2, union(match$1[1], r2, cmp)); } } else { return s1; @@ -231,15 +231,15 @@ function intersect(s1, s2, cmp) { var ll = intersect(l1, match[0], cmp); var rr = intersect(r1, match[1], cmp); if (pres[0]) { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } else { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } @@ -254,9 +254,9 @@ function diff(s1, s2, cmp) { var ll = diff(l1, match[0], cmp); var rr = diff(r1, match[1], cmp); if (pres[0]) { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } else { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } } else { return s1; @@ -266,67 +266,67 @@ function diff(s1, s2, cmp) { } } -var empty = Bs_internalAVLset.empty; +var empty = Belt_internalAVLset.empty; -var ofArray = Bs_internalAVLset.ofArray; +var ofArray = Belt_internalAVLset.ofArray; -var ofSortedArrayUnsafe = Bs_internalAVLset.ofSortedArrayUnsafe; +var ofSortedArrayUnsafe = Belt_internalAVLset.ofSortedArrayUnsafe; -var isEmpty = Bs_internalAVLset.isEmpty; +var isEmpty = Belt_internalAVLset.isEmpty; -var has = Bs_internalAVLset.has; +var has = Belt_internalAVLset.has; -var subset = Bs_internalAVLset.subset; +var subset = Belt_internalAVLset.subset; -var cmp = Bs_internalAVLset.cmp; +var cmp = Belt_internalAVLset.cmp; -var eq = Bs_internalAVLset.eq; +var eq = Belt_internalAVLset.eq; -var forEachU = Bs_internalAVLset.forEachU; +var forEachU = Belt_internalAVLset.forEachU; -var forEach = Bs_internalAVLset.forEach; +var forEach = Belt_internalAVLset.forEach; -var reduceU = Bs_internalAVLset.reduceU; +var reduceU = Belt_internalAVLset.reduceU; -var reduce = Bs_internalAVLset.reduce; +var reduce = Belt_internalAVLset.reduce; -var everyU = Bs_internalAVLset.everyU; +var everyU = Belt_internalAVLset.everyU; -var every = Bs_internalAVLset.every; +var every = Belt_internalAVLset.every; -var someU = Bs_internalAVLset.someU; +var someU = Belt_internalAVLset.someU; -var some = Bs_internalAVLset.some; +var some = Belt_internalAVLset.some; -var keepU = Bs_internalAVLset.keepSharedU; +var keepU = Belt_internalAVLset.keepSharedU; -var keep = Bs_internalAVLset.keepShared; +var keep = Belt_internalAVLset.keepShared; -var partitionU = Bs_internalAVLset.partitionSharedU; +var partitionU = Belt_internalAVLset.partitionSharedU; -var partition = Bs_internalAVLset.partitionShared; +var partition = Belt_internalAVLset.partitionShared; -var size = Bs_internalAVLset.size; +var size = Belt_internalAVLset.size; -var toList = Bs_internalAVLset.toList; +var toList = Belt_internalAVLset.toList; -var toArray = Bs_internalAVLset.toArray; +var toArray = Belt_internalAVLset.toArray; -var minimum = Bs_internalAVLset.minimum; +var minimum = Belt_internalAVLset.minimum; -var minUndefined = Bs_internalAVLset.minUndefined; +var minUndefined = Belt_internalAVLset.minUndefined; -var maximum = Bs_internalAVLset.maximum; +var maximum = Belt_internalAVLset.maximum; -var maxUndefined = Bs_internalAVLset.maxUndefined; +var maxUndefined = Belt_internalAVLset.maxUndefined; -var get = Bs_internalAVLset.get; +var get = Belt_internalAVLset.get; -var getUndefined = Bs_internalAVLset.getUndefined; +var getUndefined = Belt_internalAVLset.getUndefined; -var getExn = Bs_internalAVLset.getExn; +var getExn = Belt_internalAVLset.getExn; -var checkInvariantInternal = Bs_internalAVLset.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLset.checkInvariantInternal; exports.empty = empty; exports.ofArray = ofArray; diff --git a/lib/js/bs_SetInt.js b/lib/js/belt_SetInt.js similarity index 65% rename from lib/js/bs_SetInt.js rename to lib/js/belt_SetInt.js index 1fe7d9eb89..74b59fa13f 100644 --- a/lib/js/bs_SetInt.js +++ b/lib/js/belt_SetInt.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_internalSetInt = require("./bs_internalSetInt.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); +var Belt_internalSetInt = require("./belt_internalSetInt.js"); function add(t, x) { if (t !== null) { @@ -16,19 +16,19 @@ function add(t, x) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, v, r); + return Belt_internalAVLset.bal(ll, v, r); } } else { var rr = add(r, x); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, v, add(r, x)); + return Belt_internalAVLset.bal(l, v, add(r, x)); } } } } else { - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -51,8 +51,8 @@ function remove(t, x) { if (l !== null) { if (r !== null) { var v$1 = [r.key]; - var r$1 = Bs_internalAVLset.removeMinAuxWithRef(r, v$1); - return Bs_internalAVLset.bal(l, v$1[0], r$1); + var r$1 = Belt_internalAVLset.removeMinAuxWithRef(r, v$1); + return Belt_internalAVLset.bal(l, v$1[0], r$1); } else { return l; } @@ -64,14 +64,14 @@ function remove(t, x) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, v, r); + return Belt_internalAVLset.bal(ll, v, r); } } else { var rr = remove(r, x); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, v, rr); + return Belt_internalAVLset.bal(l, v, rr); } } } else { @@ -103,24 +103,24 @@ function splitAuxNoPivot(n, x) { var match = splitAuxNoPivot(l, x); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxNoPivot(r, x); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } @@ -140,24 +140,24 @@ function splitAuxPivot(n, x, pres) { var match = splitAuxPivot(l, x, pres); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxPivot(r, x, pres); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } @@ -173,8 +173,8 @@ function split(t, x) { } else { return /* tuple */[ /* tuple */[ - Bs_internalAVLset.empty, - Bs_internalAVLset.empty + Belt_internalAVLset.empty, + Belt_internalAVLset.empty ], /* false */0 ]; @@ -194,7 +194,7 @@ function union(s1, s2) { var v1 = s1.key; var r1 = s1.right; var match = splitAuxNoPivot(s2, v1); - return Bs_internalAVLset.joinShared(union(l1, match[0]), v1, union(r1, match[1])); + return Belt_internalAVLset.joinShared(union(l1, match[0]), v1, union(r1, match[1])); } } else if (h1 === 1) { return add(s2, s1.key); @@ -203,7 +203,7 @@ function union(s1, s2) { var v2 = s2.key; var r2 = s2.right; var match$1 = splitAuxNoPivot(s1, v2); - return Bs_internalAVLset.joinShared(union(match$1[0], l2), v2, union(match$1[1], r2)); + return Belt_internalAVLset.joinShared(union(match$1[0], l2), v2, union(match$1[1], r2)); } } else { return s1; @@ -224,15 +224,15 @@ function intersect(s1, s2) { var ll = intersect(l1, match[0]); var rr = intersect(r1, match[1]); if (pres[0]) { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } else { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } @@ -247,9 +247,9 @@ function diff(s1, s2) { var ll = diff(l1, match[0]); var rr = diff(r1, match[1]); if (pres[0]) { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } else { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } } else { return s1; @@ -259,67 +259,67 @@ function diff(s1, s2) { } } -var empty = Bs_internalAVLset.empty; +var empty = Belt_internalAVLset.empty; -var ofArray = Bs_internalSetInt.ofArray; +var ofArray = Belt_internalSetInt.ofArray; -var ofSortedArrayUnsafe = Bs_internalAVLset.ofSortedArrayUnsafe; +var ofSortedArrayUnsafe = Belt_internalAVLset.ofSortedArrayUnsafe; -var isEmpty = Bs_internalAVLset.isEmpty; +var isEmpty = Belt_internalAVLset.isEmpty; -var has = Bs_internalSetInt.has; +var has = Belt_internalSetInt.has; -var subset = Bs_internalSetInt.subset; +var subset = Belt_internalSetInt.subset; -var cmp = Bs_internalSetInt.cmp; +var cmp = Belt_internalSetInt.cmp; -var eq = Bs_internalSetInt.eq; +var eq = Belt_internalSetInt.eq; -var forEachU = Bs_internalAVLset.forEachU; +var forEachU = Belt_internalAVLset.forEachU; -var forEach = Bs_internalAVLset.forEach; +var forEach = Belt_internalAVLset.forEach; -var reduceU = Bs_internalAVLset.reduceU; +var reduceU = Belt_internalAVLset.reduceU; -var reduce = Bs_internalAVLset.reduce; +var reduce = Belt_internalAVLset.reduce; -var everyU = Bs_internalAVLset.everyU; +var everyU = Belt_internalAVLset.everyU; -var every = Bs_internalAVLset.every; +var every = Belt_internalAVLset.every; -var someU = Bs_internalAVLset.someU; +var someU = Belt_internalAVLset.someU; -var some = Bs_internalAVLset.some; +var some = Belt_internalAVLset.some; -var keepU = Bs_internalAVLset.keepSharedU; +var keepU = Belt_internalAVLset.keepSharedU; -var keep = Bs_internalAVLset.keepShared; +var keep = Belt_internalAVLset.keepShared; -var partitionU = Bs_internalAVLset.partitionSharedU; +var partitionU = Belt_internalAVLset.partitionSharedU; -var partition = Bs_internalAVLset.partitionShared; +var partition = Belt_internalAVLset.partitionShared; -var size = Bs_internalAVLset.size; +var size = Belt_internalAVLset.size; -var toList = Bs_internalAVLset.toList; +var toList = Belt_internalAVLset.toList; -var toArray = Bs_internalAVLset.toArray; +var toArray = Belt_internalAVLset.toArray; -var minimum = Bs_internalAVLset.minimum; +var minimum = Belt_internalAVLset.minimum; -var minUndefined = Bs_internalAVLset.minUndefined; +var minUndefined = Belt_internalAVLset.minUndefined; -var maximum = Bs_internalAVLset.maximum; +var maximum = Belt_internalAVLset.maximum; -var maxUndefined = Bs_internalAVLset.maxUndefined; +var maxUndefined = Belt_internalAVLset.maxUndefined; -var get = Bs_internalSetInt.get; +var get = Belt_internalSetInt.get; -var getUndefined = Bs_internalSetInt.getUndefined; +var getUndefined = Belt_internalSetInt.getUndefined; -var getExn = Bs_internalSetInt.getExn; +var getExn = Belt_internalSetInt.getExn; -var checkInvariantInternal = Bs_internalAVLset.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLset.checkInvariantInternal; exports.empty = empty; exports.ofArray = ofArray; diff --git a/lib/js/bs_SetString.js b/lib/js/belt_SetString.js similarity index 65% rename from lib/js/bs_SetString.js rename to lib/js/belt_SetString.js index 3511119565..faa6a10758 100644 --- a/lib/js/bs_SetString.js +++ b/lib/js/belt_SetString.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_internalSetString = require("./bs_internalSetString.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); +var Belt_internalSetString = require("./belt_internalSetString.js"); function add(t, x) { if (t !== null) { @@ -16,19 +16,19 @@ function add(t, x) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, v, r); + return Belt_internalAVLset.bal(ll, v, r); } } else { var rr = add(r, x); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, v, add(r, x)); + return Belt_internalAVLset.bal(l, v, add(r, x)); } } } } else { - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } @@ -51,8 +51,8 @@ function remove(t, x) { if (l !== null) { if (r !== null) { var v$1 = [r.key]; - var r$1 = Bs_internalAVLset.removeMinAuxWithRef(r, v$1); - return Bs_internalAVLset.bal(l, v$1[0], r$1); + var r$1 = Belt_internalAVLset.removeMinAuxWithRef(r, v$1); + return Belt_internalAVLset.bal(l, v$1[0], r$1); } else { return l; } @@ -64,14 +64,14 @@ function remove(t, x) { if (ll === l) { return t; } else { - return Bs_internalAVLset.bal(ll, v, r); + return Belt_internalAVLset.bal(ll, v, r); } } else { var rr = remove(r, x); if (rr === r) { return t; } else { - return Bs_internalAVLset.bal(l, v, rr); + return Belt_internalAVLset.bal(l, v, rr); } } } else { @@ -103,24 +103,24 @@ function splitAuxNoPivot(n, x) { var match = splitAuxNoPivot(l, x); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxNoPivot(r, x); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } @@ -140,24 +140,24 @@ function splitAuxPivot(n, x, pres) { var match = splitAuxPivot(l, x, pres); return /* tuple */[ match[0], - Bs_internalAVLset.joinShared(match[1], v, r) + Belt_internalAVLset.joinShared(match[1], v, r) ]; } else { return /* tuple */[ - Bs_internalAVLset.empty, + Belt_internalAVLset.empty, n ]; } } else if (r !== null) { var match$1 = splitAuxPivot(r, x, pres); return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), + Belt_internalAVLset.joinShared(l, v, match$1[0]), match$1[1] ]; } else { return /* tuple */[ n, - Bs_internalAVLset.empty + Belt_internalAVLset.empty ]; } } @@ -173,8 +173,8 @@ function split(t, x) { } else { return /* tuple */[ /* tuple */[ - Bs_internalAVLset.empty, - Bs_internalAVLset.empty + Belt_internalAVLset.empty, + Belt_internalAVLset.empty ], /* false */0 ]; @@ -194,7 +194,7 @@ function union(s1, s2) { var v1 = s1.key; var r1 = s1.right; var match = splitAuxNoPivot(s2, v1); - return Bs_internalAVLset.joinShared(union(l1, match[0]), v1, union(r1, match[1])); + return Belt_internalAVLset.joinShared(union(l1, match[0]), v1, union(r1, match[1])); } } else if (h1 === 1) { return add(s2, s1.key); @@ -203,7 +203,7 @@ function union(s1, s2) { var v2 = s2.key; var r2 = s2.right; var match$1 = splitAuxNoPivot(s1, v2); - return Bs_internalAVLset.joinShared(union(match$1[0], l2), v2, union(match$1[1], r2)); + return Belt_internalAVLset.joinShared(union(match$1[0], l2), v2, union(match$1[1], r2)); } } else { return s1; @@ -224,15 +224,15 @@ function intersect(s1, s2) { var ll = intersect(l1, match[0]); var rr = intersect(r1, match[1]); if (pres[0]) { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } else { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } @@ -247,9 +247,9 @@ function diff(s1, s2) { var ll = diff(l1, match[0]); var rr = diff(r1, match[1]); if (pres[0]) { - return Bs_internalAVLset.concatShared(ll, rr); + return Belt_internalAVLset.concatShared(ll, rr); } else { - return Bs_internalAVLset.joinShared(ll, v1, rr); + return Belt_internalAVLset.joinShared(ll, v1, rr); } } else { return s1; @@ -259,67 +259,67 @@ function diff(s1, s2) { } } -var empty = Bs_internalAVLset.empty; +var empty = Belt_internalAVLset.empty; -var ofArray = Bs_internalSetString.ofArray; +var ofArray = Belt_internalSetString.ofArray; -var ofSortedArrayUnsafe = Bs_internalAVLset.ofSortedArrayUnsafe; +var ofSortedArrayUnsafe = Belt_internalAVLset.ofSortedArrayUnsafe; -var isEmpty = Bs_internalAVLset.isEmpty; +var isEmpty = Belt_internalAVLset.isEmpty; -var has = Bs_internalSetString.has; +var has = Belt_internalSetString.has; -var subset = Bs_internalSetString.subset; +var subset = Belt_internalSetString.subset; -var cmp = Bs_internalSetString.cmp; +var cmp = Belt_internalSetString.cmp; -var eq = Bs_internalSetString.eq; +var eq = Belt_internalSetString.eq; -var forEachU = Bs_internalAVLset.forEachU; +var forEachU = Belt_internalAVLset.forEachU; -var forEach = Bs_internalAVLset.forEach; +var forEach = Belt_internalAVLset.forEach; -var reduceU = Bs_internalAVLset.reduceU; +var reduceU = Belt_internalAVLset.reduceU; -var reduce = Bs_internalAVLset.reduce; +var reduce = Belt_internalAVLset.reduce; -var everyU = Bs_internalAVLset.everyU; +var everyU = Belt_internalAVLset.everyU; -var every = Bs_internalAVLset.every; +var every = Belt_internalAVLset.every; -var someU = Bs_internalAVLset.someU; +var someU = Belt_internalAVLset.someU; -var some = Bs_internalAVLset.some; +var some = Belt_internalAVLset.some; -var keepU = Bs_internalAVLset.keepSharedU; +var keepU = Belt_internalAVLset.keepSharedU; -var keep = Bs_internalAVLset.keepShared; +var keep = Belt_internalAVLset.keepShared; -var partitionU = Bs_internalAVLset.partitionSharedU; +var partitionU = Belt_internalAVLset.partitionSharedU; -var partition = Bs_internalAVLset.partitionShared; +var partition = Belt_internalAVLset.partitionShared; -var size = Bs_internalAVLset.size; +var size = Belt_internalAVLset.size; -var toList = Bs_internalAVLset.toList; +var toList = Belt_internalAVLset.toList; -var toArray = Bs_internalAVLset.toArray; +var toArray = Belt_internalAVLset.toArray; -var minimum = Bs_internalAVLset.minimum; +var minimum = Belt_internalAVLset.minimum; -var minUndefined = Bs_internalAVLset.minUndefined; +var minUndefined = Belt_internalAVLset.minUndefined; -var maximum = Bs_internalAVLset.maximum; +var maximum = Belt_internalAVLset.maximum; -var maxUndefined = Bs_internalAVLset.maxUndefined; +var maxUndefined = Belt_internalAVLset.maxUndefined; -var get = Bs_internalSetString.get; +var get = Belt_internalSetString.get; -var getUndefined = Bs_internalSetString.getUndefined; +var getUndefined = Belt_internalSetString.getUndefined; -var getExn = Bs_internalSetString.getExn; +var getExn = Belt_internalSetString.getExn; -var checkInvariantInternal = Bs_internalAVLset.checkInvariantInternal; +var checkInvariantInternal = Belt_internalAVLset.checkInvariantInternal; exports.empty = empty; exports.ofArray = ofArray; diff --git a/lib/js/bs_SortArray.js b/lib/js/belt_SortArray.js similarity index 94% rename from lib/js/bs_SortArray.js rename to lib/js/belt_SortArray.js index 41738cd6f7..68191ac6bd 100644 --- a/lib/js/bs_SortArray.js +++ b/lib/js/belt_SortArray.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_Array = require("./bs_Array.js"); +var Belt_Array = require("./belt_Array.js"); function sortedLengthAuxMore(xs, _prec, _acc, len, lt) { while(true) { @@ -117,7 +117,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else { - return Bs_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); + return Belt_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); } } else { dst[d] = s2; @@ -129,7 +129,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else { - return Bs_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); + return Belt_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); } } }; @@ -161,7 +161,7 @@ function unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else { - Bs_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); + Belt_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); return (d$1 + src2r | 0) - i2 | 0; } } else if (c) { @@ -175,7 +175,7 @@ function unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d$2, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d$2, src1r - i1 | 0); return (d$2 + src1r | 0) - i1 | 0; } } else { @@ -192,10 +192,10 @@ function unionU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else if (i1$2 === src1r) { - Bs_Array.blitUnsafe(src2, i2$2, dst, d$3, src2r - i2$2 | 0); + Belt_Array.blitUnsafe(src2, i2$2, dst, d$3, src2r - i2$2 | 0); return (d$3 + src2r | 0) - i2$2 | 0; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d$3, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d$3, src1r - i1$2 | 0); return (d$3 + src1r | 0) - i1$2 | 0; } } @@ -301,7 +301,7 @@ function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); return (d + src1r | 0) - i1 | 0; } } else { @@ -317,7 +317,7 @@ function diffU(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs, cmp) } else if (i1$2 === src1r) { return d; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); return (d + src1r | 0) - i1$2 | 0; } } @@ -372,7 +372,7 @@ function stableSortInPlaceBy(a, cmp) { } function stableSortByU(a, cmp) { - var b = Bs_Array.copy(a); + var b = Belt_Array.copy(a); stableSortInPlaceByU(b, cmp); return b; } diff --git a/lib/js/bs_SortArrayInt.js b/lib/js/belt_SortArrayInt.js similarity index 93% rename from lib/js/bs_SortArrayInt.js rename to lib/js/belt_SortArrayInt.js index 4d98f5c4d0..23f83fae3b 100644 --- a/lib/js/bs_SortArrayInt.js +++ b/lib/js/belt_SortArrayInt.js @@ -1,6 +1,6 @@ 'use strict'; -var Bs_Array = require("./bs_Array.js"); +var Belt_Array = require("./belt_Array.js"); function sortedLengthAuxMore(xs, _prec, _acc, len) { while(true) { @@ -106,7 +106,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - return Bs_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); + return Belt_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); } } else { dst[d] = s2; @@ -118,7 +118,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - return Bs_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); + return Belt_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); } } }; @@ -149,7 +149,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); + Belt_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); return (d$1 + src2r | 0) - i2 | 0; } } else if (s1 === s2) { @@ -166,10 +166,10 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else if (i1$2 === src1r) { - Bs_Array.blitUnsafe(src2, i2$1, dst, d$2, src2r - i2$1 | 0); + Belt_Array.blitUnsafe(src2, i2$1, dst, d$2, src2r - i2$1 | 0); return (d$2 + src2r | 0) - i2$1 | 0; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d$2, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d$2, src1r - i1$2 | 0); return (d$2 + src1r | 0) - i1$2 | 0; } } else { @@ -183,7 +183,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d$3, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d$3, src1r - i1 | 0); return (d$3 + src1r | 0) - i1 | 0; } } @@ -284,7 +284,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { } else if (i1$2 === src1r) { return d; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); return (d + src1r | 0) - i1$2 | 0; } } else { @@ -295,7 +295,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); return (d + src1r | 0) - i1 | 0; } } @@ -342,7 +342,7 @@ function stableSortInPlace(a) { } function stableSort(a) { - var b = Bs_Array.copy(a); + var b = Belt_Array.copy(a); stableSortInPlace(b); return b; } diff --git a/lib/js/bs_SortArrayString.js b/lib/js/belt_SortArrayString.js similarity index 93% rename from lib/js/bs_SortArrayString.js rename to lib/js/belt_SortArrayString.js index 4d98f5c4d0..23f83fae3b 100644 --- a/lib/js/bs_SortArrayString.js +++ b/lib/js/belt_SortArrayString.js @@ -1,6 +1,6 @@ 'use strict'; -var Bs_Array = require("./bs_Array.js"); +var Belt_Array = require("./belt_Array.js"); function sortedLengthAuxMore(xs, _prec, _acc, len) { while(true) { @@ -106,7 +106,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - return Bs_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); + return Belt_Array.blitUnsafe(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); } } else { dst[d] = s2; @@ -118,7 +118,7 @@ function merge(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - return Bs_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); + return Belt_Array.blitUnsafe(src, i1, dst, d + 1 | 0, src1r - i1 | 0); } } }; @@ -149,7 +149,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); + Belt_Array.blitUnsafe(src2, i2, dst, d$1, src2r - i2 | 0); return (d$1 + src2r | 0) - i2 | 0; } } else if (s1 === s2) { @@ -166,10 +166,10 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else if (i1$2 === src1r) { - Bs_Array.blitUnsafe(src2, i2$1, dst, d$2, src2r - i2$1 | 0); + Belt_Array.blitUnsafe(src2, i2$1, dst, d$2, src2r - i2$1 | 0); return (d$2 + src2r | 0) - i2$1 | 0; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d$2, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d$2, src1r - i1$2 | 0); return (d$2 + src1r | 0) - i1$2 | 0; } } else { @@ -183,7 +183,7 @@ function union(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d$3, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d$3, src1r - i1 | 0); return (d$3 + src1r | 0) - i1 | 0; } } @@ -284,7 +284,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { } else if (i1$2 === src1r) { return d; } else { - Bs_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); + Belt_Array.blitUnsafe(src, i1$2, dst, d, src1r - i1$2 | 0); return (d + src1r | 0) - i1$2 | 0; } } else { @@ -295,7 +295,7 @@ function diff(src, src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { continue ; } else { - Bs_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); + Belt_Array.blitUnsafe(src, i1, dst, d, src1r - i1 | 0); return (d + src1r | 0) - i1 | 0; } } @@ -342,7 +342,7 @@ function stableSortInPlace(a) { } function stableSort(a) { - var b = Bs_Array.copy(a); + var b = Belt_Array.copy(a); stableSortInPlace(b); return b; } diff --git a/lib/js/bs_internalAVLset.js b/lib/js/belt_internalAVLset.js similarity index 99% rename from lib/js/bs_internalAVLset.js rename to lib/js/belt_internalAVLset.js index e30119a485..4febc0712e 100644 --- a/lib/js/bs_internalAVLset.js +++ b/lib/js/belt_internalAVLset.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArray = require("./bs_SortArray.js"); +var Belt_SortArray = require("./belt_SortArray.js"); function height(n) { if (n !== null) { @@ -929,7 +929,7 @@ function addMutate(cmp, t, x) { function ofArray(xs, cmp) { var len = xs.length; if (len) { - var next = Bs_SortArray.strictlySortedLengthU(xs, (function (x, y) { + var next = Belt_SortArray.strictlySortedLengthU(xs, (function (x, y) { return +(cmp(x, y) < 0); })); var result; diff --git a/lib/js/bs_internalAVLtree.js b/lib/js/belt_internalAVLtree.js similarity index 99% rename from lib/js/bs_internalAVLtree.js rename to lib/js/belt_internalAVLtree.js index 17af34595a..d12a6ad04d 100644 --- a/lib/js/bs_internalAVLtree.js +++ b/lib/js/belt_internalAVLtree.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArray = require("./bs_SortArray.js"); +var Belt_SortArray = require("./belt_SortArray.js"); function height(n) { if (n !== null) { @@ -1111,7 +1111,7 @@ function updateMutate(t, x, data, cmp) { function ofArray(xs, cmp) { var len = xs.length; if (len) { - var next = Bs_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { + var next = Belt_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { return +(cmp(param[0], param$1[0]) < 0); })); var result; diff --git a/lib/js/bs_internalBuckets.js b/lib/js/belt_internalBuckets.js similarity index 92% rename from lib/js/bs_internalBuckets.js rename to lib/js/belt_internalBuckets.js index 6eebe8bfe5..0644ed17e4 100644 --- a/lib/js/bs_internalBuckets.js +++ b/lib/js/belt_internalBuckets.js @@ -1,8 +1,8 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_Array = require("./bs_Array.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_Array = require("./belt_Array.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyAuxCont(_c, _prec) { while(true) { @@ -12,7 +12,7 @@ function copyAuxCont(_c, _prec) { var ncopy = { key: c.key, value: c.value, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; prec.next = ncopy; _prec = ncopy; @@ -30,7 +30,7 @@ function copyBucket(c) { var head = { key: c.key, value: c.value, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; copyAuxCont(c.next, head); return head; @@ -127,7 +127,7 @@ function reduce(h, init, f) { } function getMaxBucketLength(h) { - return Bs_Array.reduceU(h.buckets, 0, (function (m, b) { + return Belt_Array.reduceU(h.buckets, 0, (function (m, b) { var len = bucketLength(0, b); if (m > len) { return m; @@ -139,10 +139,10 @@ function getMaxBucketLength(h) { function getBucketHistogram(h) { var mbl = getMaxBucketLength(h); - var histo = Bs_Array.makeByU(mbl + 1 | 0, (function () { + var histo = Belt_Array.makeByU(mbl + 1 | 0, (function () { return 0; })); - Bs_Array.forEachU(h.buckets, (function (b) { + Belt_Array.forEachU(h.buckets, (function (b) { var l = bucketLength(0, b); histo[l] = histo[l] + 1 | 0; return /* () */0; @@ -204,7 +204,7 @@ function keepMapInPlaceU(h, f) { for(var i = 0 ,i_finish = h_buckets.length - 1 | 0; i <= i_finish; ++i){ var v = h_buckets[i]; if (v !== undefined) { - filterMapInplaceBucket(f, h, i, Bs_internalBucketsType.emptyOpt, v); + filterMapInplaceBucket(f, h, i, Belt_internalBucketsType.emptyOpt, v); } } diff --git a/lib/js/bs_internalBucketsType.js b/lib/js/belt_internalBucketsType.js similarity index 90% rename from lib/js/bs_internalBucketsType.js rename to lib/js/belt_internalBucketsType.js index 1918c08398..18b3d9f847 100644 --- a/lib/js/bs_internalBucketsType.js +++ b/lib/js/belt_internalBucketsType.js @@ -18,8 +18,8 @@ function power_2_above(_x, n) { }; } -function make(hash, eq, initialSize) { - var s = power_2_above(16, initialSize); +function make(hash, eq, hintSize) { + var s = power_2_above(16, hintSize); return { size: 0, buckets: new Array(s), diff --git a/lib/js/bs_internalMapInt.js b/lib/js/belt_internalMapInt.js similarity index 73% rename from lib/js/bs_internalMapInt.js rename to lib/js/belt_internalMapInt.js index 33a62f8fd0..b31902253a 100644 --- a/lib/js/bs_internalMapInt.js +++ b/lib/js/belt_internalMapInt.js @@ -1,25 +1,25 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArray = require("./bs_SortArray.js"); +var Belt_SortArray = require("./belt_SortArray.js"); var Caml_primitive = require("./caml_primitive.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function add(t, x, data) { if (t !== null) { var k = t.key; if (x === k) { - return Bs_internalAVLtree.updateValue(t, data); + return Belt_internalAVLtree.updateValue(t, data); } else { var v = t.value; if (x < k) { - return Bs_internalAVLtree.bal(add(t.left, x, data), k, v, t.right); + return Belt_internalAVLtree.bal(add(t.left, x, data), k, v, t.right); } else { - return Bs_internalAVLtree.bal(t.left, k, v, add(t.right, x, data)); + return Belt_internalAVLtree.bal(t.left, k, v, add(t.right, x, data)); } } } else { - return Bs_internalAVLtree.singleton(x, data); + return Belt_internalAVLtree.singleton(x, data); } } @@ -123,8 +123,8 @@ function remove(n, x) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -132,9 +132,9 @@ function remove(n, x) { return r; } } else if (x < v) { - return Bs_internalAVLtree.bal(remove(l, x), v, n.value, r); + return Belt_internalAVLtree.bal(remove(l, x), v, n.value, r); } else { - return Bs_internalAVLtree.bal(l, v, n.value, remove(r, x)); + return Belt_internalAVLtree.bal(l, v, n.value, remove(r, x)); } } else { return n; @@ -158,11 +158,11 @@ function splitAux(x, n) { return /* tuple */[ match[0], match[1], - Bs_internalAVLtree.join(match[2], v, d, r) + Belt_internalAVLtree.join(match[2], v, d, r) ]; } else { return /* tuple */[ - Bs_internalAVLtree.empty, + Belt_internalAVLtree.empty, /* None */0, n ]; @@ -170,7 +170,7 @@ function splitAux(x, n) { } else if (r !== null) { var match$1 = splitAux(x, r); return /* tuple */[ - Bs_internalAVLtree.join(l, v, d, match$1[0]), + Belt_internalAVLtree.join(l, v, d, match$1[0]), match$1[1], match$1[2] ]; @@ -178,7 +178,7 @@ function splitAux(x, n) { return /* tuple */[ n, /* None */0, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty ]; } } @@ -188,9 +188,9 @@ function split(x, n) { return splitAux(x, n); } else { return /* tuple */[ - Bs_internalAVLtree.empty, + Belt_internalAVLtree.empty, /* None */0, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty ]; } } @@ -206,14 +206,14 @@ function mergeU(s1, s2, f) { var d1 = s1.value; var r1 = s1.right; var match = split(v1, s2); - return Bs_internalAVLtree.concatOrJoin(mergeU(l1, match[0], f), v1, f(v1, /* Some */[d1], match[1]), mergeU(r1, match[2], f)); + return Belt_internalAVLtree.concatOrJoin(mergeU(l1, match[0], f), v1, f(v1, /* Some */[d1], match[1]), mergeU(r1, match[2], f)); } else { exit = 1; } } else if (s2 !== null) { exit = 1; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } if (exit === 1) { if (s2 !== null) { @@ -222,7 +222,7 @@ function mergeU(s1, s2, f) { var d2 = s2.value; var r2 = s2.right; var match$1 = split(v2, s1); - return Bs_internalAVLtree.concatOrJoin(mergeU(match$1[0], l2, f), v2, f(v2, match$1[1], /* Some */[d2]), mergeU(match$1[2], r2, f)); + return Belt_internalAVLtree.concatOrJoin(mergeU(match$1[0], l2, f), v2, f(v2, match$1[1], /* Some */[d2]), mergeU(match$1[2], r2, f)); } else { return /* assert false */0; } @@ -250,8 +250,8 @@ function compareAux(_e1, _e2, vcmp) { if (cx) { return cx; } else { - _e2 = Bs_internalAVLtree.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLtree.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLtree.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLtree.stackAllLeft(h1.right, e1[1]); continue ; } @@ -266,10 +266,10 @@ function compareAux(_e1, _e2, vcmp) { } function cmpU(s1, s2, cmp) { - var len1 = Bs_internalAVLtree.size(s1); - var len2 = Bs_internalAVLtree.size(s2); + var len1 = Belt_internalAVLtree.size(s1); + var len2 = Belt_internalAVLtree.size(s2); if (len1 === len2) { - return compareAux(Bs_internalAVLtree.stackAllLeft(s1, /* [] */0), Bs_internalAVLtree.stackAllLeft(s2, /* [] */0), cmp); + return compareAux(Belt_internalAVLtree.stackAllLeft(s1, /* [] */0), Belt_internalAVLtree.stackAllLeft(s2, /* [] */0), cmp); } else if (len1 < len2) { return -1; } else { @@ -290,8 +290,8 @@ function eqAux(_e1, _e2, eq) { var h2 = e2[0]; var h1 = e1[0]; if (h1.key === h2.key && eq(h1.value, h2.value)) { - _e2 = Bs_internalAVLtree.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLtree.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLtree.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLtree.stackAllLeft(h1.right, e1[1]); continue ; } else { @@ -307,10 +307,10 @@ function eqAux(_e1, _e2, eq) { } function eqU(s1, s2, eq) { - var len1 = Bs_internalAVLtree.size(s1); - var len2 = Bs_internalAVLtree.size(s2); + var len1 = Belt_internalAVLtree.size(s1); + var len2 = Belt_internalAVLtree.size(s2); if (len1 === len2) { - return eqAux(Bs_internalAVLtree.stackAllLeft(s1, /* [] */0), Bs_internalAVLtree.stackAllLeft(s2, /* [] */0), eq); + return eqAux(Belt_internalAVLtree.stackAllLeft(s1, /* [] */0), Belt_internalAVLtree.stackAllLeft(s2, /* [] */0), eq); } else { return /* false */0; } @@ -336,25 +336,25 @@ function addMutate(t, x, data) { } else { t.right = addMutate(r, x, data); } - return Bs_internalAVLtree.balMutate(t); + return Belt_internalAVLtree.balMutate(t); } } else { - return Bs_internalAVLtree.singleton(x, data); + return Belt_internalAVLtree.singleton(x, data); } } function ofArray(xs) { var len = xs.length; if (len) { - var next = Bs_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { + var next = Belt_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { return +(param[0] < param$1[0]); })); var result; if (next >= 0) { - result = Bs_internalAVLtree.ofSortedArrayAux(xs, 0, next); + result = Belt_internalAVLtree.ofSortedArrayAux(xs, 0, next); } else { next = -next | 0; - result = Bs_internalAVLtree.ofSortedArrayRevAux(xs, next - 1 | 0, next); + result = Belt_internalAVLtree.ofSortedArrayRevAux(xs, next - 1 | 0, next); } for(var i = next ,i_finish = len - 1 | 0; i <= i_finish; ++i){ var match = xs[i]; @@ -362,7 +362,7 @@ function ofArray(xs) { } return result; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } diff --git a/lib/js/bs_internalMapString.js b/lib/js/belt_internalMapString.js similarity index 73% rename from lib/js/bs_internalMapString.js rename to lib/js/belt_internalMapString.js index 3f149c0a4c..10bebc90d5 100644 --- a/lib/js/bs_internalMapString.js +++ b/lib/js/belt_internalMapString.js @@ -1,25 +1,25 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_SortArray = require("./bs_SortArray.js"); +var Belt_SortArray = require("./belt_SortArray.js"); var Caml_primitive = require("./caml_primitive.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); +var Belt_internalAVLtree = require("./belt_internalAVLtree.js"); function add(t, x, data) { if (t !== null) { var k = t.key; if (x === k) { - return Bs_internalAVLtree.updateValue(t, data); + return Belt_internalAVLtree.updateValue(t, data); } else { var v = t.value; if (x < k) { - return Bs_internalAVLtree.bal(add(t.left, x, data), k, v, t.right); + return Belt_internalAVLtree.bal(add(t.left, x, data), k, v, t.right); } else { - return Bs_internalAVLtree.bal(t.left, k, v, add(t.right, x, data)); + return Belt_internalAVLtree.bal(t.left, k, v, add(t.right, x, data)); } } } else { - return Bs_internalAVLtree.singleton(x, data); + return Belt_internalAVLtree.singleton(x, data); } } @@ -123,8 +123,8 @@ function remove(n, x) { if (r !== null) { var kr = [r.key]; var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); + var r$1 = Belt_internalAVLtree.removeMinAuxWithRef(r, kr, vr); + return Belt_internalAVLtree.bal(l, kr[0], vr[0], r$1); } else { return l; } @@ -132,9 +132,9 @@ function remove(n, x) { return r; } } else if (x < v) { - return Bs_internalAVLtree.bal(remove(l, x), v, n.value, r); + return Belt_internalAVLtree.bal(remove(l, x), v, n.value, r); } else { - return Bs_internalAVLtree.bal(l, v, n.value, remove(r, x)); + return Belt_internalAVLtree.bal(l, v, n.value, remove(r, x)); } } else { return n; @@ -158,11 +158,11 @@ function splitAux(x, n) { return /* tuple */[ match[0], match[1], - Bs_internalAVLtree.join(match[2], v, d, r) + Belt_internalAVLtree.join(match[2], v, d, r) ]; } else { return /* tuple */[ - Bs_internalAVLtree.empty, + Belt_internalAVLtree.empty, /* None */0, n ]; @@ -170,7 +170,7 @@ function splitAux(x, n) { } else if (r !== null) { var match$1 = splitAux(x, r); return /* tuple */[ - Bs_internalAVLtree.join(l, v, d, match$1[0]), + Belt_internalAVLtree.join(l, v, d, match$1[0]), match$1[1], match$1[2] ]; @@ -178,7 +178,7 @@ function splitAux(x, n) { return /* tuple */[ n, /* None */0, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty ]; } } @@ -188,9 +188,9 @@ function split(x, n) { return splitAux(x, n); } else { return /* tuple */[ - Bs_internalAVLtree.empty, + Belt_internalAVLtree.empty, /* None */0, - Bs_internalAVLtree.empty + Belt_internalAVLtree.empty ]; } } @@ -206,14 +206,14 @@ function mergeU(s1, s2, f) { var d1 = s1.value; var r1 = s1.right; var match = split(v1, s2); - return Bs_internalAVLtree.concatOrJoin(mergeU(l1, match[0], f), v1, f(v1, /* Some */[d1], match[1]), mergeU(r1, match[2], f)); + return Belt_internalAVLtree.concatOrJoin(mergeU(l1, match[0], f), v1, f(v1, /* Some */[d1], match[1]), mergeU(r1, match[2], f)); } else { exit = 1; } } else if (s2 !== null) { exit = 1; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } if (exit === 1) { if (s2 !== null) { @@ -222,7 +222,7 @@ function mergeU(s1, s2, f) { var d2 = s2.value; var r2 = s2.right; var match$1 = split(v2, s1); - return Bs_internalAVLtree.concatOrJoin(mergeU(match$1[0], l2, f), v2, f(v2, match$1[1], /* Some */[d2]), mergeU(match$1[2], r2, f)); + return Belt_internalAVLtree.concatOrJoin(mergeU(match$1[0], l2, f), v2, f(v2, match$1[1], /* Some */[d2]), mergeU(match$1[2], r2, f)); } else { return /* assert false */0; } @@ -250,8 +250,8 @@ function compareAux(_e1, _e2, vcmp) { if (cx) { return cx; } else { - _e2 = Bs_internalAVLtree.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLtree.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLtree.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLtree.stackAllLeft(h1.right, e1[1]); continue ; } @@ -266,10 +266,10 @@ function compareAux(_e1, _e2, vcmp) { } function cmpU(s1, s2, cmp) { - var len1 = Bs_internalAVLtree.size(s1); - var len2 = Bs_internalAVLtree.size(s2); + var len1 = Belt_internalAVLtree.size(s1); + var len2 = Belt_internalAVLtree.size(s2); if (len1 === len2) { - return compareAux(Bs_internalAVLtree.stackAllLeft(s1, /* [] */0), Bs_internalAVLtree.stackAllLeft(s2, /* [] */0), cmp); + return compareAux(Belt_internalAVLtree.stackAllLeft(s1, /* [] */0), Belt_internalAVLtree.stackAllLeft(s2, /* [] */0), cmp); } else if (len1 < len2) { return -1; } else { @@ -290,8 +290,8 @@ function eqAux(_e1, _e2, eq) { var h2 = e2[0]; var h1 = e1[0]; if (h1.key === h2.key && eq(h1.value, h2.value)) { - _e2 = Bs_internalAVLtree.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLtree.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLtree.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLtree.stackAllLeft(h1.right, e1[1]); continue ; } else { @@ -307,10 +307,10 @@ function eqAux(_e1, _e2, eq) { } function eqU(s1, s2, eq) { - var len1 = Bs_internalAVLtree.size(s1); - var len2 = Bs_internalAVLtree.size(s2); + var len1 = Belt_internalAVLtree.size(s1); + var len2 = Belt_internalAVLtree.size(s2); if (len1 === len2) { - return eqAux(Bs_internalAVLtree.stackAllLeft(s1, /* [] */0), Bs_internalAVLtree.stackAllLeft(s2, /* [] */0), eq); + return eqAux(Belt_internalAVLtree.stackAllLeft(s1, /* [] */0), Belt_internalAVLtree.stackAllLeft(s2, /* [] */0), eq); } else { return /* false */0; } @@ -336,25 +336,25 @@ function addMutate(t, x, data) { } else { t.right = addMutate(r, x, data); } - return Bs_internalAVLtree.balMutate(t); + return Belt_internalAVLtree.balMutate(t); } } else { - return Bs_internalAVLtree.singleton(x, data); + return Belt_internalAVLtree.singleton(x, data); } } function ofArray(xs) { var len = xs.length; if (len) { - var next = Bs_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { + var next = Belt_SortArray.strictlySortedLengthU(xs, (function (param, param$1) { return +(param[0] < param$1[0]); })); var result; if (next >= 0) { - result = Bs_internalAVLtree.ofSortedArrayAux(xs, 0, next); + result = Belt_internalAVLtree.ofSortedArrayAux(xs, 0, next); } else { next = -next | 0; - result = Bs_internalAVLtree.ofSortedArrayRevAux(xs, next - 1 | 0, next); + result = Belt_internalAVLtree.ofSortedArrayRevAux(xs, next - 1 | 0, next); } for(var i = next ,i_finish = len - 1 | 0; i <= i_finish; ++i){ var match = xs[i]; @@ -362,7 +362,7 @@ function ofArray(xs) { } return result; } else { - return Bs_internalAVLtree.empty; + return Belt_internalAVLtree.empty; } } diff --git a/lib/js/bs_internalSetBuckets.js b/lib/js/belt_internalSetBuckets.js similarity index 90% rename from lib/js/bs_internalSetBuckets.js rename to lib/js/belt_internalSetBuckets.js index 3ca0069eaa..28c94d1e6e 100644 --- a/lib/js/bs_internalSetBuckets.js +++ b/lib/js/belt_internalSetBuckets.js @@ -1,8 +1,8 @@ 'use strict'; var Curry = require("./curry.js"); -var Bs_Array = require("./bs_Array.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); +var Belt_Array = require("./belt_Array.js"); +var Belt_internalBucketsType = require("./belt_internalBucketsType.js"); function copyAuxCont(_c, _prec) { while(true) { @@ -11,7 +11,7 @@ function copyAuxCont(_c, _prec) { if (c !== undefined) { var ncopy = { key: c.key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; prec.next = ncopy; _prec = ncopy; @@ -28,7 +28,7 @@ function copyBucket(c) { if (c !== undefined) { var head = { key: c.key, - next: Bs_internalBucketsType.emptyOpt + next: Belt_internalBucketsType.emptyOpt }; copyAuxCont(c.next, head); return head; @@ -156,7 +156,7 @@ function reduce(h, init, f) { } function getMaxBucketLength(h) { - return Bs_Array.reduceU(h.buckets, 0, (function (m, b) { + return Belt_Array.reduceU(h.buckets, 0, (function (m, b) { var len = bucketLength(0, b); if (m > len) { return m; @@ -168,10 +168,10 @@ function getMaxBucketLength(h) { function getBucketHistogram(h) { var mbl = getMaxBucketLength(h); - var histo = Bs_Array.makeByU(mbl + 1 | 0, (function () { + var histo = Belt_Array.makeByU(mbl + 1 | 0, (function () { return 0; })); - Bs_Array.forEachU(h.buckets, (function (b) { + Belt_Array.forEachU(h.buckets, (function (b) { var l = bucketLength(0, b); histo[l] = histo[l] + 1 | 0; return /* () */0; diff --git a/lib/js/bs_internalSetString.js b/lib/js/belt_internalSetInt.js similarity index 78% rename from lib/js/bs_internalSetString.js rename to lib/js/belt_internalSetInt.js index f8737d11af..b7fb825380 100644 --- a/lib/js/bs_internalSetString.js +++ b/lib/js/belt_internalSetInt.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_SortArrayString = require("./bs_SortArrayString.js"); +var Belt_SortArrayInt = require("./belt_SortArrayInt.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); function has(_t, x) { while(true) { @@ -32,8 +32,8 @@ function compareAux(_e1, _e2) { var k1 = h1.key; var k2 = h2.key; if (k1 === k2) { - _e2 = Bs_internalAVLset.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLset.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLset.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLset.stackAllLeft(h1.right, e1[1]); continue ; } else if (k1 < k2) { @@ -51,10 +51,10 @@ function compareAux(_e1, _e2) { } function cmp(s1, s2) { - var len1 = Bs_internalAVLset.size(s1); - var len2 = Bs_internalAVLset.size(s2); + var len1 = Belt_internalAVLset.size(s1); + var len2 = Belt_internalAVLset.size(s2); if (len1 === len2) { - return compareAux(Bs_internalAVLset.stackAllLeft(s1, /* [] */0), Bs_internalAVLset.stackAllLeft(s2, /* [] */0)); + return compareAux(Belt_internalAVLset.stackAllLeft(s1, /* [] */0), Belt_internalAVLset.stackAllLeft(s2, /* [] */0)); } else if (len1 < len2) { return -1; } else { @@ -88,14 +88,14 @@ function subset(_s1, _s2) { return /* false */0; } } else if (v1 < v2) { - if (subset(Bs_internalAVLset.create(l1, v1, Bs_internalAVLset.empty), l2)) { + if (subset(Belt_internalAVLset.create(l1, v1, Belt_internalAVLset.empty), l2)) { _s1 = r1; continue ; } else { return /* false */0; } - } else if (subset(Bs_internalAVLset.create(Bs_internalAVLset.empty, v1, r1), r2)) { + } else if (subset(Belt_internalAVLset.create(Belt_internalAVLset.empty, v1, r1), r2)) { _s1 = l1; continue ; @@ -178,30 +178,30 @@ function addMutate(t, x) { } else { t.right = addMutate(r, x); } - return Bs_internalAVLset.balMutate(t); + return Belt_internalAVLset.balMutate(t); } } else { - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } function ofArray(xs) { var len = xs.length; if (len) { - var next = Bs_SortArrayString.strictlySortedLength(xs); + var next = Belt_SortArrayInt.strictlySortedLength(xs); var result; if (next >= 0) { - result = Bs_internalAVLset.ofSortedArrayAux(xs, 0, next); + result = Belt_internalAVLset.ofSortedArrayAux(xs, 0, next); } else { next = -next | 0; - result = Bs_internalAVLset.ofSortedArrayRevAux(xs, next - 1 | 0, next); + result = Belt_internalAVLset.ofSortedArrayRevAux(xs, next - 1 | 0, next); } for(var i = next ,i_finish = len - 1 | 0; i <= i_finish; ++i){ result = addMutate(result, xs[i]); } return result; } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } diff --git a/lib/js/bs_internalSetInt.js b/lib/js/belt_internalSetString.js similarity index 78% rename from lib/js/bs_internalSetInt.js rename to lib/js/belt_internalSetString.js index 20ec9be03e..7c85e7bc8a 100644 --- a/lib/js/bs_internalSetInt.js +++ b/lib/js/belt_internalSetString.js @@ -1,7 +1,7 @@ 'use strict'; -var Bs_SortArrayInt = require("./bs_SortArrayInt.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); +var Belt_internalAVLset = require("./belt_internalAVLset.js"); +var Belt_SortArrayString = require("./belt_SortArrayString.js"); function has(_t, x) { while(true) { @@ -32,8 +32,8 @@ function compareAux(_e1, _e2) { var k1 = h1.key; var k2 = h2.key; if (k1 === k2) { - _e2 = Bs_internalAVLset.stackAllLeft(h2.right, e2[1]); - _e1 = Bs_internalAVLset.stackAllLeft(h1.right, e1[1]); + _e2 = Belt_internalAVLset.stackAllLeft(h2.right, e2[1]); + _e1 = Belt_internalAVLset.stackAllLeft(h1.right, e1[1]); continue ; } else if (k1 < k2) { @@ -51,10 +51,10 @@ function compareAux(_e1, _e2) { } function cmp(s1, s2) { - var len1 = Bs_internalAVLset.size(s1); - var len2 = Bs_internalAVLset.size(s2); + var len1 = Belt_internalAVLset.size(s1); + var len2 = Belt_internalAVLset.size(s2); if (len1 === len2) { - return compareAux(Bs_internalAVLset.stackAllLeft(s1, /* [] */0), Bs_internalAVLset.stackAllLeft(s2, /* [] */0)); + return compareAux(Belt_internalAVLset.stackAllLeft(s1, /* [] */0), Belt_internalAVLset.stackAllLeft(s2, /* [] */0)); } else if (len1 < len2) { return -1; } else { @@ -88,14 +88,14 @@ function subset(_s1, _s2) { return /* false */0; } } else if (v1 < v2) { - if (subset(Bs_internalAVLset.create(l1, v1, Bs_internalAVLset.empty), l2)) { + if (subset(Belt_internalAVLset.create(l1, v1, Belt_internalAVLset.empty), l2)) { _s1 = r1; continue ; } else { return /* false */0; } - } else if (subset(Bs_internalAVLset.create(Bs_internalAVLset.empty, v1, r1), r2)) { + } else if (subset(Belt_internalAVLset.create(Belt_internalAVLset.empty, v1, r1), r2)) { _s1 = l1; continue ; @@ -178,30 +178,30 @@ function addMutate(t, x) { } else { t.right = addMutate(r, x); } - return Bs_internalAVLset.balMutate(t); + return Belt_internalAVLset.balMutate(t); } } else { - return Bs_internalAVLset.singleton(x); + return Belt_internalAVLset.singleton(x); } } function ofArray(xs) { var len = xs.length; if (len) { - var next = Bs_SortArrayInt.strictlySortedLength(xs); + var next = Belt_SortArrayString.strictlySortedLength(xs); var result; if (next >= 0) { - result = Bs_internalAVLset.ofSortedArrayAux(xs, 0, next); + result = Belt_internalAVLset.ofSortedArrayAux(xs, 0, next); } else { next = -next | 0; - result = Bs_internalAVLset.ofSortedArrayRevAux(xs, next - 1 | 0, next); + result = Belt_internalAVLset.ofSortedArrayRevAux(xs, next - 1 | 0, next); } for(var i = next ,i_finish = len - 1 | 0; i <= i_finish; ++i){ result = addMutate(result, xs[i]); } return result; } else { - return Bs_internalAVLset.empty; + return Belt_internalAVLset.empty; } } diff --git a/lib/js/bs_Bag.js b/lib/js/bs_Bag.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/bs_Bag.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/bs_BagM.js b/lib/js/bs_BagM.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/bs_BagM.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/bs_Cmp.js b/lib/js/bs_Cmp.js deleted file mode 100644 index 019005b269..0000000000 --- a/lib/js/bs_Cmp.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - - -function make(cmp) { - return /* module */[/* cmp */cmp]; -} - -exports.make = make; -/* No side effect */ diff --git a/lib/js/bs_Hash.js b/lib/js/bs_Hash.js deleted file mode 100644 index 8b17df8d8b..0000000000 --- a/lib/js/bs_Hash.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - - -function make(eq, hash) { - return /* module */[ - /* hash */hash, - /* eq */eq - ]; -} - -exports.make = make; -/* No side effect */ diff --git a/lib/js/bs_HashMultiMap.js b/lib/js/bs_HashMultiMap.js deleted file mode 100644 index 8d726cc032..0000000000 --- a/lib/js/bs_HashMultiMap.js +++ /dev/null @@ -1,319 +0,0 @@ -'use strict'; - -var Bs_internalBuckets = require("./bs_internalBuckets.js"); -var Bs_internalBucketsType = require("./bs_internalBucketsType.js"); - -function size(prim) { - return prim.size; -} - -function copyBucketReHash(hash, h_buckets, ndata_tail, _old_bucket) { - while(true) { - var old_bucket = _old_bucket; - if (old_bucket !== undefined) { - var nidx = hash(old_bucket.key) & (h_buckets.length - 1 | 0); - var match = ndata_tail[nidx]; - if (match !== undefined) { - match.next = old_bucket; - } else { - h_buckets[nidx] = old_bucket; - } - ndata_tail[nidx] = old_bucket; - _old_bucket = old_bucket.next; - continue ; - - } else { - return /* () */0; - } - }; -} - -function resize(hash, h) { - var odata = h.buckets; - var osize = odata.length; - var nsize = (osize << 1); - if (nsize >= osize) { - var h_buckets = new Array(nsize); - var ndata_tail = new Array(nsize); - h.buckets = h_buckets; - for(var i = 0 ,i_finish = osize - 1 | 0; i <= i_finish; ++i){ - copyBucketReHash(hash, h_buckets, ndata_tail, odata[i]); - } - for(var i$1 = 0 ,i_finish$1 = nsize - 1 | 0; i$1 <= i_finish$1; ++i$1){ - var match = ndata_tail[i$1]; - if (match !== undefined) { - match.next = Bs_internalBucketsType.emptyOpt; - } - - } - return /* () */0; - } else { - return 0; - } -} - -function replaceFirst(eq, key, info, _cell) { - while(true) { - var cell = _cell; - if (eq(cell.key, key)) { - cell.value = info; - return /* false */0; - } else { - var match = cell.next; - if (match !== undefined) { - _cell = match; - continue ; - - } else { - return /* true */1; - } - } - }; -} - -function replaceBy(h, key, value, eq, hash) { - var h_buckets = h.buckets; - var buckets_len = h_buckets.length; - var i = hash(key) & (buckets_len - 1 | 0); - var l = h_buckets[i]; - if (l !== undefined) { - if (replaceFirst(eq, key, value, l)) { - h_buckets[i] = { - key: key, - value: value, - next: l - }; - h.size = h.size + 1 | 0; - } - - } else { - h_buckets[i] = { - key: key, - value: value, - next: Bs_internalBucketsType.emptyOpt - }; - h.size = h.size + 1 | 0; - } - if (h.size > (buckets_len << 1)) { - return resize(hash, h); - } else { - return 0; - } -} - -function replace(h, key, value) { - return replaceBy(h, key, value, h.eq, h.hash); -} - -function remove(h, key) { - var h_buckets = h.buckets; - var i = h.hash(key) & (h_buckets.length - 1 | 0); - var bucket = h_buckets[i]; - if (bucket !== undefined) { - var eq = h.eq; - if (eq(bucket.key, key)) { - h_buckets[i] = bucket.next; - h.size = h.size - 1 | 0; - return /* () */0; - } else { - var h$1 = h; - var key$1 = key; - var _prec = bucket; - var _bucket = bucket.next; - var eq$1 = eq; - while(true) { - var bucket$1 = _bucket; - var prec = _prec; - if (bucket$1 !== undefined) { - var cell_next = bucket$1.next; - if (eq$1(bucket$1.key, key$1)) { - prec.next = cell_next; - h$1.size = h$1.size - 1 | 0; - return /* () */0; - } else { - _bucket = cell_next; - _prec = bucket$1; - continue ; - - } - } else { - return /* () */0; - } - }; - } - } else { - return /* () */0; - } -} - -function get(h, key) { - var h_buckets = h.buckets; - var nid = h.hash(key) & (h_buckets.length - 1 | 0); - var match = h_buckets[nid]; - if (match !== undefined) { - var eq = h.eq; - if (eq(key, match.key)) { - return /* Some */[match.value]; - } else { - var match$1 = match.next; - if (match$1 !== undefined) { - if (eq(key, match$1.key)) { - return /* Some */[match$1.value]; - } else { - var match$2 = match$1.next; - if (match$2 !== undefined) { - if (eq(key, match$2.key)) { - return /* Some */[match$2.value]; - } else { - var eq$1 = eq; - var key$1 = key; - var _buckets = match$2.next; - while(true) { - var buckets = _buckets; - if (buckets !== undefined) { - if (eq$1(key$1, buckets.key)) { - return /* Some */[buckets.value]; - } else { - _buckets = buckets.next; - continue ; - - } - } else { - return /* None */0; - } - }; - } - } else { - return /* None */0; - } - } - } else { - return /* None */0; - } - } - } else { - return /* None */0; - } -} - -function has(h, key) { - var h_buckets = h.buckets; - var nid = h.hash(key) & (h_buckets.length - 1 | 0); - var bucket = h_buckets[nid]; - if (bucket !== undefined) { - var key$1 = key; - var _cell = bucket; - var eq = h.eq; - while(true) { - var cell = _cell; - if (eq(cell.key, key$1)) { - return /* true */1; - } else { - var match = cell.next; - if (match !== undefined) { - _cell = match; - continue ; - - } else { - return /* false */0; - } - } - }; - } else { - return /* false */0; - } -} - -function make(initialize_size, dict) { - return Bs_internalBucketsType.make(dict[/* hash */0], dict[/* eq */1], initialize_size); -} - -function add0(h, key, value, hash) { - var h_buckets = h.buckets; - var buckets_lenth = h_buckets.length; - var i = hash(key) & (buckets_lenth - 1 | 0); - var bucket = { - key: key, - value: value, - next: h_buckets[i] - }; - h_buckets[i] = bucket; - var h_new_size = h.size + 1 | 0; - h.size = h_new_size; - if (h_new_size > (buckets_lenth << 1)) { - return resize(hash, h); - } else { - return 0; - } -} - -function add(h, key, info) { - return add0(h, key, info, h.hash); -} - -function ofArray(arr, dict) { - var hash = dict[/* hash */0]; - var eq = dict[/* eq */1]; - var len = arr.length; - var v = Bs_internalBucketsType.make(hash, eq, len); - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var match = arr[i]; - add0(v, match[0], match[1], hash); - } - return v; -} - -function mergeMany(h, arr) { - var hash = h.hash; - var len = arr.length; - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var match = arr[i]; - add0(h, match[0], match[1], hash); - } - return /* () */0; -} - -var clear = Bs_internalBucketsType.clear; - -var isEmpty = Bs_internalBucketsType.isEmpty; - -var copy = Bs_internalBuckets.copy; - -var forEach = Bs_internalBuckets.forEach; - -var reduce = Bs_internalBuckets.reduce; - -var keepMapInPlace = Bs_internalBuckets.keepMapInPlace; - -var toArray = Bs_internalBuckets.toArray; - -var keysToArray = Bs_internalBuckets.keysToArray; - -var valuesToArray = Bs_internalBuckets.valuesToArray; - -var getBucketHistogram = Bs_internalBuckets.getBucketHistogram; - -var logStats = Bs_internalBuckets.logStats; - -exports.make = make; -exports.clear = clear; -exports.isEmpty = isEmpty; -exports.add = add; -exports.replace = replace; -exports.replaceBy = replaceBy; -exports.copy = copy; -exports.get = get; -exports.has = has; -exports.remove = remove; -exports.forEach = forEach; -exports.reduce = reduce; -exports.keepMapInPlace = keepMapInPlace; -exports.size = size; -exports.toArray = toArray; -exports.keysToArray = keysToArray; -exports.valuesToArray = valuesToArray; -exports.ofArray = ofArray; -exports.mergeMany = mergeMany; -exports.getBucketHistogram = getBucketHistogram; -exports.logStats = logStats; -/* No side effect */ diff --git a/lib/js/bs_MapIntM.js b/lib/js/bs_MapIntM.js deleted file mode 100644 index fded5259c1..0000000000 --- a/lib/js/bs_MapIntM.js +++ /dev/null @@ -1,333 +0,0 @@ -'use strict'; - -var Bs_internalMapInt = require("./bs_internalMapInt.js"); -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); - -function make() { - return { - data: Bs_internalAVLtree.empty - }; -} - -function isEmpty(m) { - return Bs_internalAVLtree.isEmpty(m.data); -} - -function clear(m) { - m.data = Bs_internalAVLtree.empty; - return /* () */0; -} - -function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); -} - -function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); -} - -function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); -} - -function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); -} - -function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); -} - -function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); -} - -function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); -} - -function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); -} - -function set(m, k, v) { - var old_data = m.data; - var v$1 = Bs_internalMapInt.addMutate(old_data, k, v); - if (v$1 !== old_data) { - m.data = v$1; - return /* () */0; - } else { - return 0; - } -} - -function forEach(d, f) { - return Bs_internalAVLtree.forEach(d.data, f); -} - -function map(d, f) { - return { - data: Bs_internalAVLtree.map(d.data, f) - }; -} - -function mapWithKey(d, f) { - return { - data: Bs_internalAVLtree.mapWithKey(d.data, f) - }; -} - -function reduce(d, acc, f) { - return Bs_internalAVLtree.reduce(d.data, acc, f); -} - -function every(d, f) { - return Bs_internalAVLtree.every(d.data, f); -} - -function some(d, f) { - return Bs_internalAVLtree.some(d.data, f); -} - -function size(d) { - return Bs_internalAVLtree.size(d.data); -} - -function toList(d) { - return Bs_internalAVLtree.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); -} - -function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); -} - -function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); -} - -function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); -} - -function has(d, v) { - return Bs_internalMapInt.has(d.data, v); -} - -function removeMutateAux(nt, x) { - var k = nt.key; - if (x === k) { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = removeMutateAux(match, x); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeMutateAux(match$1, x); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } -} - -function remove(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = removeMutateAux(oldRoot, v); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function updateDone(t, x, f) { - if (t !== null) { - var k = t.key; - if (k === x) { - var match = f(/* Some */[t.value]); - if (match) { - t.value = match[0]; - return t; - } else { - var l = t.left; - var r = t.right; - if (l !== null) { - if (r !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r); - return Bs_internalAVLtree.balMutate(t); - } else { - return l; - } - } else { - return r; - } - } - } else { - var l$1 = t.left; - var r$1 = t.right; - if (x < k) { - var ll = updateDone(l$1, x, f); - t.left = ll; - } else { - t.right = updateDone(r$1, x, f); - } - return Bs_internalAVLtree.balMutate(t); - } - } else { - var match$1 = f(/* None */0); - if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); - } else { - return t; - } - } -} - -function update(t, x, f) { - var oldRoot = t.data; - var newRoot = updateDone(oldRoot, x, f); - if (newRoot !== oldRoot) { - t.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -function removeArrayMutateAux(_t, xs, _i, len) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = removeMutateAux(t, ele); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLtree.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - var newRoot = removeArrayMutateAux(oldRoot, xs, 0, len); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function ofArray(xs) { - return { - data: Bs_internalMapInt.ofArray(xs) - }; -} - -function cmp(d0, d1) { - var partial_arg = d1.data; - var partial_arg$1 = d0.data; - return (function (param) { - return Bs_internalMapInt.cmp(partial_arg$1, partial_arg, param); - }); -} - -function eq(d0, d1) { - var partial_arg = d1.data; - var partial_arg$1 = d0.data; - return (function (param) { - return Bs_internalMapInt.eq(partial_arg$1, partial_arg, param); - }); -} - -function get(d, x) { - return Bs_internalMapInt.get(d.data, x); -} - -function getUndefined(d, x) { - return Bs_internalMapInt.getUndefined(d.data, x); -} - -function getWithDefault(d, x, def) { - return Bs_internalMapInt.getWithDefault(d.data, x, def); -} - -function getExn(d, x) { - return Bs_internalMapInt.getExn(d.data, x); -} - -exports.make = make; -exports.clear = clear; -exports.isEmpty = isEmpty; -exports.has = has; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.ofArray = ofArray; -exports.keysToArray = keysToArray; -exports.valuesToArray = valuesToArray; -exports.minKey = minKey; -exports.minKeyUndefined = minKeyUndefined; -exports.maxKey = maxKey; -exports.maxKeyUndefined = maxKeyUndefined; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getWithDefault = getWithDefault; -exports.getExn = getExn; -exports.checkInvariantInternal = checkInvariantInternal; -exports.remove = remove; -exports.removeMany = removeMany; -exports.set = set; -exports.update = update; -exports.map = map; -exports.mapWithKey = mapWithKey; -/* No side effect */ diff --git a/lib/js/bs_MapM.js b/lib/js/bs_MapM.js deleted file mode 100644 index d6491f9268..0000000000 --- a/lib/js/bs_MapM.js +++ /dev/null @@ -1,364 +0,0 @@ -'use strict'; - -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); - -function removeMutateAux(nt, x, cmp) { - var k = nt.key; - var c = cmp(x, k); - if (c) { - if (c < 0) { - var match = nt.left; - if (match !== null) { - nt.left = removeMutateAux(match, x, cmp); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeMutateAux(match$1, x, cmp); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } - } else { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); - } else { - return l; - } - } else if (r !== null) { - return r; - } else { - return l; - } - } -} - -function remove(d, k) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = removeMutateAux(oldRoot, k, d.cmp); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function removeArrayMutateAux(_t, xs, _i, len, cmp) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = removeMutateAux(t, ele, cmp); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLtree.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - var newRoot = removeArrayMutateAux(oldRoot, xs, 0, len, d.cmp); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function updateDone(t, x, f, cmp) { - if (t !== null) { - var k = t.key; - var c = cmp(x, k); - if (c) { - var l = t.left; - var r = t.right; - if (c < 0) { - var ll = updateDone(l, x, f, cmp); - t.left = ll; - } else { - t.right = updateDone(r, x, f, cmp); - } - return Bs_internalAVLtree.balMutate(t); - } else { - var match = f(/* Some */[t.value]); - if (match) { - t.value = match[0]; - return t; - } else { - var l$1 = t.left; - var r$1 = t.right; - if (l$1 !== null) { - if (r$1 !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r$1); - return Bs_internalAVLtree.balMutate(t); - } else { - return l$1; - } - } else if (r$1 !== null) { - return r$1; - } else { - return l$1; - } - } - } - } else { - var match$1 = f(/* None */0); - if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); - } else { - return t; - } - } -} - -function update(t, x, f) { - var oldRoot = t.data; - var newRoot = updateDone(oldRoot, x, f, t.cmp); - if (newRoot !== oldRoot) { - t.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -function make(dict) { - return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLtree.empty - }; -} - -function clear(m) { - m.data = Bs_internalAVLtree.empty; - return /* () */0; -} - -function isEmpty(d) { - return Bs_internalAVLtree.isEmpty(d.data); -} - -function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); -} - -function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); -} - -function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); -} - -function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); -} - -function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); -} - -function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); -} - -function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); -} - -function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); -} - -function forEach(d, f) { - return Bs_internalAVLtree.forEach(d.data, f); -} - -function reduce(d, acc, cb) { - return Bs_internalAVLtree.reduce(d.data, acc, cb); -} - -function every(d, p) { - return Bs_internalAVLtree.every(d.data, p); -} - -function some(d, p) { - return Bs_internalAVLtree.some(d.data, p); -} - -function size(d) { - return Bs_internalAVLtree.size(d.data); -} - -function toList(d) { - return Bs_internalAVLtree.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); -} - -function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); -} - -function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); -} - -function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); -} - -function cmp(m1, m2, cmp$1) { - return Bs_internalAVLtree.cmp(m1.data, m2.data, m1.cmp, cmp$1); -} - -function eq(m1, m2, cmp) { - return Bs_internalAVLtree.eq(m1.data, m2.data, m1.cmp, cmp); -} - -function map(m, f) { - return { - cmp: m.cmp, - data: Bs_internalAVLtree.map(m.data, f) - }; -} - -function mapWithKey(m, f) { - return { - cmp: m.cmp, - data: Bs_internalAVLtree.mapWithKey(m.data, f) - }; -} - -function get(m, x) { - return Bs_internalAVLtree.get(m.data, x, m.cmp); -} - -function getUndefined(m, x) { - return Bs_internalAVLtree.getUndefined(m.data, x, m.cmp); -} - -function getWithDefault(m, x, def) { - return Bs_internalAVLtree.getWithDefault(m.data, x, def, m.cmp); -} - -function getExn(m, x) { - return Bs_internalAVLtree.getExn(m.data, x, m.cmp); -} - -function has(m, x) { - return Bs_internalAVLtree.has(m.data, x, m.cmp); -} - -function ofArray(data, dict) { - var cmp = dict[/* cmp */0]; - return { - cmp: cmp, - data: Bs_internalAVLtree.ofArray(data, cmp) - }; -} - -function set(m, e, v) { - var oldRoot = m.data; - var newRoot = Bs_internalAVLtree.updateMutate(oldRoot, e, v, m.cmp); - if (newRoot !== oldRoot) { - m.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -function mergeArrayAux(t, xs, cmp) { - var v = t; - for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - var match = xs[i]; - v = Bs_internalAVLtree.updateMutate(v, match[0], match[1], cmp); - } - return v; -} - -function mergeMany(d, xs) { - var oldRoot = d.data; - var newRoot = mergeArrayAux(oldRoot, xs, d.cmp); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -var Int = 0; - -var $$String = 0; - -exports.make = make; -exports.clear = clear; -exports.isEmpty = isEmpty; -exports.has = has; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.ofArray = ofArray; -exports.keysToArray = keysToArray; -exports.valuesToArray = valuesToArray; -exports.minKey = minKey; -exports.minKeyUndefined = minKeyUndefined; -exports.maxKey = maxKey; -exports.maxKeyUndefined = maxKeyUndefined; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getWithDefault = getWithDefault; -exports.getExn = getExn; -exports.checkInvariantInternal = checkInvariantInternal; -exports.remove = remove; -exports.removeMany = removeMany; -exports.set = set; -exports.update = update; -exports.mergeMany = mergeMany; -exports.map = map; -exports.mapWithKey = mapWithKey; -exports.Int = Int; -exports.$$String = $$String; -/* No side effect */ diff --git a/lib/js/bs_MapStringM.js b/lib/js/bs_MapStringM.js deleted file mode 100644 index 759d319f4e..0000000000 --- a/lib/js/bs_MapStringM.js +++ /dev/null @@ -1,333 +0,0 @@ -'use strict'; - -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); -var Bs_internalMapString = require("./bs_internalMapString.js"); - -function make() { - return { - data: Bs_internalAVLtree.empty - }; -} - -function isEmpty(m) { - return Bs_internalAVLtree.isEmpty(m.data); -} - -function clear(m) { - m.data = Bs_internalAVLtree.empty; - return /* () */0; -} - -function minKeyUndefined(m) { - return Bs_internalAVLtree.minKeyUndefined(m.data); -} - -function minKey(m) { - return Bs_internalAVLtree.minKey(m.data); -} - -function maxKeyUndefined(m) { - return Bs_internalAVLtree.maxKeyUndefined(m.data); -} - -function maxKey(m) { - return Bs_internalAVLtree.maxKey(m.data); -} - -function minimum(m) { - return Bs_internalAVLtree.minimum(m.data); -} - -function minUndefined(m) { - return Bs_internalAVLtree.minUndefined(m.data); -} - -function maximum(m) { - return Bs_internalAVLtree.maximum(m.data); -} - -function maxUndefined(m) { - return Bs_internalAVLtree.maxUndefined(m.data); -} - -function set(m, k, v) { - var old_data = m.data; - var v$1 = Bs_internalMapString.addMutate(old_data, k, v); - if (v$1 !== old_data) { - m.data = v$1; - return /* () */0; - } else { - return 0; - } -} - -function forEach(d, f) { - return Bs_internalAVLtree.forEach(d.data, f); -} - -function map(d, f) { - return { - data: Bs_internalAVLtree.map(d.data, f) - }; -} - -function mapWithKey(d, f) { - return { - data: Bs_internalAVLtree.mapWithKey(d.data, f) - }; -} - -function reduce(d, acc, f) { - return Bs_internalAVLtree.reduce(d.data, acc, f); -} - -function every(d, f) { - return Bs_internalAVLtree.every(d.data, f); -} - -function some(d, f) { - return Bs_internalAVLtree.some(d.data, f); -} - -function size(d) { - return Bs_internalAVLtree.size(d.data); -} - -function toList(d) { - return Bs_internalAVLtree.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLtree.toArray(d.data); -} - -function keysToArray(d) { - return Bs_internalAVLtree.keysToArray(d.data); -} - -function valuesToArray(d) { - return Bs_internalAVLtree.valuesToArray(d.data); -} - -function checkInvariantInternal(d) { - return Bs_internalAVLtree.checkInvariantInternal(d.data); -} - -function has(d, v) { - return Bs_internalMapString.has(d.data, v); -} - -function removeMutateAux(nt, x) { - var k = nt.key; - if (x === k) { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLtree.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = removeMutateAux(match, x); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeMutateAux(match$1, x); - return Bs_internalAVLtree.balMutate(nt); - } else { - return nt; - } - } -} - -function remove(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = removeMutateAux(oldRoot, v); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function updateDone(t, x, f) { - if (t !== null) { - var k = t.key; - if (k === x) { - var match = f(/* Some */[t.value]); - if (match) { - t.value = match[0]; - return t; - } else { - var l = t.left; - var r = t.right; - if (l !== null) { - if (r !== null) { - t.right = Bs_internalAVLtree.removeMinAuxWithRootMutate(t, r); - return Bs_internalAVLtree.balMutate(t); - } else { - return l; - } - } else { - return r; - } - } - } else { - var l$1 = t.left; - var r$1 = t.right; - if (x < k) { - var ll = updateDone(l$1, x, f); - t.left = ll; - } else { - t.right = updateDone(r$1, x, f); - } - return Bs_internalAVLtree.balMutate(t); - } - } else { - var match$1 = f(/* None */0); - if (match$1) { - return Bs_internalAVLtree.singleton(x, match$1[0]); - } else { - return t; - } - } -} - -function update(t, x, f) { - var oldRoot = t.data; - var newRoot = updateDone(oldRoot, x, f); - if (newRoot !== oldRoot) { - t.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -function removeArrayMutateAux(_t, xs, _i, len) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = removeMutateAux(t, ele); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLtree.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - var newRoot = removeArrayMutateAux(oldRoot, xs, 0, len); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function ofArray(xs) { - return { - data: Bs_internalMapString.ofArray(xs) - }; -} - -function cmp(d0, d1) { - var partial_arg = d1.data; - var partial_arg$1 = d0.data; - return (function (param) { - return Bs_internalMapString.cmp(partial_arg$1, partial_arg, param); - }); -} - -function eq(d0, d1) { - var partial_arg = d1.data; - var partial_arg$1 = d0.data; - return (function (param) { - return Bs_internalMapString.eq(partial_arg$1, partial_arg, param); - }); -} - -function get(d, x) { - return Bs_internalMapString.get(d.data, x); -} - -function getUndefined(d, x) { - return Bs_internalMapString.getUndefined(d.data, x); -} - -function getWithDefault(d, x, def) { - return Bs_internalMapString.getWithDefault(d.data, x, def); -} - -function getExn(d, x) { - return Bs_internalMapString.getExn(d.data, x); -} - -exports.make = make; -exports.clear = clear; -exports.isEmpty = isEmpty; -exports.has = has; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.ofArray = ofArray; -exports.keysToArray = keysToArray; -exports.valuesToArray = valuesToArray; -exports.minKey = minKey; -exports.minKeyUndefined = minKeyUndefined; -exports.maxKey = maxKey; -exports.maxKeyUndefined = maxKeyUndefined; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getWithDefault = getWithDefault; -exports.getExn = getExn; -exports.checkInvariantInternal = checkInvariantInternal; -exports.remove = remove; -exports.removeMany = removeMany; -exports.set = set; -exports.update = update; -exports.map = map; -exports.mapWithKey = mapWithKey; -/* No side effect */ diff --git a/lib/js/bs_Queue.js b/lib/js/bs_Queue.js deleted file mode 100644 index 90ea9129dc..0000000000 --- a/lib/js/bs_Queue.js +++ /dev/null @@ -1,295 +0,0 @@ -'use strict'; - - -var $$null = null; - -function make() { - return { - length: 0, - first: $$null, - last: $$null - }; -} - -function clear(q) { - q.length = 0; - q.first = $$null; - q.last = $$null; - return /* () */0; -} - -function add(q, x) { - var cell = { - content: x, - next: $$null - }; - var match = q.last; - if (match !== null) { - q.length = q.length + 1 | 0; - match.next = cell; - q.last = cell; - return /* () */0; - } else { - q.length = 1; - q.first = cell; - q.last = cell; - return /* () */0; - } -} - -function peek(q) { - var match = q.first; - if (match !== null) { - return /* Some */[match.content]; - } else { - return /* None */0; - } -} - -function peekUndefined(q) { - var match = q.first; - if (match !== null) { - return match.content; - } else { - return undefined; - } -} - -function peekExn(q) { - var match = q.first; - if (match !== null) { - return match.content; - } else { - throw new Error("Bs.Queue.Empty"); - } -} - -function pop(q) { - var match = q.first; - if (match !== null) { - var next = match.next; - if (next === null) { - clear(q); - return /* Some */[match.content]; - } else { - q.length = q.length - 1 | 0; - q.first = next; - return /* Some */[match.content]; - } - } else { - return /* None */0; - } -} - -function popExn(q) { - var match = q.first; - if (match !== null) { - var next = match.next; - if (next === null) { - clear(q); - return match.content; - } else { - q.length = q.length - 1 | 0; - q.first = next; - return match.content; - } - } else { - throw new Error("Bs.Queue.Empty"); - } -} - -function popUndefined(q) { - var match = q.first; - if (match !== null) { - var next = match.next; - if (next === null) { - clear(q); - return match.content; - } else { - q.length = q.length - 1 | 0; - q.first = next; - return match.content; - } - } else { - return undefined; - } -} - -function copy(q) { - var qRes = { - length: q.length, - first: $$null, - last: $$null - }; - var _prev = $$null; - var _cell = q.first; - while(true) { - var cell = _cell; - var prev = _prev; - if (cell !== null) { - var content = cell.content; - var res = { - content: content, - next: $$null - }; - if (prev !== null) { - prev.next = res; - } else { - qRes.first = res; - } - _cell = cell.next; - _prev = res; - continue ; - - } else { - qRes.last = prev; - return qRes; - } - }; -} - -function map(q, f) { - var qRes = { - length: q.length, - first: $$null, - last: $$null - }; - var _prev = $$null; - var _cell = q.first; - var f$1 = f; - while(true) { - var cell = _cell; - var prev = _prev; - if (cell !== null) { - var content = f$1(cell.content); - var res = { - content: content, - next: $$null - }; - if (prev !== null) { - prev.next = res; - } else { - qRes.first = res; - } - _cell = cell.next; - _prev = res; - continue ; - - } else { - qRes.last = prev; - return qRes; - } - }; -} - -function isEmpty(q) { - return +(q.length === 0); -} - -function size(q) { - return q.length; -} - -function forEach(q, f) { - var _cell = q.first; - var f$1 = f; - while(true) { - var cell = _cell; - if (cell !== null) { - f$1(cell.content); - _cell = cell.next; - continue ; - - } else { - return /* () */0; - } - }; -} - -function reduce(q, accu, f) { - var f$1 = f; - var _accu = accu; - var _cell = q.first; - while(true) { - var cell = _cell; - var accu$1 = _accu; - if (cell !== null) { - var accu$2 = f$1(accu$1, cell.content); - _cell = cell.next; - _accu = accu$2; - continue ; - - } else { - return accu$1; - } - }; -} - -function transfer(q1, q2) { - if (q1.length > 0) { - var match = q2.last; - if (match !== null) { - q2.length = q2.length + q1.length | 0; - match.next = q1.first; - q2.last = q1.last; - return clear(q1); - } else { - q2.length = q1.length; - q2.first = q1.first; - q2.last = q1.last; - return clear(q1); - } - } else { - return 0; - } -} - -function fillAux(_i, arr, _cell) { - while(true) { - var cell = _cell; - var i = _i; - if (cell !== null) { - arr[i] = cell.content; - _cell = cell.next; - _i = i + 1 | 0; - continue ; - - } else { - return /* () */0; - } - }; -} - -function toArray(x) { - var v = new Array(x.length); - fillAux(0, v, x.first); - return v; -} - -function ofArray(arr) { - var q = make(/* () */0); - for(var i = 0 ,i_finish = arr.length - 1 | 0; i <= i_finish; ++i){ - add(q, arr[i]); - } - return q; -} - -exports.make = make; -exports.clear = clear; -exports.isEmpty = isEmpty; -exports.ofArray = ofArray; -exports.add = add; -exports.peek = peek; -exports.peekUndefined = peekUndefined; -exports.peekExn = peekExn; -exports.pop = pop; -exports.popUndefined = popUndefined; -exports.popExn = popExn; -exports.copy = copy; -exports.size = size; -exports.map = map; -exports.forEach = forEach; -exports.reduce = reduce; -exports.transfer = transfer; -exports.toArray = toArray; -/* No side effect */ diff --git a/lib/js/bs_SetIntM.js b/lib/js/bs_SetIntM.js deleted file mode 100644 index 2ed7870798..0000000000 --- a/lib/js/bs_SetIntM.js +++ /dev/null @@ -1,485 +0,0 @@ -'use strict'; - -var Bs_SortArrayInt = require("./bs_SortArrayInt.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_internalSetInt = require("./bs_internalSetInt.js"); - -function remove0(nt, x) { - var k = nt.key; - if (x === k) { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = remove0(match, x); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = remove0(match$1, x); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } -} - -function remove(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = remove0(oldRoot, v); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function removeMany0(_t, xs, _i, len) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = remove0(t, ele); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLset.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - d.data = removeMany0(oldRoot, xs, 0, len); - return /* () */0; - } else { - return /* () */0; - } -} - -function removeCheck0(nt, x, removed) { - var k = nt.key; - if (x === k) { - removed[0] = /* true */1; - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = removeCheck0(match, x, removed); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeCheck0(match$1, x, removed); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } -} - -function removeCheck(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var removed = [/* false */0]; - var newRoot = removeCheck0(oldRoot, v, removed); - if (newRoot !== oldRoot) { - d.data = newRoot; - } - return removed[0]; - } else { - return /* false */0; - } -} - -function addCheck0(t, x, added) { - if (t !== null) { - var k = t.key; - if (x === k) { - return t; - } else { - var l = t.left; - var r = t.right; - if (x < k) { - var ll = addCheck0(l, x, added); - t.left = ll; - } else { - t.right = addCheck0(r, x, added); - } - return Bs_internalAVLset.balMutate(t); - } - } else { - added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); - } -} - -function addCheck(m, e) { - var oldRoot = m.data; - var added = [/* false */0]; - var newRoot = addCheck0(oldRoot, e, added); - if (newRoot !== oldRoot) { - m.data = newRoot; - } - return added[0]; -} - -function add(d, k) { - var oldRoot = d.data; - var v = Bs_internalSetInt.addMutate(oldRoot, k); - if (v !== oldRoot) { - d.data = v; - return /* () */0; - } else { - return 0; - } -} - -function addArrayMutate(t, xs) { - var v = t; - for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalSetInt.addMutate(v, xs[i]); - } - return v; -} - -function mergeMany(d, arr) { - d.data = addArrayMutate(d.data, arr); - return /* () */0; -} - -function make() { - return { - data: Bs_internalAVLset.empty - }; -} - -function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); -} - -function minimum(d) { - return Bs_internalAVLset.minimum(d.data); -} - -function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); -} - -function maximum(d) { - return Bs_internalAVLset.maximum(d.data); -} - -function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); -} - -function forEach(d, f) { - return Bs_internalAVLset.forEach(d.data, f); -} - -function reduce(d, acc, cb) { - return Bs_internalAVLset.reduce(d.data, acc, cb); -} - -function every(d, p) { - return Bs_internalAVLset.every(d.data, p); -} - -function some(d, p) { - return Bs_internalAVLset.some(d.data, p); -} - -function size(d) { - return Bs_internalAVLset.size(d.data); -} - -function toList(d) { - return Bs_internalAVLset.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLset.toArray(d.data); -} - -function ofSortedArrayUnsafe(xs) { - return { - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) - }; -} - -function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); -} - -function ofArray(xs) { - return { - data: Bs_internalSetInt.ofArray(xs) - }; -} - -function cmp(d0, d1) { - return Bs_internalSetInt.cmp(d0.data, d1.data); -} - -function eq(d0, d1) { - return Bs_internalSetInt.eq(d0.data, d1.data); -} - -function get(d, x) { - return Bs_internalSetInt.get(d.data, x); -} - -function getUndefined(d, x) { - return Bs_internalSetInt.getUndefined(d.data, x); -} - -function getExn(d, x) { - return Bs_internalSetInt.getExn(d.data, x); -} - -function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); - var i = Bs_SortArrayInt.binarySearch(arr, key); - var len = arr.length; - if (i < 0) { - var next = (-i | 0) - 1 | 0; - return /* tuple */[ - /* tuple */[ - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) - }, - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) - } - ], - /* false */0 - ]; - } else { - return /* tuple */[ - /* tuple */[ - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) - }, - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) - } - ], - /* true */1 - ]; - } -} - -function keep(d, p) { - return { - data: Bs_internalAVLset.filterCopy(d.data, p) - }; -} - -function partition(d, p) { - var match = Bs_internalAVLset.partitionCopy(d.data, p); - return /* tuple */[ - { - data: match[0] - }, - { - data: match[1] - } - ]; -} - -function subset(a, b) { - return Bs_internalSetInt.subset(a.data, b.data); -} - -function intersect(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { - return { - data: Bs_internalAVLset.empty - }; - } else { - var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArrayInt.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } -} - -function diff(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } else { - var tmp2 = new Array(sizea); - var k = Bs_SortArrayInt.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } -} - -function union(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea]) { - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) - }; - } else { - var tmp2 = new Array(totalSize); - var k = Bs_SortArrayInt.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(datab$1) - }; - } -} - -function has(d, x) { - return Bs_internalSetInt.has(d.data, x); -} - -function copy(d) { - return { - data: Bs_internalAVLset.copy(d.data) - }; -} - -exports.make = make; -exports.ofArray = ofArray; -exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; -exports.copy = copy; -exports.isEmpty = isEmpty; -exports.has = has; -exports.add = add; -exports.addCheck = addCheck; -exports.mergeMany = mergeMany; -exports.remove = remove; -exports.removeCheck = removeCheck; -exports.removeMany = removeMany; -exports.union = union; -exports.intersect = intersect; -exports.diff = diff; -exports.subset = subset; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.keep = keep; -exports.partition = partition; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getExn = getExn; -exports.split = split; -exports.checkInvariantInternal = checkInvariantInternal; -/* No side effect */ diff --git a/lib/js/bs_SetM.js b/lib/js/bs_SetM.js deleted file mode 100644 index efad417d82..0000000000 --- a/lib/js/bs_SetM.js +++ /dev/null @@ -1,526 +0,0 @@ -'use strict'; - -var Bs_SortArray = require("./bs_SortArray.js"); -var Bs_internalAVLset = require("./bs_internalAVLset.js"); - -function remove0(nt, x, cmp) { - var k = nt.key; - var c = cmp(x, k); - if (c) { - if (c < 0) { - var match = nt.left; - if (match !== null) { - nt.left = remove0(match, x, cmp); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = remove0(match$1, x, cmp); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } - } else { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } -} - -function remove(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = remove0(oldRoot, v, d.cmp); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function removeMany0(_t, xs, _i, len, cmp) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = remove0(t, ele, cmp); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLset.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - d.data = removeMany0(oldRoot, xs, 0, len, d.cmp); - return /* () */0; - } else { - return /* () */0; - } -} - -function removeCheck0(nt, x, removed, cmp) { - var k = nt.key; - var c = cmp(x, k); - if (c) { - if (c < 0) { - var match = nt.left; - if (match !== null) { - nt.left = removeCheck0(match, x, removed, cmp); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeCheck0(match$1, x, removed, cmp); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } - } else { - removed[0] = /* true */1; - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } -} - -function removeCheck(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var removed = [/* false */0]; - var newRoot = removeCheck0(oldRoot, v, removed, d.cmp); - if (newRoot !== oldRoot) { - d.data = newRoot; - } - return removed[0]; - } else { - return /* false */0; - } -} - -function addCheck0(t, x, added, cmp) { - if (t !== null) { - var k = t.key; - var c = cmp(x, k); - if (c) { - var l = t.left; - var r = t.right; - if (c < 0) { - var ll = addCheck0(l, x, added, cmp); - t.left = ll; - } else { - t.right = addCheck0(r, x, added, cmp); - } - return Bs_internalAVLset.balMutate(t); - } else { - return t; - } - } else { - added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); - } -} - -function addCheck(m, e) { - var oldRoot = m.data; - var added = [/* false */0]; - var newRoot = addCheck0(oldRoot, e, added, m.cmp); - if (newRoot !== oldRoot) { - m.data = newRoot; - } - return added[0]; -} - -function add(m, e) { - var oldRoot = m.data; - var newRoot = Bs_internalAVLset.addMutate(m.cmp, oldRoot, e); - if (newRoot !== oldRoot) { - m.data = newRoot; - return /* () */0; - } else { - return 0; - } -} - -function addArrayMutate(t, xs, cmp) { - var v = t; - for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalAVLset.addMutate(cmp, v, xs[i]); - } - return v; -} - -function mergeMany(d, xs) { - d.data = addArrayMutate(d.data, xs, d.cmp); - return /* () */0; -} - -function make(dict) { - return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLset.empty - }; -} - -function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); -} - -function minimum(d) { - return Bs_internalAVLset.minimum(d.data); -} - -function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); -} - -function maximum(d) { - return Bs_internalAVLset.maximum(d.data); -} - -function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); -} - -function forEach(d, f) { - return Bs_internalAVLset.forEach(d.data, f); -} - -function reduce(d, acc, cb) { - return Bs_internalAVLset.reduce(d.data, acc, cb); -} - -function every(d, p) { - return Bs_internalAVLset.every(d.data, p); -} - -function some(d, p) { - return Bs_internalAVLset.some(d.data, p); -} - -function size(d) { - return Bs_internalAVLset.size(d.data); -} - -function toList(d) { - return Bs_internalAVLset.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLset.toArray(d.data); -} - -function ofSortedArrayUnsafe(xs, dict) { - return { - cmp: dict[/* cmp */0], - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) - }; -} - -function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); -} - -function ofArray(data, dict) { - var cmp = dict[/* cmp */0]; - return { - cmp: cmp, - data: Bs_internalAVLset.ofArray(data, cmp) - }; -} - -function cmp(d0, d1) { - return Bs_internalAVLset.cmp(d0.data, d1.data, d0.cmp); -} - -function eq(d0, d1) { - return Bs_internalAVLset.eq(d0.data, d1.data, d0.cmp); -} - -function get(d, x) { - return Bs_internalAVLset.get(d.data, x, d.cmp); -} - -function getUndefined(d, x) { - return Bs_internalAVLset.getUndefined(d.data, x, d.cmp); -} - -function getExn(d, x) { - return Bs_internalAVLset.getExn(d.data, x, d.cmp); -} - -function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); - var cmp = d.cmp; - var i = Bs_SortArray.binarySearchBy(arr, key, cmp); - var len = arr.length; - if (i < 0) { - var next = (-i | 0) - 1 | 0; - return /* tuple */[ - /* tuple */[ - { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) - }, - { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) - } - ], - /* false */0 - ]; - } else { - return /* tuple */[ - /* tuple */[ - { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) - }, - { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) - } - ], - /* true */1 - ]; - } -} - -function keep(d, p) { - return { - cmp: d.cmp, - data: Bs_internalAVLset.filterCopy(d.data, p) - }; -} - -function partition(d, p) { - var cmp = d.cmp; - var match = Bs_internalAVLset.partitionCopy(d.data, p); - return /* tuple */[ - { - cmp: cmp, - data: match[0] - }, - { - cmp: cmp, - data: match[1] - } - ]; -} - -function subset(a, b) { - return Bs_internalAVLset.subset(a.data, b.data, a.cmp); -} - -function intersect(a, b) { - var cmp = a.cmp; - var match = a.data; - var match$1 = b.data; - if (match !== null) { - if (match$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(match); - var sizeb = Bs_internalAVLset.lengthNode(match$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(match, 0, tmp); - Bs_internalAVLset.fillArray(match$1, sizea, tmp); - if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0 || cmp(tmp[totalSize - 1 | 0], tmp[0]) < 0) { - return { - cmp: cmp, - data: Bs_internalAVLset.empty - }; - } else { - var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArray.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); - return { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.empty - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.empty - }; - } -} - -function diff(a, b) { - var cmp = a.cmp; - var dataa = a.data; - var match = b.data; - if (dataa !== null) { - if (match !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa); - var sizeb = Bs_internalAVLset.lengthNode(match); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa, 0, tmp); - Bs_internalAVLset.fillArray(match, sizea, tmp); - if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0 || cmp(tmp[totalSize - 1 | 0], tmp[0]) < 0) { - return { - cmp: cmp, - data: Bs_internalAVLset.copy(dataa) - }; - } else { - var tmp2 = new Array(sizea); - var k = Bs_SortArray.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); - return { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.copy(dataa) - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.empty - }; - } -} - -function union(a, b) { - var cmp = a.cmp; - var dataa = a.data; - var datab = b.data; - if (dataa !== null) { - if (datab !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa); - var sizeb = Bs_internalAVLset.lengthNode(datab); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa, 0, tmp); - Bs_internalAVLset.fillArray(datab, sizea, tmp); - if (cmp(tmp[sizea - 1 | 0], tmp[sizea]) < 0) { - return { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) - }; - } else { - var tmp2 = new Array(totalSize); - var k = Bs_SortArray.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0, cmp); - return { - cmp: cmp, - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.copy(dataa) - }; - } - } else { - return { - cmp: cmp, - data: Bs_internalAVLset.copy(datab) - }; - } -} - -function has(d, x) { - return Bs_internalAVLset.has(d.data, x, d.cmp); -} - -function copy(d) { - return { - cmp: d.cmp, - data: Bs_internalAVLset.copy(d.data) - }; -} - -var Int = 0; - -var $$String = 0; - -exports.Int = Int; -exports.$$String = $$String; -exports.make = make; -exports.ofArray = ofArray; -exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; -exports.copy = copy; -exports.isEmpty = isEmpty; -exports.has = has; -exports.add = add; -exports.addCheck = addCheck; -exports.mergeMany = mergeMany; -exports.remove = remove; -exports.removeCheck = removeCheck; -exports.removeMany = removeMany; -exports.union = union; -exports.intersect = intersect; -exports.diff = diff; -exports.subset = subset; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.keep = keep; -exports.partition = partition; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getExn = getExn; -exports.split = split; -exports.checkInvariantInternal = checkInvariantInternal; -/* No side effect */ diff --git a/lib/js/bs_SetStringM.js b/lib/js/bs_SetStringM.js deleted file mode 100644 index 5cc93a510d..0000000000 --- a/lib/js/bs_SetStringM.js +++ /dev/null @@ -1,485 +0,0 @@ -'use strict'; - -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_SortArrayString = require("./bs_SortArrayString.js"); -var Bs_internalSetString = require("./bs_internalSetString.js"); - -function remove0(nt, x) { - var k = nt.key; - if (x === k) { - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = remove0(match, x); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = remove0(match$1, x); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } -} - -function remove(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var newRoot = remove0(oldRoot, v); - if (newRoot !== oldRoot) { - d.data = newRoot; - return /* () */0; - } else { - return 0; - } - } else { - return /* () */0; - } -} - -function removeMany0(_t, xs, _i, len) { - while(true) { - var i = _i; - var t = _t; - if (i < len) { - var ele = xs[i]; - var u = remove0(t, ele); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return Bs_internalAVLset.empty; - } - } else { - return t; - } - }; -} - -function removeMany(d, xs) { - var oldRoot = d.data; - if (oldRoot !== null) { - var len = xs.length; - d.data = removeMany0(oldRoot, xs, 0, len); - return /* () */0; - } else { - return /* () */0; - } -} - -function removeCheck0(nt, x, removed) { - var k = nt.key; - if (x === k) { - removed[0] = /* true */1; - var l = nt.left; - var r = nt.right; - if (l !== null) { - if (r !== null) { - nt.right = Bs_internalAVLset.removeMinAuxWithRootMutate(nt, r); - return Bs_internalAVLset.balMutate(nt); - } else { - return l; - } - } else { - return r; - } - } else if (x < k) { - var match = nt.left; - if (match !== null) { - nt.left = removeCheck0(match, x, removed); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } else { - var match$1 = nt.right; - if (match$1 !== null) { - nt.right = removeCheck0(match$1, x, removed); - return Bs_internalAVLset.balMutate(nt); - } else { - return nt; - } - } -} - -function removeCheck(d, v) { - var oldRoot = d.data; - if (oldRoot !== null) { - var removed = [/* false */0]; - var newRoot = removeCheck0(oldRoot, v, removed); - if (newRoot !== oldRoot) { - d.data = newRoot; - } - return removed[0]; - } else { - return /* false */0; - } -} - -function addCheck0(t, x, added) { - if (t !== null) { - var k = t.key; - if (x === k) { - return t; - } else { - var l = t.left; - var r = t.right; - if (x < k) { - var ll = addCheck0(l, x, added); - t.left = ll; - } else { - t.right = addCheck0(r, x, added); - } - return Bs_internalAVLset.balMutate(t); - } - } else { - added[0] = /* true */1; - return Bs_internalAVLset.singleton(x); - } -} - -function addCheck(m, e) { - var oldRoot = m.data; - var added = [/* false */0]; - var newRoot = addCheck0(oldRoot, e, added); - if (newRoot !== oldRoot) { - m.data = newRoot; - } - return added[0]; -} - -function add(d, k) { - var oldRoot = d.data; - var v = Bs_internalSetString.addMutate(oldRoot, k); - if (v !== oldRoot) { - d.data = v; - return /* () */0; - } else { - return 0; - } -} - -function addArrayMutate(t, xs) { - var v = t; - for(var i = 0 ,i_finish = xs.length - 1 | 0; i <= i_finish; ++i){ - v = Bs_internalSetString.addMutate(v, xs[i]); - } - return v; -} - -function mergeMany(d, arr) { - d.data = addArrayMutate(d.data, arr); - return /* () */0; -} - -function make() { - return { - data: Bs_internalAVLset.empty - }; -} - -function isEmpty(d) { - return Bs_internalAVLset.isEmpty(d.data); -} - -function minimum(d) { - return Bs_internalAVLset.minimum(d.data); -} - -function minUndefined(d) { - return Bs_internalAVLset.minUndefined(d.data); -} - -function maximum(d) { - return Bs_internalAVLset.maximum(d.data); -} - -function maxUndefined(d) { - return Bs_internalAVLset.maxUndefined(d.data); -} - -function forEach(d, f) { - return Bs_internalAVLset.forEach(d.data, f); -} - -function reduce(d, acc, cb) { - return Bs_internalAVLset.reduce(d.data, acc, cb); -} - -function every(d, p) { - return Bs_internalAVLset.every(d.data, p); -} - -function some(d, p) { - return Bs_internalAVLset.some(d.data, p); -} - -function size(d) { - return Bs_internalAVLset.size(d.data); -} - -function toList(d) { - return Bs_internalAVLset.toList(d.data); -} - -function toArray(d) { - return Bs_internalAVLset.toArray(d.data); -} - -function ofSortedArrayUnsafe(xs) { - return { - data: Bs_internalAVLset.ofSortedArrayUnsafe(xs) - }; -} - -function checkInvariantInternal(d) { - return Bs_internalAVLset.checkInvariantInternal(d.data); -} - -function ofArray(xs) { - return { - data: Bs_internalSetString.ofArray(xs) - }; -} - -function cmp(d0, d1) { - return Bs_internalSetString.cmp(d0.data, d1.data); -} - -function eq(d0, d1) { - return Bs_internalSetString.eq(d0.data, d1.data); -} - -function get(d, x) { - return Bs_internalSetString.get(d.data, x); -} - -function getUndefined(d, x) { - return Bs_internalSetString.getUndefined(d.data, x); -} - -function getExn(d, x) { - return Bs_internalSetString.getExn(d.data, x); -} - -function split(d, key) { - var arr = Bs_internalAVLset.toArray(d.data); - var i = Bs_SortArrayString.binarySearch(arr, key); - var len = arr.length; - if (i < 0) { - var next = (-i | 0) - 1 | 0; - return /* tuple */[ - /* tuple */[ - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, next) - }, - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, next, len - next | 0) - } - ], - /* false */0 - ]; - } else { - return /* tuple */[ - /* tuple */[ - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, 0, i) - }, - { - data: Bs_internalAVLset.ofSortedArrayAux(arr, i + 1 | 0, (len - i | 0) - 1 | 0) - } - ], - /* true */1 - ]; - } -} - -function keep(d, p) { - return { - data: Bs_internalAVLset.filterCopy(d.data, p) - }; -} - -function partition(d, p) { - var match = Bs_internalAVLset.partitionCopy(d.data, p); - return /* tuple */[ - { - data: match[0] - }, - { - data: match[1] - } - ]; -} - -function subset(a, b) { - return Bs_internalSetString.subset(a.data, b.data); -} - -function intersect(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { - return { - data: Bs_internalAVLset.empty - }; - } else { - var tmp2 = new Array(sizea < sizeb ? sizea : sizeb); - var k = Bs_SortArrayString.intersect(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } -} - -function diff(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea] || tmp[totalSize - 1 | 0] < tmp[0]) { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } else { - var tmp2 = new Array(sizea); - var k = Bs_SortArrayString.diff(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } - } else { - return { - data: Bs_internalAVLset.empty - }; - } -} - -function union(dataa, datab) { - var dataa$1 = dataa.data; - var datab$1 = datab.data; - if (dataa$1 !== null) { - if (datab$1 !== null) { - var sizea = Bs_internalAVLset.lengthNode(dataa$1); - var sizeb = Bs_internalAVLset.lengthNode(datab$1); - var totalSize = sizea + sizeb | 0; - var tmp = new Array(totalSize); - Bs_internalAVLset.fillArray(dataa$1, 0, tmp); - Bs_internalAVLset.fillArray(datab$1, sizea, tmp); - if (tmp[sizea - 1 | 0] < tmp[sizea]) { - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp, 0, totalSize) - }; - } else { - var tmp2 = new Array(totalSize); - var k = Bs_SortArrayString.union(tmp, 0, sizea, tmp, sizea, sizeb, tmp2, 0); - return { - data: Bs_internalAVLset.ofSortedArrayAux(tmp2, 0, k) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(dataa$1) - }; - } - } else { - return { - data: Bs_internalAVLset.copy(datab$1) - }; - } -} - -function has(d, x) { - return Bs_internalSetString.has(d.data, x); -} - -function copy(d) { - return { - data: Bs_internalAVLset.copy(d.data) - }; -} - -exports.make = make; -exports.ofArray = ofArray; -exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; -exports.copy = copy; -exports.isEmpty = isEmpty; -exports.has = has; -exports.add = add; -exports.addCheck = addCheck; -exports.mergeMany = mergeMany; -exports.remove = remove; -exports.removeCheck = removeCheck; -exports.removeMany = removeMany; -exports.union = union; -exports.intersect = intersect; -exports.diff = diff; -exports.subset = subset; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.keep = keep; -exports.partition = partition; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getExn = getExn; -exports.split = split; -exports.checkInvariantInternal = checkInvariantInternal; -/* No side effect */ diff --git a/lib/js/bs_SortedMapDict.js b/lib/js/bs_SortedMapDict.js deleted file mode 100644 index c57a7c482c..0000000000 --- a/lib/js/bs_SortedMapDict.js +++ /dev/null @@ -1,375 +0,0 @@ -'use strict'; - -var Bs_internalAVLtree = require("./bs_internalAVLtree.js"); - -function set(t, newK, newD, cmp) { - if (t !== null) { - var k = t.key; - var c = cmp(newK, k); - if (c) { - var l = t.left; - var r = t.right; - var v = t.value; - if (c < 0) { - return Bs_internalAVLtree.bal(set(l, newK, newD, cmp), k, v, r); - } else { - return Bs_internalAVLtree.bal(l, k, v, set(r, newK, newD, cmp)); - } - } else { - return Bs_internalAVLtree.updateValue(t, newD); - } - } else { - return Bs_internalAVLtree.singleton(newK, newD); - } -} - -function update(t, newK, f, cmp) { - if (t !== null) { - var k = t.key; - var c = cmp(newK, k); - if (c) { - var l = t.left; - var r = t.right; - var v = t.value; - if (c < 0) { - var ll = update(l, newK, f, cmp); - if (l === ll) { - return t; - } else { - return Bs_internalAVLtree.bal(ll, k, v, r); - } - } else { - var rr = update(r, newK, f, cmp); - if (r === rr) { - return t; - } else { - return Bs_internalAVLtree.bal(l, k, v, rr); - } - } - } else { - var match = f(/* Some */[t.value]); - if (match) { - return Bs_internalAVLtree.updateValue(t, match[0]); - } else { - var l$1 = t.left; - var r$1 = t.right; - if (l$1 !== null) { - if (r$1 !== null) { - var kr = [r$1.key]; - var vr = [r$1.value]; - var r$2 = Bs_internalAVLtree.removeMinAuxWithRef(r$1, kr, vr); - return Bs_internalAVLtree.bal(l$1, kr[0], vr[0], r$2); - } else { - return l$1; - } - } else { - return r$1; - } - } - } - } else { - var match$1 = f(/* None */0); - if (match$1) { - return Bs_internalAVLtree.singleton(newK, match$1[0]); - } else { - return t; - } - } -} - -function removeAux0(n, x, cmp) { - var l = n.left; - var v = n.key; - var r = n.right; - var c = cmp(x, v); - if (c) { - if (c < 0) { - if (l !== null) { - var ll = removeAux0(l, x, cmp); - if (ll === l) { - return n; - } else { - return Bs_internalAVLtree.bal(ll, v, n.value, r); - } - } else { - return n; - } - } else if (r !== null) { - var rr = removeAux0(r, x, cmp); - if (rr === r) { - return n; - } else { - return Bs_internalAVLtree.bal(l, v, n.value, rr); - } - } else { - return n; - } - } else if (l !== null) { - if (r !== null) { - var kr = [r.key]; - var vr = [r.value]; - var r$1 = Bs_internalAVLtree.removeMinAuxWithRef(r, kr, vr); - return Bs_internalAVLtree.bal(l, kr[0], vr[0], r$1); - } else { - return l; - } - } else { - return r; - } -} - -function remove(n, x, cmp) { - if (n !== null) { - return removeAux0(n, x, cmp); - } else { - return Bs_internalAVLtree.empty; - } -} - -function mergeMany(h, arr, cmp) { - var len = arr.length; - var v = h; - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var match = arr[i]; - v = set(v, match[0], match[1], cmp); - } - return v; -} - -function splitAuxPivot(n, x, pres, cmp) { - var l = n.left; - var v = n.key; - var d = n.value; - var r = n.right; - var c = cmp(x, v); - if (c) { - if (c < 0) { - if (l !== null) { - var match = splitAuxPivot(l, x, pres, cmp); - return /* tuple */[ - match[0], - Bs_internalAVLtree.join(match[1], v, d, r) - ]; - } else { - return /* tuple */[ - Bs_internalAVLtree.empty, - n - ]; - } - } else if (r !== null) { - var match$1 = splitAuxPivot(r, x, pres, cmp); - return /* tuple */[ - Bs_internalAVLtree.join(l, v, d, match$1[0]), - match$1[1] - ]; - } else { - return /* tuple */[ - n, - Bs_internalAVLtree.empty - ]; - } - } else { - pres[0] = /* Some */[d]; - return /* tuple */[ - l, - r - ]; - } -} - -function split(n, x, cmp) { - if (n !== null) { - var pres = [/* None */0]; - var v = splitAuxPivot(n, x, pres, cmp); - return /* tuple */[ - v, - pres[0] - ]; - } else { - return /* tuple */[ - /* tuple */[ - Bs_internalAVLtree.empty, - Bs_internalAVLtree.empty - ], - /* None */0 - ]; - } -} - -function merge(s1, s2, f, cmp) { - if (s1 !== null) { - if (s2 !== null) { - if (s1.h >= s2.h) { - var l1 = s1.left; - var v1 = s1.key; - var d1 = s1.value; - var r1 = s1.right; - var d2 = [/* None */0]; - var match = splitAuxPivot(s2, v1, d2, cmp); - var d2$1 = d2[0]; - var newLeft = merge(l1, match[0], f, cmp); - var newD = f(v1, /* Some */[d1], d2$1); - var newRight = merge(r1, match[1], f, cmp); - return Bs_internalAVLtree.concatOrJoin(newLeft, v1, newD, newRight); - } else { - var l2 = s2.left; - var v2 = s2.key; - var d2$2 = s2.value; - var r2 = s2.right; - var d1$1 = [/* None */0]; - var match$1 = splitAuxPivot(s1, v2, d1$1, cmp); - var d1$2 = d1$1[0]; - var newLeft$1 = merge(match$1[0], l2, f, cmp); - var newD$1 = f(v2, d1$2, /* Some */[d2$2]); - var newRight$1 = merge(match$1[1], r2, f, cmp); - return Bs_internalAVLtree.concatOrJoin(newLeft$1, v2, newD$1, newRight$1); - } - } else { - return Bs_internalAVLtree.filterMap(s1, (function (k, v) { - return f(k, /* Some */[v], /* None */0); - })); - } - } else if (s2 !== null) { - return Bs_internalAVLtree.filterMap(s2, (function (k, v) { - return f(k, /* None */0, /* Some */[v]); - })); - } else { - return Bs_internalAVLtree.empty; - } -} - -function removeMany(t, keys, cmp) { - var len = keys.length; - if (t !== null) { - var _t = t; - var xs = keys; - var _i = 0; - var len$1 = len; - var cmp$1 = cmp; - while(true) { - var i = _i; - var t$1 = _t; - if (i < len$1) { - var ele = xs[i]; - var u = removeAux0(t$1, ele, cmp$1); - if (u !== null) { - _i = i + 1 | 0; - _t = u; - continue ; - - } else { - return u; - } - } else { - return t$1; - } - }; - } else { - return Bs_internalAVLtree.empty; - } -} - -var empty = Bs_internalAVLtree.empty; - -var isEmpty = Bs_internalAVLtree.isEmpty; - -var has = Bs_internalAVLtree.has; - -var cmp = Bs_internalAVLtree.cmp; - -var eq = Bs_internalAVLtree.eq; - -var forEach = Bs_internalAVLtree.forEach; - -var reduce = Bs_internalAVLtree.reduce; - -var every = Bs_internalAVLtree.every; - -var some = Bs_internalAVLtree.some; - -var size = Bs_internalAVLtree.size; - -var toList = Bs_internalAVLtree.toList; - -var toArray = Bs_internalAVLtree.toArray; - -var ofArray = Bs_internalAVLtree.ofArray; - -var keysToArray = Bs_internalAVLtree.keysToArray; - -var valuesToArray = Bs_internalAVLtree.valuesToArray; - -var minKey = Bs_internalAVLtree.minKey; - -var minKeyUndefined = Bs_internalAVLtree.minKeyUndefined; - -var maxKey = Bs_internalAVLtree.maxKey; - -var maxKeyUndefined = Bs_internalAVLtree.maxKeyUndefined; - -var minimum = Bs_internalAVLtree.minimum; - -var minUndefined = Bs_internalAVLtree.minUndefined; - -var maximum = Bs_internalAVLtree.maximum; - -var maxUndefined = Bs_internalAVLtree.maxUndefined; - -var get = Bs_internalAVLtree.get; - -var getUndefined = Bs_internalAVLtree.getUndefined; - -var getWithDefault = Bs_internalAVLtree.getWithDefault; - -var getExn = Bs_internalAVLtree.getExn; - -var checkInvariantInternal = Bs_internalAVLtree.checkInvariantInternal; - -var keepBy = Bs_internalAVLtree.filterShared; - -var partition = Bs_internalAVLtree.partitionShared; - -var map = Bs_internalAVLtree.map; - -var mapWithKey = Bs_internalAVLtree.mapWithKey; - -exports.empty = empty; -exports.isEmpty = isEmpty; -exports.has = has; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.ofArray = ofArray; -exports.keysToArray = keysToArray; -exports.valuesToArray = valuesToArray; -exports.minKey = minKey; -exports.minKeyUndefined = minKeyUndefined; -exports.maxKey = maxKey; -exports.maxKeyUndefined = maxKeyUndefined; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getWithDefault = getWithDefault; -exports.getExn = getExn; -exports.checkInvariantInternal = checkInvariantInternal; -exports.remove = remove; -exports.removeMany = removeMany; -exports.set = set; -exports.update = update; -exports.merge = merge; -exports.mergeMany = mergeMany; -exports.keepBy = keepBy; -exports.partition = partition; -exports.split = split; -exports.map = map; -exports.mapWithKey = mapWithKey; -/* No side effect */ diff --git a/lib/js/bs_SortedSetDict.js b/lib/js/bs_SortedSetDict.js deleted file mode 100644 index 7bd595e916..0000000000 --- a/lib/js/bs_SortedSetDict.js +++ /dev/null @@ -1,352 +0,0 @@ -'use strict'; - -var Bs_internalAVLset = require("./bs_internalAVLset.js"); - -function add(t, x, cmp) { - if (t !== null) { - var k = t.key; - var c = cmp(x, k); - if (c) { - var l = t.left; - var r = t.right; - if (c < 0) { - var ll = add(l, x, cmp); - if (ll === l) { - return t; - } else { - return Bs_internalAVLset.bal(ll, k, r); - } - } else { - var rr = add(r, x, cmp); - if (rr === r) { - return t; - } else { - return Bs_internalAVLset.bal(l, k, rr); - } - } - } else { - return t; - } - } else { - return Bs_internalAVLset.singleton(x); - } -} - -function remove(t, x, cmp) { - if (t !== null) { - var l = t.left; - var v = t.key; - var r = t.right; - var c = cmp(x, v); - if (c) { - if (c < 0) { - var ll = remove(l, x, cmp); - if (ll === l) { - return t; - } else { - return Bs_internalAVLset.bal(ll, v, r); - } - } else { - var rr = remove(r, x, cmp); - if (rr === r) { - return t; - } else { - return Bs_internalAVLset.bal(l, v, rr); - } - } - } else if (l !== null) { - if (r !== null) { - var v$1 = [r.key]; - var r$1 = Bs_internalAVLset.removeMinAuxWithRef(r, v$1); - return Bs_internalAVLset.bal(l, v$1[0], r$1); - } else { - return l; - } - } else { - return r; - } - } else { - return t; - } -} - -function mergeMany(h, arr, cmp) { - var len = arr.length; - var v = h; - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var key = arr[i]; - v = add(v, key, cmp); - } - return v; -} - -function removeMany(h, arr, cmp) { - var len = arr.length; - var v = h; - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var key = arr[i]; - v = remove(v, key, cmp); - } - return v; -} - -function splitAuxNoPivot(cmp, n, x) { - var l = n.left; - var v = n.key; - var r = n.right; - var c = cmp(x, v); - if (c) { - if (c < 0) { - if (l !== null) { - var match = splitAuxNoPivot(cmp, l, x); - return /* tuple */[ - match[0], - Bs_internalAVLset.joinShared(match[1], v, r) - ]; - } else { - return /* tuple */[ - Bs_internalAVLset.empty, - n - ]; - } - } else if (r !== null) { - var match$1 = splitAuxNoPivot(cmp, r, x); - return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), - match$1[1] - ]; - } else { - return /* tuple */[ - n, - Bs_internalAVLset.empty - ]; - } - } else { - return /* tuple */[ - l, - r - ]; - } -} - -function splitAuxPivot(cmp, n, x, pres) { - var l = n.left; - var v = n.key; - var r = n.right; - var c = cmp(x, v); - if (c) { - if (c < 0) { - if (l !== null) { - var match = splitAuxPivot(cmp, l, x, pres); - return /* tuple */[ - match[0], - Bs_internalAVLset.joinShared(match[1], v, r) - ]; - } else { - return /* tuple */[ - Bs_internalAVLset.empty, - n - ]; - } - } else if (r !== null) { - var match$1 = splitAuxPivot(cmp, r, x, pres); - return /* tuple */[ - Bs_internalAVLset.joinShared(l, v, match$1[0]), - match$1[1] - ]; - } else { - return /* tuple */[ - n, - Bs_internalAVLset.empty - ]; - } - } else { - pres[0] = /* true */1; - return /* tuple */[ - l, - r - ]; - } -} - -function split(t, x, cmp) { - if (t !== null) { - var pres = [/* false */0]; - var v = splitAuxPivot(cmp, t, x, pres); - return /* tuple */[ - v, - pres[0] - ]; - } else { - return /* tuple */[ - /* tuple */[ - Bs_internalAVLset.empty, - Bs_internalAVLset.empty - ], - /* false */0 - ]; - } -} - -function union(s1, s2, cmp) { - if (s1 !== null) { - if (s2 !== null) { - var h1 = s1.h; - var h2 = s2.h; - if (h1 >= h2) { - if (h2 === 1) { - return add(s1, s2.key, cmp); - } else { - var l1 = s1.left; - var v1 = s1.key; - var r1 = s1.right; - var match = splitAuxNoPivot(cmp, s2, v1); - return Bs_internalAVLset.joinShared(union(l1, match[0], cmp), v1, union(r1, match[1], cmp)); - } - } else if (h1 === 1) { - return add(s2, s1.key, cmp); - } else { - var l2 = s2.left; - var v2 = s2.key; - var r2 = s2.right; - var match$1 = splitAuxNoPivot(cmp, s1, v2); - return Bs_internalAVLset.joinShared(union(match$1[0], l2, cmp), v2, union(match$1[1], r2, cmp)); - } - } else { - return s1; - } - } else { - return s2; - } -} - -function intersect(s1, s2, cmp) { - if (s1 !== null) { - if (s2 !== null) { - var l1 = s1.left; - var v1 = s1.key; - var r1 = s1.right; - var pres = [/* false */0]; - var match = splitAuxPivot(cmp, s2, v1, pres); - var ll = intersect(l1, match[0], cmp); - var rr = intersect(r1, match[1], cmp); - if (pres[0]) { - return Bs_internalAVLset.joinShared(ll, v1, rr); - } else { - return Bs_internalAVLset.concatShared(ll, rr); - } - } else { - return Bs_internalAVLset.empty; - } - } else { - return Bs_internalAVLset.empty; - } -} - -function diff(s1, s2, cmp) { - if (s1 !== null) { - if (s2 !== null) { - var l1 = s1.left; - var v1 = s1.key; - var r1 = s1.right; - var pres = [/* false */0]; - var match = splitAuxPivot(cmp, s2, v1, pres); - var ll = diff(l1, match[0], cmp); - var rr = diff(r1, match[1], cmp); - if (pres[0]) { - return Bs_internalAVLset.concatShared(ll, rr); - } else { - return Bs_internalAVLset.joinShared(ll, v1, rr); - } - } else { - return s1; - } - } else { - return s1; - } -} - -var empty = Bs_internalAVLset.empty; - -var ofArray = Bs_internalAVLset.ofArray; - -var ofSortedArrayUnsafe = Bs_internalAVLset.ofSortedArrayUnsafe; - -var isEmpty = Bs_internalAVLset.isEmpty; - -var has = Bs_internalAVLset.has; - -var subset = Bs_internalAVLset.subset; - -var cmp = Bs_internalAVLset.cmp; - -var eq = Bs_internalAVLset.eq; - -var forEach = Bs_internalAVLset.forEach; - -var reduce = Bs_internalAVLset.reduce; - -var every = Bs_internalAVLset.every; - -var some = Bs_internalAVLset.some; - -var keepBy = Bs_internalAVLset.filterShared; - -var partition = Bs_internalAVLset.partitionShared; - -var size = Bs_internalAVLset.size; - -var toList = Bs_internalAVLset.toList; - -var toArray = Bs_internalAVLset.toArray; - -var minimum = Bs_internalAVLset.minimum; - -var minUndefined = Bs_internalAVLset.minUndefined; - -var maximum = Bs_internalAVLset.maximum; - -var maxUndefined = Bs_internalAVLset.maxUndefined; - -var get = Bs_internalAVLset.get; - -var getUndefined = Bs_internalAVLset.getUndefined; - -var getExn = Bs_internalAVLset.getExn; - -var checkInvariantInternal = Bs_internalAVLset.checkInvariantInternal; - -exports.empty = empty; -exports.ofArray = ofArray; -exports.ofSortedArrayUnsafe = ofSortedArrayUnsafe; -exports.isEmpty = isEmpty; -exports.has = has; -exports.add = add; -exports.mergeMany = mergeMany; -exports.remove = remove; -exports.removeMany = removeMany; -exports.union = union; -exports.intersect = intersect; -exports.diff = diff; -exports.subset = subset; -exports.cmp = cmp; -exports.eq = eq; -exports.forEach = forEach; -exports.reduce = reduce; -exports.every = every; -exports.some = some; -exports.keepBy = keepBy; -exports.partition = partition; -exports.size = size; -exports.toList = toList; -exports.toArray = toArray; -exports.minimum = minimum; -exports.minUndefined = minUndefined; -exports.maximum = maximum; -exports.maxUndefined = maxUndefined; -exports.get = get; -exports.getUndefined = getUndefined; -exports.getExn = getExn; -exports.split = split; -exports.checkInvariantInternal = checkInvariantInternal; -/* No side effect */ diff --git a/lib/js/bs_Stack.js b/lib/js/bs_Stack.js deleted file mode 100644 index 295345bdc7..0000000000 --- a/lib/js/bs_Stack.js +++ /dev/null @@ -1,133 +0,0 @@ -'use strict'; - - -function create() { - return { - root: null - }; -} - -function clear(s) { - s.root = null; - return /* () */0; -} - -function copy(s) { - return { - root: s.root - }; -} - -function push(s, x) { - s.root = { - head: x, - tail: s.root - }; - return /* () */0; -} - -function topUndefined(s) { - var match = s.root; - if (match !== null) { - return match.head; - } else { - return undefined; - } -} - -function top(s) { - var match = s.root; - if (match !== null) { - return /* Some */[match.head]; - } else { - return /* None */0; - } -} - -function isEmpty(s) { - return +(s.root === null); -} - -function popUndefined(s) { - var match = s.root; - if (match !== null) { - s.root = match.tail; - return match.head; - } else { - return undefined; - } -} - -function pop(s) { - var match = s.root; - if (match !== null) { - s.root = match.tail; - return /* Some */[match.head]; - } else { - return /* None */0; - } -} - -function size(s) { - var match = s.root; - if (match !== null) { - var _x = match; - var _acc = 0; - while(true) { - var acc = _acc; - var x = _x; - var match$1 = x.tail; - if (match$1 !== null) { - _acc = acc + 1 | 0; - _x = match$1; - continue ; - - } else { - return acc + 1 | 0; - } - }; - } else { - return 0; - } -} - -function forEach(s, f) { - var _s = s.root; - var f$1 = f; - while(true) { - var s$1 = _s; - if (s$1 !== null) { - f$1(s$1.head); - _s = s$1.tail; - continue ; - - } else { - return /* () */0; - } - }; -} - -function dynamicPopIter(s, f) { - var cursor = s.root; - while(cursor !== null) { - var v = cursor; - s.root = v.tail; - f(v.head); - cursor = s.root; - }; - return /* () */0; -} - -exports.create = create; -exports.clear = clear; -exports.copy = copy; -exports.push = push; -exports.popUndefined = popUndefined; -exports.pop = pop; -exports.topUndefined = topUndefined; -exports.top = top; -exports.isEmpty = isEmpty; -exports.size = size; -exports.forEach = forEach; -exports.dynamicPopIter = dynamicPopIter; -/* No side effect */ diff --git a/lib/js/bs_dict.js b/lib/js/bs_dict.js deleted file mode 100644 index 636adfdb7e..0000000000 --- a/lib/js/bs_dict.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var Curry = require("./curry.js"); - -function comparableU(cmp) { - return /* module */[/* cmp */cmp]; -} - -function comparable(cmp) { - return comparableU(Curry.__2(cmp)); -} - -function hashableU(hash, eq) { - return /* module */[ - /* hash */hash, - /* eq */eq - ]; -} - -function hashable(hash, eq) { - return hashableU(Curry.__1(hash), Curry.__2(eq)); -} - -exports.comparableU = comparableU; -exports.comparable = comparable; -exports.hashableU = hashableU; -exports.hashable = hashable; -/* No side effect */ diff --git a/lib/js/bs_dyn.js b/lib/js/bs_dyn.js deleted file mode 100644 index 18328d5cab..0000000000 --- a/lib/js/bs_dyn.js +++ /dev/null @@ -1,175 +0,0 @@ -'use strict'; - -var $$Array = require("./array.js"); -var Block = require("./block.js"); -var Caml_array = require("./caml_array.js"); - -function int32_to_value(x) { - return /* Int32 */Block.__(0, [x]); -} - -function int64_to_value(x) { - return /* Int64 */Block.__(1, [x]); -} - -function int_to_value(x) { - return /* Int */Block.__(2, [x]); -} - -function nativeint_to_value(x) { - return /* Nativeint */Block.__(3, [x]); -} - -function bool_to_value(x) { - return /* Bool */Block.__(4, [x]); -} - -function float_to_value(x) { - return /* Float */Block.__(5, [x]); -} - -function char_to_value(x) { - return /* Char */Block.__(6, [x]); -} - -function string_to_value(x) { - return /* String */Block.__(7, [x]); -} - -function array_map(f, a) { - var l = a.length; - if (l) { - var r = Caml_array.caml_make_vect(l, f(a[0])); - for(var i = 1 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - r[i] = f(a[i]); - } - return r; - } else { - return /* array */[]; - } -} - -function array_to_value(k) { - return (function (x) { - return /* Array */Block.__(10, [array_map(k, x)]); - }); -} - -function list_to_value(k) { - return (function (x) { - return /* Array */Block.__(10, [array_map(k, $$Array.of_list(x))]); - }); -} - -function record_to_value(labels, v) { - return /* Record */Block.__(12, [ - labels, - v - ]); -} - -function variant_to_value(labels, tag, vs) { - return /* Variant */Block.__(13, [ - labels, - tag, - vs - ]); -} - -function tuple_2_to_value(k0, k1) { - return (function (param) { - return /* Tuple */Block.__(9, [/* array */[ - k0(param[0]), - k1(param[1]) - ]]); - }); -} - -function tuple_3_to_value(k0, k1, k2) { - return (function (param) { - return /* Tuple */Block.__(9, [/* array */[ - k0(param[0]), - k1(param[1]), - k2(param[2]) - ]]); - }); -} - -function tuple_4_to_value(k0, k1, k2, k3) { - return (function (param) { - return /* Tuple */Block.__(9, [/* array */[ - k0(param[0]), - k1(param[1]), - k2(param[2]), - k3(param[3]) - ]]); - }); -} - -function tuple_5_to_value(k0, k1, k2, k3, k4) { - return (function (param) { - return /* Tuple */Block.__(9, [/* array */[ - k0(param[0]), - k1(param[1]), - k2(param[2]), - k3(param[3]), - k4(param[4]) - ]]); - }); -} - -function tuple_6_to_value(k0, k1, k2, k3, k4, k5) { - return (function (param) { - return /* Tuple */Block.__(9, [/* array */[ - k0(param[0]), - k1(param[1]), - k2(param[2]), - k3(param[3]), - k4(param[4]), - k5(param[5]) - ]]); - }); -} - -function option_to_value(k) { - return (function (x) { - if (x) { - return /* OptionSome */Block.__(8, [k(x[0])]); - } else { - return /* OptionNone */0; - } - }); -} - -function shape_of_record(labels) { - return labels; -} - -function shape_of_variant(constructors, arities) { - return /* record */[ - /* constructors */constructors, - /* arities */arities - ]; -} - -exports.int32_to_value = int32_to_value; -exports.int64_to_value = int64_to_value; -exports.int_to_value = int_to_value; -exports.nativeint_to_value = nativeint_to_value; -exports.bool_to_value = bool_to_value; -exports.float_to_value = float_to_value; -exports.char_to_value = char_to_value; -exports.string_to_value = string_to_value; -exports.array_to_value = array_to_value; -exports.list_to_value = list_to_value; -exports.option_to_value = option_to_value; -exports.record_to_value = record_to_value; -exports.variant_to_value = variant_to_value; -exports.tuple_2_to_value = tuple_2_to_value; -exports.tuple_3_to_value = tuple_3_to_value; -exports.tuple_4_to_value = tuple_4_to_value; -exports.tuple_5_to_value = tuple_5_to_value; -exports.tuple_6_to_value = tuple_6_to_value; -exports.shape_of_variant = shape_of_variant; -exports.shape_of_record = shape_of_record; -/* No side effect */ diff --git a/lib/js/bs_dyn_lib.js b/lib/js/bs_dyn_lib.js deleted file mode 100644 index fd2b4ee145..0000000000 --- a/lib/js/bs_dyn_lib.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; - -var Char = require("./char.js"); -var $$Array = require("./array.js"); -var Buffer = require("./buffer.js"); -var Caml_array = require("./caml_array.js"); -var Pervasives = require("./pervasives.js"); -var Caml_format = require("./caml_format.js"); - -function to_string(v) { - var construct_string = function (b, _v, _tab_level) { - while(true) { - var tab_level = _tab_level; - var v = _v; - var add = function (tabs, str) { - for(var i = 0; i <= tabs; ++i){ - Buffer.add_string(b, " "); - } - return Buffer.add_string(b, str); - }; - if (typeof v === "number") { - return add(tab_level, "None\n"); - } else { - switch (v.tag | 0) { - case 0 : - add(tab_level, Caml_format.caml_int32_format("%d", v[0])); - return add(0, "l"); - case 1 : - add(tab_level, Caml_format.caml_int64_format("%d", v[0])); - return add(0, "L"); - case 2 : - return add(tab_level, "" + v[0]); - case 3 : - add(tab_level, Caml_format.caml_nativeint_format("%d", v[0])); - return add(0, "n"); - case 4 : - return add(tab_level, v[0] ? "true" : "false"); - case 5 : - return add(tab_level, Pervasives.string_of_float(v[0])); - case 6 : - add(tab_level, "'"); - add(0, Char.escaped(v[0])); - return add(0, "'"); - case 7 : - add(tab_level, "\""); - add(0, v[0]); - return add(0, "\""); - case 8 : - add(tab_level, "Some"); - _tab_level = 0; - _v = v[0]; - continue ; - case 9 : - var x = v[0]; - add(tab_level, "(\n"); - $$Array.iteri((function(tab_level,x){ - return function (i, item) { - construct_string(b, item, tab_level + 2 | 0); - if (i !== (x.length - 1 | 0)) { - add(0, ", "); - } - return add(0, "\n"); - } - }(tab_level,x)), x); - return add(tab_level, ")"); - case 10 : - add(tab_level, "[|\n"); - $$Array.iter((function(tab_level){ - return function (item) { - construct_string(b, item, tab_level + 2 | 0); - return add(0, ";\n"); - } - }(tab_level)), v[0]); - return add(tab_level, "|]"); - case 11 : - add(tab_level, "["); - $$Array.iter((function(tab_level){ - return function (item) { - return construct_string(b, item, tab_level + 2 | 0); - } - }(tab_level)), v[0]); - return add(tab_level, "]\n"); - case 12 : - var values = v[1]; - add(tab_level, "{\n"); - $$Array.iteri((function(tab_level,values){ - return function (i, item) { - add(tab_level + 2 | 0, item); - add(0, " =\n"); - construct_string(b, Caml_array.caml_array_get(values, i), tab_level + 2 | 0); - return add(0, ";\n"); - } - }(tab_level,values)), v[0]); - return add(tab_level, "}"); - case 13 : - var values$1 = v[2]; - add(tab_level, Caml_array.caml_array_get(v[0][/* constructors */0], v[1])); - if (values$1.length !== 0) { - add(tab_level, "(\n"); - $$Array.iteri((function(tab_level,values$1){ - return function (i, _) { - return construct_string(b, Caml_array.caml_array_get(values$1, i), tab_level + 2 | 0); - } - }(tab_level,values$1)), values$1); - return add(tab_level, ")"); - } else { - return 0; - } - - } - } - }; - }; - var buffer = Buffer.create(1024); - construct_string(buffer, v, 0); - return Buffer.contents(buffer); -} - -exports.to_string = to_string; -/* No side effect */ diff --git a/lib/js/bs_internalMutableAVLSet.js b/lib/js/bs_internalMutableAVLSet.js deleted file mode 100644 index 1e00c6a42f..0000000000 --- a/lib/js/bs_internalMutableAVLSet.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -var Bs_internalAVLset = require("./bs_internalAVLset.js"); -var Bs_internalSetInt = require("./bs_internalSetInt.js"); - -var N = 0; - -var I = 0; - -var empty = Bs_internalAVLset.empty0; - -var isEmpty = Bs_internalAVLset.isEmpty0; - -var singleton = Bs_internalAVLset.singleton0; - -var min = Bs_internalAVLset.min0; - -var max = Bs_internalAVLset.max0; - -var iter = Bs_internalAVLset.iter0; - -var fold = Bs_internalAVLset.fold0; - -var forAll = Bs_internalAVLset.forAll0; - -var exists = Bs_internalAVLset.exists0; - -var filter = Bs_internalAVLset.filter0; - -var partition = Bs_internalAVLset.partition0; - -var length = Bs_internalAVLset.length0; - -var elements = Bs_internalAVLset.elements0; - -var toArray = Bs_internalAVLset.toArray0; - -var checkInvariant = Bs_internalAVLset.checkInvariant; - -var add = Bs_internalSetInt.addMutate; - -var ofArray = Bs_internalSetInt.ofArray; - -var cmp = Bs_internalSetInt.cmp; - -var diff = Bs_internalSetInt.diff; - -var eq = Bs_internalSetInt.eq; - -var findOpt = Bs_internalSetInt.findOpt; - -var split = Bs_internalSetInt.split; - -var subset = Bs_internalSetInt.subset; - -var inter = Bs_internalSetInt.inter; - -var union = Bs_internalSetInt.union; - -var remove = Bs_internalSetInt.remove; - -var mem = Bs_internalSetInt.mem; - -exports.N = N; -exports.I = I; -exports.empty = empty; -exports.isEmpty = isEmpty; -exports.singleton = singleton; -exports.min = min; -exports.max = max; -exports.iter = iter; -exports.fold = fold; -exports.forAll = forAll; -exports.exists = exists; -exports.filter = filter; -exports.partition = partition; -exports.length = length; -exports.elements = elements; -exports.toArray = toArray; -exports.checkInvariant = checkInvariant; -exports.add = add; -exports.ofArray = ofArray; -exports.cmp = cmp; -exports.diff = diff; -exports.eq = eq; -exports.findOpt = findOpt; -exports.split = split; -exports.subset = subset; -exports.inter = inter; -exports.union = union; -exports.remove = remove; -exports.mem = mem; -/* No side effect */ diff --git a/lib/js/bs_internalSet.js b/lib/js/bs_internalSet.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/bs_internalSet.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/bs_node.js b/lib/js/bs_node.js deleted file mode 100644 index 4cb9251a38..0000000000 --- a/lib/js/bs_node.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - - -function test(x) { - if (typeof x === "string") { - return /* tuple */[ - /* String */0, - x - ]; - } - else { - return /* tuple */[ - /* Buffer */1, - x - ]; - } -} - -var Path = 0; - -var Fs = 0; - -var Process = 0; - -var Module = 0; - -var Buffer = 0; - -exports.Path = Path; -exports.Fs = Fs; -exports.Process = Process; -exports.Module = Module; -exports.Buffer = Buffer; -exports.test = test; -/* No side effect */ diff --git a/lib/js/bs_node_buffer.js b/lib/js/bs_node_buffer.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/bs_node_buffer.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/bs_node_fs.js b/lib/js/bs_node_fs.js deleted file mode 100644 index 54276f85c1..0000000000 --- a/lib/js/bs_node_fs.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - - -var Watch = /* module */[]; - -exports.Watch = Watch; -/* No side effect */ diff --git a/lib/js/bs_node_module.js b/lib/js/bs_node_module.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/bs_node_module.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/bs_node_path.js b/lib/js/bs_node_path.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/bs_node_path.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/bs_node_process.js b/lib/js/bs_node_process.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/bs_node_process.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/bs_result.js b/lib/js/bs_result.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/bs_result.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/camlinternalOO.js b/lib/js/camlinternalOO.js index ad26461326..f2a41d0ab7 100644 --- a/lib/js/camlinternalOO.js +++ b/lib/js/camlinternalOO.js @@ -6,11 +6,11 @@ var $$Array = require("./array.js"); var Curry = require("./curry.js"); var Caml_oo = require("./caml_oo.js"); var Caml_obj = require("./caml_obj.js"); -var Bs_MapInt = require("./bs_MapInt.js"); var Caml_array = require("./caml_array.js"); var Caml_int32 = require("./caml_int32.js"); +var Belt_MapInt = require("./belt_MapInt.js"); var Caml_string = require("./caml_string.js"); -var Bs_MapString = require("./bs_MapString.js"); +var Belt_MapString = require("./belt_MapString.js"); var Caml_exceptions = require("./caml_exceptions.js"); var Caml_builtin_exceptions = require("./caml_builtin_exceptions.js"); @@ -42,11 +42,11 @@ function public_method_label(s) { var dummy_table = /* record */[ /* size */0, /* methods : array */[/* () */0], - /* methods_by_name */Bs_MapString.empty, - /* methods_by_label */Bs_MapInt.empty, + /* methods_by_name */Belt_MapString.empty, + /* methods_by_label */Belt_MapInt.empty, /* previous_states : [] */0, /* hidden_meths : [] */0, - /* vars */Bs_MapString.empty, + /* vars */Belt_MapString.empty, /* initializers : [] */0 ]; @@ -74,11 +74,11 @@ function new_table(pub_labels) { return /* record */[ /* size */2, /* methods */methods, - /* methods_by_name */Bs_MapString.empty, - /* methods_by_label */Bs_MapInt.empty, + /* methods_by_name */Belt_MapString.empty, + /* methods_by_label */Belt_MapInt.empty, /* previous_states : [] */0, /* hidden_meths : [] */0, - /* vars */Bs_MapString.empty, + /* vars */Belt_MapString.empty, /* initializers : [] */0 ]; } @@ -106,13 +106,13 @@ function new_method(table) { } function get_method_label(table, name) { - var match = Bs_MapString.getUndefined(table[/* methods_by_name */2], name); + var match = Belt_MapString.getUndefined(table[/* methods_by_name */2], name); if (match !== undefined) { return match; } else { var label = new_method(table); - table[/* methods_by_name */2] = Bs_MapString.set(table[/* methods_by_name */2], name, label); - table[/* methods_by_label */3] = Bs_MapInt.set(table[/* methods_by_label */3], label, /* true */1); + table[/* methods_by_name */2] = Belt_MapString.set(table[/* methods_by_name */2], name, label); + table[/* methods_by_label */3] = Belt_MapInt.set(table[/* methods_by_label */3], label, /* true */1); return label; } } @@ -125,7 +125,7 @@ function get_method_labels(table, names) { function set_method(table, label, element) { method_count[0] = method_count[0] + 1 | 0; - if (Bs_MapInt.getExn(table[/* methods_by_label */3], label)) { + if (Belt_MapInt.getExn(table[/* methods_by_label */3], label)) { var array = table; var label$1 = label; var element$1 = element; @@ -185,23 +185,23 @@ function narrow(table, vars, virt_meths, concr_meths) { ], table[/* previous_states */4] ]; - table[/* vars */6] = Bs_MapString.reduceU(table[/* vars */6], Bs_MapString.empty, (function (tvars, lab, info) { + table[/* vars */6] = Belt_MapString.reduceU(table[/* vars */6], Belt_MapString.empty, (function (tvars, lab, info) { if (List.mem(lab, vars$1)) { - return Bs_MapString.set(tvars, lab, info); + return Belt_MapString.set(tvars, lab, info); } else { return tvars; } })); - var by_name = [Bs_MapString.empty]; - var by_label = [Bs_MapInt.empty]; + var by_name = [Belt_MapString.empty]; + var by_label = [Belt_MapInt.empty]; List.iter2((function (met, label) { - by_name[0] = Bs_MapString.set(by_name[0], met, label); - by_label[0] = Bs_MapInt.set(by_label[0], label, Bs_MapInt.getWithDefault(table[/* methods_by_label */3], label, /* true */1)); + by_name[0] = Belt_MapString.set(by_name[0], met, label); + by_label[0] = Belt_MapInt.set(by_label[0], label, Belt_MapInt.getWithDefault(table[/* methods_by_label */3], label, /* true */1)); return /* () */0; }), concr_meths$1, concr_meth_labs); List.iter2((function (met, label) { - by_name[0] = Bs_MapString.set(by_name[0], met, label); - by_label[0] = Bs_MapInt.set(by_label[0], label, /* false */0); + by_name[0] = Belt_MapString.set(by_name[0], met, label); + by_label[0] = Belt_MapInt.set(by_label[0], label, /* false */0); return /* () */0; }), virt_meths$1, virt_meth_labs); table[/* methods_by_name */2] = by_name[0]; @@ -224,7 +224,7 @@ function widen(table) { var virt_meths = match[4]; table[/* previous_states */4] = List.tl(table[/* previous_states */4]); table[/* vars */6] = List.fold_left((function (s, v) { - return Bs_MapString.set(s, v, Bs_MapString.getExn(table[/* vars */6], v)); + return Belt_MapString.set(s, v, Belt_MapString.getExn(table[/* vars */6], v)); }), match[3], match[5]); table[/* methods_by_name */2] = match[0]; table[/* methods_by_label */3] = match[1]; @@ -248,13 +248,13 @@ function new_slot(table) { } function new_variable(table, name) { - var match = Bs_MapString.getUndefined(table[/* vars */6], name); + var match = Belt_MapString.getUndefined(table[/* vars */6], name); if (match !== undefined) { return match; } else { var index = new_slot(table); if (name !== "") { - table[/* vars */6] = Bs_MapString.set(table[/* vars */6], name, index); + table[/* vars */6] = Belt_MapString.set(table[/* vars */6], name, index); } return index; } @@ -283,12 +283,12 @@ function new_methods_variables(table, meths, vals) { } function get_variable(table, name) { - return Bs_MapString.getExn(table[/* vars */6], name); + return Belt_MapString.getExn(table[/* vars */6], name); } function get_variables(table, names) { return $$Array.map((function (param) { - return Bs_MapString.getExn(table[/* vars */6], param); + return Belt_MapString.getExn(table[/* vars */6], param); }), names); } @@ -306,8 +306,8 @@ function create_table(public_methods) { var table = new_table(tags); $$Array.iteri((function (i, met) { var lab = (i << 1) + 2 | 0; - table[/* methods_by_name */2] = Bs_MapString.set(table[/* methods_by_name */2], met, lab); - table[/* methods_by_label */3] = Bs_MapInt.set(table[/* methods_by_label */3], lab, /* true */1); + table[/* methods_by_name */2] = Belt_MapString.set(table[/* methods_by_name */2], met, lab); + table[/* methods_by_label */3] = Belt_MapInt.set(table[/* methods_by_label */3], lab, /* true */1); return /* () */0; }), public_methods); return table; @@ -331,7 +331,7 @@ function inherits(cla, vals, virt_meths, concr_meths, param, top) { /* array */[init], /* :: */[ $$Array.map((function (param) { - return Bs_MapString.getExn(cla[/* vars */6], param); + return Belt_MapString.getExn(cla[/* vars */6], param); }), to_array(vals)), /* :: */[ $$Array.map((function (nm) { diff --git a/lib/js/fn.js b/lib/js/fn.js deleted file mode 100644 index 58fdd8a203..0000000000 --- a/lib/js/fn.js +++ /dev/null @@ -1,6 +0,0 @@ -// GENERATED CODE BY BUCKLESCRIPT VERSION 0.4.2 , PLEASE EDIT WITH CARE -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/js_option.js b/lib/js/js_option.js index 2fa4ab22a2..208c7437ca 100644 --- a/lib/js/js_option.js +++ b/lib/js/js_option.js @@ -33,7 +33,7 @@ function getExn(x) { if (x) { return x[0]; } else { - throw new Error("Bs_option.getExn"); + throw new Error("getExn"); } } diff --git a/lib/js/js_re.js b/lib/js/js_re.js deleted file mode 100644 index 6d8a4a3f94..0000000000 --- a/lib/js/js_re.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - - - -/* No side effect */ diff --git a/lib/js/typed_array.js b/lib/js/typed_array.js deleted file mode 100644 index 01b8183615..0000000000 --- a/lib/js/typed_array.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - - -var ArrayBuffer = /* module */[]; - -function TypedArray() { - return /* module */[]; -} - -var Int8Array = /* module */[]; - -var Uint8Array = /* module */[]; - -var Uint8ClampedArray = /* module */[]; - -var Int16Array = /* module */[]; - -var Uint16Array = /* module */[]; - -var Int32Array = /* module */[]; - -var Uint32Array = /* module */[]; - -var Float32Array = /* module */[]; - -var Float64Array = /* module */[]; - -var Int32_array = 0; - -var Float32_array = 0; - -var Float64_array = 0; - -exports.ArrayBuffer = ArrayBuffer; -exports.TypedArray = TypedArray; -exports.Int8Array = Int8Array; -exports.Uint8Array = Uint8Array; -exports.Uint8ClampedArray = Uint8ClampedArray; -exports.Int16Array = Int16Array; -exports.Uint16Array = Uint16Array; -exports.Int32Array = Int32Array; -exports.Int32_array = Int32_array; -exports.Uint32Array = Uint32Array; -exports.Float32Array = Float32Array; -exports.Float32_array = Float32_array; -exports.Float64Array = Float64Array; -exports.Float64_array = Float64_array; -/* No side effect */