remove enumerate, zip, ellipse uniform sampling with realign

This commit is contained in:
Adrian Mariano
2021-11-18 19:02:50 -05:00
parent 96a210b5a4
commit 1ec9faec39
6 changed files with 99 additions and 92 deletions

View File

@@ -8,7 +8,7 @@ module test_sort() {
assert(sort([[8,0],[3,1],[9,2],[4,3],[3,4],[1,5],[8,6]],idx=1) == [[8,0],[3,1],[9,2],[4,3],[3,4],[1,5],[8,6]]);
assert(sort(["cat", "oat", "sat", "bat", "vat", "rat", "pat", "mat", "fat", "hat", "eat"])
== ["bat", "cat", "eat", "fat", "hat", "mat", "oat", "pat", "rat", "sat", "vat"]);
assert(sort(enumerate([[2,3,4],[1,2,3],[2,4,3]]),idx=1)==[[1,[1,2,3]], [0,[2,3,4]], [2,[2,4,3]]]);
assert(sort([[0,[2,3,4]],[1,[1,2,3]],[2,[2,4,3]]],idx=1)==[[1,[1,2,3]], [0,[2,3,4]], [2,[2,4,3]]]);
assert(sort([0,"1",[1,0],2,"a",[1]])== [0,2,"1","a",[1],[1,0]]);
assert(sort([["oat",0], ["cat",1], ["bat",3], ["bat",2], ["fat",3]])== [["bat",2],["bat",3],["cat",1],["fat",3],["oat",0]]);
}

View File

@@ -254,14 +254,6 @@ module test_idx() {
test_idx();
module test_enumerate() {
assert(enumerate(["a","b","c"]) == [[0,"a"], [1,"b"], [2,"c"]]);
assert(enumerate([[88,"a"],[76,"b"],[21,"c"]], idx=1) == [[0,"a"], [1,"b"], [2,"c"]]);
assert(enumerate([["cat","a",12],["dog","b",10],["log","c",14]], idx=[1:2]) == [[0,"a",12], [1,"b",10], [2,"c",14]]);
}
test_enumerate();
module test_shuffle() {
nums1 = count(100);
nums2 = shuffle(nums1,33);
@@ -375,16 +367,6 @@ module test_repeat_entries() {
test_repeat_entries();
module test_zip() {
v1 = [1,2,3,4];
v2 = [5,6,7];
v3 = [8,9,10,11];
assert(zip(v1,v3) == [[1,8],[2,9],[3,10],[4,11]]);
assert(zip([v1,v3]) == [[1,8],[2,9],[3,10],[4,11]]);
}
test_zip();
module test_list_to_matrix() {
v = [1,2,3,4,5,6];
assert(list_to_matrix(v,2) == [[1,2], [3,4], [5,6]]);