######## test-List.az ########
tbl .. [49, 23, 23, 69]
min(tbl) .. 23
tbl.min() .. 23
min(tbl):index .. 1
tbl.min():index .. 1
min(tbl):last_index .. 2
tbl.min():last_index .. 2
min(tbl):indices .. [1, 2]
tbl.min():indices .. [1, 2]
max(tbl) .. 69
tbl.max() .. 69
max(tbl):index .. 3
tbl.max():index .. 3
max(tbl):last_index .. 3
tbl.max():last_index .. 3
max(tbl):indices .. [3]
tbl.max():indices .. [3]
  1   first, second, third, fourth
  2   first, second, fourth, third
  3   first, third, second, fourth
  4   first, third, fourth, second
  5   first, fourth, second, third
  6   first, fourth, third, second
  7   second, first, third, fourth
  8   second, first, fourth, third
  9   second, third, first, fourth
 10   second, third, fourth, first
 11   second, fourth, first, third
 12   second, fourth, third, first
 13   third, first, second, fourth
 14   third, first, fourth, second
 15   third, second, first, fourth
 16   third, second, fourth, first
 17   third, fourth, first, second
 18   third, fourth, second, first
 19   fourth, first, second, third
 20   fourth, first, third, second
 21   fourth, second, first, third
 22   fourth, second, third, first
 23   fourth, third, first, second
 24   fourth, third, second, first
  1   1, 2, 3, 4
  2   1, 2, 4, 3
  3   1, 3, 2, 4
  4   1, 3, 4, 2
  5   1, 4, 2, 3
  6   1, 4, 3, 2
  7   2, 1, 3, 4
  8   2, 1, 4, 3
  9   2, 3, 1, 4
 10   2, 3, 4, 1
 11   2, 4, 1, 3
 12   2, 4, 3, 1
 13   3, 1, 2, 4
 14   3, 1, 4, 2
 15   3, 2, 1, 4
 16   3, 2, 4, 1
 17   3, 4, 1, 2
 18   3, 4, 2, 1
 19   4, 1, 2, 3
 20   4, 1, 3, 2
 21   4, 2, 1, 3
 22   4, 2, 3, 1
 23   4, 3, 1, 2
 24   4, 3, 2, 1
  1   1st, 2nd, 3rd, 4th
  2   1st, 2nd, 4th, 3rd
  3   1st, 3rd, 2nd, 4th
  4   1st, 3rd, 4th, 2nd
  5   1st, 4th, 2nd, 3rd
  6   1st, 4th, 3rd, 2nd
  7   2nd, 1st, 3rd, 4th
  8   2nd, 1st, 4th, 3rd
  9   2nd, 3rd, 1st, 4th
 10   2nd, 3rd, 4th, 1st
 11   2nd, 4th, 1st, 3rd
 12   2nd, 4th, 3rd, 1st
 13   3rd, 1st, 2nd, 4th
 14   3rd, 1st, 4th, 2nd
 15   3rd, 2nd, 1st, 4th
 16   3rd, 2nd, 4th, 1st
 17   3rd, 4th, 1st, 2nd
 18   3rd, 4th, 2nd, 1st
 19   4th, 1st, 2nd, 3rd
 20   4th, 1st, 3rd, 2nd
 21   4th, 2nd, 1st, 3rd
 22   4th, 2nd, 3rd, 1st
 23   4th, 3rd, 1st, 2nd
 24   4th, 3rd, 2nd, 1st
  1   1, 2, 3, 4
  2   1, 2, 4, 3
  3   1, 3, 2, 4
  4   1, 3, 4, 2
  5   1, 4, 2, 3
  6   1, 4, 3, 2
  7   2, 1, 3, 4
  8   2, 1, 4, 3
  9   2, 3, 1, 4
 10   2, 3, 4, 1
 11   2, 4, 1, 3
 12   2, 4, 3, 1
 13   3, 1, 2, 4
 14   3, 1, 4, 2
 15   3, 2, 1, 4
 16   3, 2, 4, 1
 17   3, 4, 1, 2
 18   3, 4, 2, 1
 19   4, 1, 2, 3
 20   4, 1, 3, 2
 21   4, 2, 1, 3
 22   4, 2, 3, 1
 23   4, 3, 1, 2
 24   4, 3, 2, 1
