Dear team, this is my another extension which works with lists though i found listutil extension and this will help you in many ways. Documentation is attached the with along with examples. So kindly go through with all the functions example and how it is working.
No libraries are added
No permission will request
No internet required
Summary
I like the DeepSearch function the most - It will search the specific item in all sort of list with any kind of index. Give Heart to this function. It takes me a lot of time to work on this
1. Basic Operations
Function | 1D List Input | 2D List Input | Result (1D) | Result (2D) |
---|---|---|---|---|
RemoveDuplicates | [1, 2, 2, 3] |
[[1,2], [3,4], [1,2]] |
[1, 2, 3] |
[[1,2], [3,4]] |
SortAscending | ["Banana", "Apple"] |
[[3, "C"], [1, "A"]] |
["Apple", "Banana"] |
[[1, "A"], [3, "C"]] |
SortDescending | [5, 1, 3] |
[["Bob", 25], ["Alice", 30]] |
[5, 3, 1] |
[["Bob", 25], ["Alice", 30]] |
CountOccurrences | ["A", "B", "A"] |
[[1,2], [1,2], [3,4]] (count [1,2] ) |
2 (for "A") |
2 (for [1,2] ) |
2. List Manipulation
Function | 1D List Input | 2D List Input | Result (1D) | Result (2D) |
---|---|---|---|---|
Flatten | [1, [2, 3]] |
[[1,2], [3,[4,5]]] |
[1, 2, 3] |
[1, 2, 3, 4, 5] |
ReverseList | [1, 2, 3] |
[["A", "B"], ["C", "D"]] |
[3, 2, 1] |
[["C", "D"], ["A", "B"]] |
SwapElements | ["A", "B", "C"] (pos1=1, pos2=3) |
[[1,2], [3,4]] (swap rows) |
["C", "B", "A"] |
[[3,4], [1,2]] |
ChunkList | [1, 2, 3, 4] (size=2) |
[[1,2], [3,4], [5,6]] (size=1) |
[[1,2], [3,4]] |
[ [[1,2]], [[3,4]], [[5,6]] ] |
3. Search & Filter
Function | 1D List Input | 2D List Input | Result (1D) | Result (2D) |
---|---|---|---|---|
FindAllOccurrences | ["A", "B", "A"] (target="A") |
[[1,2], [1,2], [3,4]] (target=[1,2] ) |
[1, 3] (positions) |
[1, 2] (positions) |
DeepSearch | [1, [2, 3], 2] (target=2) |
[[1,2], [3,[4,2]]] (target=2) |
[ [2,3], 2 ] |
[ [1,2], [4,2] ] |
FilterListOfListsByIndex | N/A | [["Apple", "Red"], ["Banana", "Yellow"]] (index=2, match="Red") |
N/A | [ ["Apple", "Red"] ] |
4. List Analysis
Function | 1D List Input | 2D List Input | Result (1D) | Result (2D) |
---|---|---|---|---|
FindMinMax | [5, 1, 3] |
[[10, 20], [5, 30]] (numeric cols) |
[1, 5] (min, max) |
[5, 30] (min, max across all) |
FrequencyTable | ["A", "B", "A"] |
[[1,2], [1,2], [3,4]] |
[ ["A",2], ["B",1] ] |
[ [[1,2], 2], [[3,4], 1] ] |
AreListsEqual | [1, 2] vs [1, 2] |
[[1,2]] vs [[1,2]] |
true |
true |
5. JSON/CSV Conversion
Function | 1D List Input | 2D List Input | Result (1D) | Result (2D) |
---|---|---|---|---|
ListToJson | ["A", 1, true] |
[[1, "A"], [2, "B"]] |
["A", 1, true] (JSON) |
[[1,"A"], [2,"B"]] (JSON) |
ListToCsv | ["A", "B"] |
[[1, "A"], [2, "B"]] |
"A","B" (CSV) |
"1","A"\n"2","B" (CSV) |
6. List statistics( Calculate statistics (sum/avg/min/max) for numeric lists)
Example (1D):
Input: [10, 20, 30]
→ Output: [60, 20, 10, 30, 3]
Example (2D):
Input: [[5, "X"], [10, 15]]
→ Output: [30, 10, 5, 15, 3]
(ignores non-numbers)
7. Transpose
Transpose (Only from 2D list, Not tested with 3D list and above)
Example (2D):
Input: [[A, B], [C, D], [E, F]]
→ Output: [[A, C, E], [B, D, F]]
Key Notes for Documentation:
8. Rotate list (positive value for right side, negative value for left side)
Example (1D):
Input: [1, 2, 3, 4]
, positions=1
→ Output: [4, 1, 2, 3]
Example (2D):
Input: [[A,B], [C,D], [E,F]]
, positions=-1
→ Output: [[C,D], [E,F], [A,B]]
- 1D Lists: Simple flat lists (e.g.,
[1, 2, 3]
). - 2D Lists: Lists of lists (e.g.,
[[1,2], [3,4]]
). - YAIL Handling: All examples assume inputs are
YailList
objects. - Error Cases: Functions like
FindMinMax
ignore non-numeric values.
I hope i have made clear cut examples to each function also the output to the best of my knowledge. Make use of this extension and convey your valuable feedback if it finds any error or compilation error.
Thanks a lot
Regards,
Still Learning
Extension
Version1: ListNinja.aix (21.4 KB)
Blocks