permutation()  [1,2,3,4], [1,2,4,3], [1,3,2,4], [1,3,4,2], [1,4,2,3], [1,4,3,2], [2,1,3,4], [2,1,4,3], [2,3,1,4], [2,3,4,1], [2,4,1,3], [2,4,3,1], [3,1,2,4], [3,1,4,2], [3,2,1,4], [3,2,4,1], [3,4,1,2], [3,4,2,1], [4,1,2,3], [4,1,3,2], [4,2,1,3], [4,2,3,1], [4,3,1,2], [4,3,2,1]
permutation(3) [1,2,3], [1,2,4], [1,3,2], [1,3,4], [1,4,2], [1,4,3], [2,1,3], [2,1,4], [2,3,1], [2,3,4], [2,4,1], [2,4,3], [3,1,2], [3,1,4], [3,2,1], [3,2,4], [3,4,1], [3,4,2], [4,1,2], [4,1,3], [4,2,1], [4,2,3], [4,3,1], [4,3,2]
permutation(2) [1,2], [1,3], [1,4], [2,1], [2,3], [2,4], [3,1], [3,2], [3,4], [4,1], [4,2], [4,3]
permutation(1) [1], [2], [3], [4]
permutation(0) []
combination(4) [1,2,3,4]
combination(3) [1,2,3], [1,2,4], [1,3,4], [2,3,4]
combination(2) [1,2], [1,3], [1,4], [2,3], [2,4], [3,4]
combination(1) [1], [2], [3], [4]
combination(0) []
list .. ["[0]", "[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]", "[8]", "[9]", "[10]"]
list[0] .. [0]
list[9] .. [9]
list[0 .. 3] .. ["[0]", "[1]", "[2]", "[3]"]
list[8 .. 3] .. ["[8]", "[7]", "[6]", "[5]", "[4]", "[3]"]
list[5..] .. ["[5]", "[6]", "[7]", "[8]", "[9]", "[10]"]
list[2, 5..] .. ["[2]", "[5]", "[6]", "[7]", "[8]", "[9]", "[10]"]
list[2, 5.., 3, 4] .. ["[2]", "[5]", "[6]", "[7]", "[8]", "[9]", "[10]", "[3]", "[4]"]
list .. ["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]
[reverse(list)].join(" ") .. dog lazy the over jumps fox brown quick the
list .. ["apple", "orange", "grape"]
[round(list, 13)].join(" ") .. apple orange grape apple orange grape apple orange grape apple orange grape apple
[0 .. 10.offset(2)] .. [2, 3, 4, 5, 6, 7, 8, 9, 10]
[0 .. 10.skip(1)] .. [0, 2, 4, 6, 8]
[0 .. 10.offset(2).skip(1)] .. [2, 4, 6, 8]
[0 .. 5.align(10)] .. [0, 1, 2, 3, 4, 5, nil, nil, nil, nil]
[0 .. 5.align(3)] .. [0, 1, 2]
[0 .. 5.align(10, 0)] .. [0, 1, 2, 3, 4, 5, 0, 0, 0, 0]
[[0 .. 10].offset(2)] .. [2, 3, 4, 5, 6, 7, 8, 9, 10]
[[0 .. 10].skip(1)] .. [0, 2, 4, 6, 8]
[[0 .. 10].offset(2).skip(1)] .. [2, 4, 6, 8]
[[0 .. 5].align(10)] .. [0, 1, 2, 3, 4, 5, nil, nil, nil, nil]
[[0 .. 5].align(10, 0)] .. [0, 1, 2, 3, 4, 5, 0, 0, 0, 0]
[[1, 2, 3, nil, 4, 5, nil].each().skip_nil()] .. [1, 2, 3, 4, 5]
[[1, 2, 3, [4, 5, 6, [7, 8, 9], 10, 11], 12], 13, 14]
[<>(name => "hayasaka hiroko", email => "hayasaka_hiroko@example.com", age => 33), <>(name => "hannda takashi", email => "hannda_takashi@example.com", age => 75), <>(name => "honma masahiko", email => "honma_masahiko@example.com", age => 46), <>(name => "kawahata nana", email => "kawahata_nana@example.com", age => 47)]
[Person(name => "hayasaka hiroko", email => "hayasaka_hiroko@example.com", age => 33), Person(name => "hannda takashi", email => "hannda_takashi@example.com", age => 75), Person(name => "honma masahiko", email => "honma_masahiko@example.com", age => 46), Person(name => "kawahata nana", email => "kawahata_nana@example.com", age => 47)]
freshfruit .. ["  banana", "  loganberry ", "passion fruit  "]
string.strip(freshfruit) .. ["banana", "loganberry", "passion fruit"]
vec .. [2, 4, 6, 3, 1, 4, 2]
3 * vec .. [6, 12, 18, 9, 3, 12, 6]
3 * filter(& { $x > 3 }, vec):list .. [12, 18, 12]
3 * filter(& { $x < 2 }, vec):list .. [3]
zip(vec, vec * vec) .. [[2, 4], [4, 16], [6, 36], [3, 9], [1, 1], [4, 16], [2, 4]]
vec1 .. [2, 4, 6]
vec2 .. [4, 3, -9]
for (x in vec1):list { for (y in vec2):list { x * y } } .. [[8, 6, -18], [16, 12, -36], [24, 18, -54]]
vec1 * vec2 .. [8, 12, -54]
set([1, 2, 3], [4, 5, 2], [1, 2, 8]):or .. [1, 2, 3, 4, 5, 8]
set([1, 2, 3], [4, 5, 2], [1, 2, 8]):and .. [2]
set([1, 2, 3], [4, 5, 2], [1, 2, 8]):xor .. [1, 3, 4, 5, 8]
vec1 .. [8, 3, 3, 6, 3, 8, 0, 4, 8, 6]
vec2 .. [6, 3, 4, 5, 3, 1, 3, 3, 9, 9]
set(vec1, vec2):or .. [8, 3, 6, 0, 4, 5, 1, 9]
set(vec1, vec2):and .. [3, 6, 4]
set(vec1, vec2):xor .. [8, 0, 5, 1, 9]
basket .. ["apple", "orange", "apple", "pear", "orange", "banana"]
fruit .. ["apple", "orange", "pear", "banana"]
"orange" in fruit .. true
"crabgrass" in fruit .. false
a .. ["a", "b", "r", "c", "d"]
b .. ["a", "l", "c", "z", "m"]
set(a, b):or .. ["a", "b", "r", "c", "d", "l", "z", "m"]
set(a, b):and .. ["a", "c"]
set(a, b):xor .. ["b", "r", "d", "l", "z", "m"]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
[4, 5, 6]
[1, 2, 3]
0.14112 -0.989992 1.73205
==== Test of list operation (1) ====
t .. [0, 1, 2, 3]
math.sin(t, t, t) .. [[0, 0.841471, 0.909297, 0.14112], [0, 0.841471, 0.909297, 0.14112], [0, 0.841471, 0.909297, 0.14112]]
math.sin([t, [t, t], t]) .. [[0, 0.841471, 0.909297, 0.14112], [[0, 0.841471, 0.909297, 0.14112], [0, 0.841471, 0.909297, 0.14112]], [0, 0.841471, 0.909297, 0.14112]]
a .. ["aaa3", "bbbb4", "ccc5"]
b .. ["aaa3aaa3aaa3aaa3", "bbbb4bbbb4bbbb4bbbb4", "ccc5ccc5ccc5ccc5"]
x1 .. [1, 2, 3, 4, 5]
x2 .. [5, 4, 3, 2, 1]
x1 == x2 .. [false, false, true, false, false]
x1 != x2 .. [true, true, false, true, true]
x1 < x2 .. [true, true, false, false, false]
x1 > x2 .. [false, false, false, true, true]
x1 <= x2 .. [true, true, true, false, false]
x1 >= x2 .. [false, false, true, true, true]
1
2
3
2
4
6
3
6
9
-10 -5 1 10 1
-9 -4 2 9 4
-8 -3 3 8 9
-7 -2 4 7 16
-6 -1 5 6 25
-5 0 6 5 36
-4 1 7 4 49
-3 2 8 3 64
-2 3 9 2 81
-1 4 10 1 100
1,4,7
2,5,8
3,6,9
t = [8, 8, 1, 3, 8, 8, 4, 2, 3, 3]
sort(ascend)    [1, 2, 3, 3, 3, 4, 8, 8, 8, 8]
t.sort(ascend)  [1, 2, 3, 3, 3, 4, 8, 8, 8, 8]
sort(descend)   [8, 8, 8, 8, 4, 3, 3, 3, 2, 1]
t.sort(descend) [8, 8, 8, 8, 4, 3, 3, 3, 2, 1]
rank(ascend)    [6, 6, 0, 2, 6, 6, 5, 1, 2, 2]
t.rank(ascend)  [6, 6, 0, 2, 6, 6, 5, 1, 2, 2]
rank(descend)   [0, 0, 9, 5, 0, 0, 4, 8, 5, 5]
t.rank(descend) [0, 0, 9, 5, 0, 0, 4, 8, 5, 5]
--------
%{0 => 0, 1 => 0.0174524, 2 => 0.0348995, 3 => 0.052336, 4 => 0.0697565, 5 => 0.0871557, 6 => 0.104528, 7 => 0.121869, 8 => 0.139173, 9 => 0.156434, 10 => 0.173648, 11 => 0.190809, 12 => 0.207912, 13 => 0.224951, 14 => 0.241922, 15 => 0.258819, 16 => 0.275637, 17 => 0.292372, 18 => 0.309017, 19 => 0.325568, 20 => 0.34202, 21 => 0.358368, 22 => 0.374607, 23 => 0.390731, 24 => 0.406737, 25 => 0.422618, 26 => 0.438371, 27 => 0.45399, 28 => 0.469472, 29 => 0.48481, 30 => 0.5, 31 => 0.515038, 32 => 0.529919, 33 => 0.544639, 34 => 0.559193, 35 => 0.573576, 36 => 0.587785, 37 => 0.601815, 38 => 0.615661, 39 => 0.62932, 40 => 0.642788, 41 => 0.656059, 42 => 0.669131, 43 => 0.681998, 44 => 0.694658, 45 => 0.707107, 46 => 0.71934, 47 => 0.731354, 48 => 0.743145, 49 => 0.75471, 50 => 0.766044, 51 => 0.777146, 52 => 0.788011, 53 => 0.798636, 54 => 0.809017, 55 => 0.819152, 56 => 0.829038, 57 => 0.838671, 58 => 0.848048, 59 => 0.857167, 60 => 0.866025, 61 => 0.87462, 62 => 0.882948, 63 => 0.891007, 64 => 0.898794, 65 => 0.906308, 66 => 0.913545, 67 => 0.920505, 68 => 0.927184, 69 => 0.93358, 70 => 0.939693, 71 => 0.945519, 72 => 0.951057, 73 => 0.956305, 74 => 0.961262, 75 => 0.965926, 76 => 0.970296, 77 => 0.97437, 78 => 0.978148, 79 => 0.981627, 80 => 0.984808, 81 => 0.987688, 82 => 0.990268, 83 => 0.992546, 84 => 0.994522, 85 => 0.996195, 86 => 0.997564, 87 => 0.99863, 88 => 0.999391, 89 => 0.999848, 90 => 1}
%{0 => 0, 1 => 0.0174524, 2 => 0.0348995, 3 => 0.052336, 4 => 0.0697565, 5 => 0.0871557, 6 => 0.104528, 7 => 0.121869, 8 => 0.139173, 9 => 0.156434, 10 => 0.173648, 11 => 0.190809, 12 => 0.207912, 13 => 0.224951, 14 => 0.241922, 15 => 0.258819, 16 => 0.275637, 17 => 0.292372, 18 => 0.309017, 19 => 0.325568, 20 => 0.34202, 21 => 0.358368, 22 => 0.374607, 23 => 0.390731, 24 => 0.406737, 25 => 0.422618, 26 => 0.438371, 27 => 0.45399, 28 => 0.469472, 29 => 0.48481, 30 => 0.5, 31 => 0.515038, 32 => 0.529919, 33 => 0.544639, 34 => 0.559193, 35 => 0.573576, 36 => 0.587785, 37 => 0.601815, 38 => 0.615661, 39 => 0.62932, 40 => 0.642788, 41 => 0.656059, 42 => 0.669131, 43 => 0.681998, 44 => 0.694658, 45 => 0.707107, 46 => 0.71934, 47 => 0.731354, 48 => 0.743145, 49 => 0.75471, 50 => 0.766044, 51 => 0.777146, 52 => 0.788011, 53 => 0.798636, 54 => 0.809017, 55 => 0.819152, 56 => 0.829038, 57 => 0.838671, 58 => 0.848048, 59 => 0.857167, 60 => 0.866025, 61 => 0.87462, 62 => 0.882948, 63 => 0.891007, 64 => 0.898794, 65 => 0.906308, 66 => 0.913545, 67 => 0.920505, 68 => 0.927184, 69 => 0.93358, 70 => 0.939693, 71 => 0.945519, 72 => 0.951057, 73 => 0.956305, 74 => 0.961262, 75 => 0.965926, 76 => 0.970296, 77 => 0.97437, 78 => 0.978148, 79 => 0.981627, 80 => 0.984808, 81 => 0.987688, 82 => 0.990268, 83 => 0.992546, 84 => 0.994522, 85 => 0.996195, 86 => 0.997564, 87 => 0.99863, 88 => 0.999391, 89 => 0.999848, 90 => 1}
==== Test of list operation (2) ====
list .. [2, 9, 6, 0, 4, 9, 4, 5, 2, 5]
list_of_list .. [[7, 5, 5, 7, 8], [9, 5, 3, 5, 1], [8, 4, 6, 6, 7], [2, 0, 4, 7, 1], [6, 0, 4, 3, 6]]
list_of_list_of_list .. [[[4, 9, 6, 3, 5], [0, 9, 2, 1, 2], [9, 6, 5, 4, 2], [2, 6, 2, 4, 5], [8, 3, 7, 7, 7]], [[8, 8, 9, 9, 7], [9, 2, 9, 5, 7], [1, 4, 7, 4, 1], [8, 1, 3, 6, 1], [3, 7, 7, 4, 2]], [[0, 3, 7, 2, 6], [0, 8, 1, 9, 5], [3, 1, 6, 8, 9], [9, 5, 7, 9, 5], [6, 8, 1, 8, 4]]]
sort(list, `ascend):map .. [0, 2, 2, 4, 4, 5, 5, 6, 9, 9]
sort(list_of_list, `ascend):map .. [[5, 5, 7, 7, 8], [1, 3, 5, 5, 9], [4, 6, 6, 7, 8], [0, 1, 2, 4, 7], [0, 3, 4, 6, 6]]
sort(list_of_list_of_list, `ascend):map .. [[[3, 4, 5, 6, 9], [0, 1, 2, 2, 9], [2, 4, 5, 6, 9], [2, 2, 4, 5, 6], [3, 7, 7, 7, 8]], [[7, 8, 8, 9, 9], [2, 5, 7, 9, 9], [1, 1, 4, 4, 7], [1, 1, 3, 6, 8], [2, 3, 4, 7, 7]], [[0, 2, 3, 6, 7], [0, 1, 5, 8, 9], [1, 3, 6, 8, 9], [5, 5, 7, 9, 9], [1, 4, 6, 8, 8]]]
sort(list, `descend):map .. [9, 9, 6, 5, 5, 4, 4, 2, 2, 0]
sort(list_of_list, `descend):map .. [[8, 7, 7, 5, 5], [9, 5, 5, 3, 1], [8, 7, 6, 6, 4], [7, 4, 2, 1, 0], [6, 6, 4, 3, 0]]
sort(list_of_list_of_list, `descend):map .. [[[9, 6, 5, 4, 3], [9, 2, 2, 1, 0], [9, 6, 5, 4, 2], [6, 5, 4, 2, 2], [8, 7, 7, 7, 3]], [[9, 9, 8, 8, 7], [9, 9, 7, 5, 2], [7, 4, 4, 1, 1], [8, 6, 3, 1, 1], [7, 7, 4, 3, 2]], [[7, 6, 3, 2, 0], [9, 8, 5, 1, 0], [9, 8, 6, 3, 1], [9, 9, 7, 5, 5], [8, 8, 6, 4, 1]]]
len(list) .. 10
min(list) .. 0
max(list) .. 9
sum(list) .. 46
average(list) .. 4.6
sum(list * list) .. 288
average(list * list) .. 28.8
