[FREE] ListNinja Extension from Still_Learning

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]]

  1. 1D Lists: Simple flat lists (e.g., [1, 2, 3]).
  2. 2D Lists: Lists of lists (e.g., [[1,2], [3,4]]).
  3. YAIL Handling: All examples assume inputs are YailList objects.
  4. 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

Blocks

image

image

image

Extension

Version 7 [Updated on 21-06-2025 @12:49am]

ListNinja_StillLearning.aix (37.5 KB)

Previous Versions are removed due to d8 eror and app crashes upon opening.
(Bug free)

Added this Dispatcher

3 Likes
  1. n-gram generation
    Example:
    Input: [1, 2, 3, 4], windowSize=2 Output: [[1, 2], [2, 3], [3, 4]]

  2. Track changes in dynamically updated lists (e.g., sensor data).
    Example:
    Input: oldList=[1, 2, 3], newList=[1, 4, 3]
    Output: {added: [4], removed: [2], unchanged: [1, 3]}

  3. GroupBy(listOfDicts, key)
    Example:
    Input: [{"name":"Alice","dept":"HR"}, {"name":"Bob","dept":"IT"}], key="dept"
    Output: {"HR": [{"name":"Alice"}], "IT": [{"name":"Bob"}]}

  4. GetPermutations(list, size)
    Useful for password cracking simulations or game mechanics.
    Example:
    Input: [1, 2, 3], size=2
    Output: [[1,2], [1,3], [2,1], [2,3], [3,1], [3,2]]

  5. RunningStats(list)
    Real-time analytics (e.g., live sensor readings).
    Example:
    Input: [10, 20, 30]
    Output: [
    {index:1, sum:10, avg:10, min:10, max:10},
    {index:2, sum:30, avg:15, min:10, max:20},
    {index:3, sum:60, avg:20, min:10, max:30}
    ]

  6. GenerateMarkovChain(list, order)
    AI text/code generation for educational apps.
    Example:
    Input: ["A", "B", "A", "C"], order=1
    Output: {"A": ["B", "C"], "B": ["A"], "C":

Shall i add these features in the upcoming version?

MIT Team, Still more how many extensions i need to post to get an extension developer badge?

There is no such thing on this community
Taifun

1 Like

🧩 ListNinja

An extension for MIT App Inventor 2.
ListNinja: Powerful List Utilities Extension by Jaisankar - Supports Yail & JSON lists

:memo: Specifications


:package: Package: io.jsr.listninja.listninja
:floppy_disk: Size: 37.49 KB
:iphone: Minimum API Level: 7
:date: Updated On: 2025-06-20T18:30:00Z
:computer: Built & documented using: FAST v3.7.0

Special thanks to @JEWEL for his wonderful platform FAST CLi

Version 7 with almost 50 functions is updated using FAST CLi Extension builder

The ListNinja extension provides advanced list manipulation for App Inventor, supporting 1D, 2D, and 3D lists.

The following functions have been updated to include a dropdown for conditions using the Condition enum, which implements OptionList<String>. This creates a user-friendly dropdown menu in App Inventor for selecting conditions like equals, not_equals, etc., ensuring valid inputs. Examples use a sample list: [["Fighting, Anime", "1"], ["Action, Adventure", "10"], ["Racing", "2"], ["Action, Flight", "116"]].

Condition Enum (OptionList)

Summary

image

Credit to @Taifun for his solution

The Condition enum provides a dropdown for the condition parameter in FilterByCondition, PartitionList, and ReplaceByCondition. It includes:

  • equals, not_equals, greater, less, greater_or_equal, less_or_equal
  • contains, starts_with, ends_with
  • is_empty, not_empty
  • contains_element, length_equals, length_greater, length_less

Benefit: The dropdown prevents invalid condition inputs, making blocks easier to configure. For example, selecting equals ensures numeric comparisons for DATA (index 2) like "10" are treated as numbers (10).

FilterByCondition

image

Filters a list based on a condition applied to elements or a specified index in sublists. Supports 1D, 2D, and 3D lists.

Parameters

  • list (YailList): Input list (e.g., [["Fighting, Anime", "1"], ["Racing", "2"]]) or 1D list (e.g., ["1", "2"]).
  • index (int): 1-based index to check in sublists (e.g., 2 for DATA). Use 0 for 1D lists or conditions like length_equals.
  • condition (String): Selected from a dropdown (via OptionList):
    • Numeric: equals, not_equals, greater, less, greater_or_equal, less_or_equal
    • String: contains, starts_with, ends_with, is_empty, not_empty
    • List: contains_element, length_equals, length_greater, length_less
  • value (Object): Value to compare (e.g., "10" or 10).
  • caseSensitive (boolean): True for case-sensitive string comparisons, false otherwise.

Returns

  • YailList: Filtered list of matching elements or sublists.

Example

Goal: Filter sublists where DATA (index 2) equals "10".

  • Input List: [["Fighting, Anime", "1"], ["Action, Adventure", "10"], ["Racing", "2"], ["Action, Flight", "116"]]
  • Blocks:
    • Use ListNinja.FilterByCondition.
    • Set list to the input list.
    • Set index to 2.
    • Select condition as equals from the dropdown.
    • Set value to "10".
    • Set caseSensitive to false.
  • Output: [["Action, Adventure", "10"]]

Notes:

  • Numeric strings (e.g., "10") are compared numerically for equals, greater, etc.
  • Use index = 0 for length_equals, contains_element.

PartitionList

image

Partitions a list into two lists: one matching a condition and one not matching. Returns [matching, non-matching].

Parameters

  • list (YailList): Input list (e.g., [["Fighting, Anime", "1"], ["Racing", "2"]]).
  • index (int): 1-based index to check (e.g., 1 for Genre). Use 0 for 1D lists or list-based conditions.
  • condition (String): Selected from the Condition dropdown (see above).
  • value (Object): Value to compare (e.g., "Action").
  • caseSensitive (boolean): True for case-sensitive string comparisons.

Returns

  • YailList: List containing two sublists: [matching, non-matching].

Example

Goal: Partition sublists where Genre (index 1) contains "Action".

  • Input List: [["Fighting, Anime", "1"], ["Action, Adventure", "10"], ["Racing", "2"], ["Action, Flight", "116"]]
  • Blocks:
    • Use ListNinja.PartitionList.
    • Set list to the input list.
    • Set index to 1.
    • Select condition as contains from the dropdown.
    • Set value to "Action".
    • Set caseSensitive to false.
  • Output: [[["Action, Adventure", "10"], ["Action, Flight", "116"]], [["Fighting, Anime", "1"], ["Racing", "2"]]]

Notes:

  • The dropdown ensures valid conditions.
  • Numeric comparisons apply for DATA (index 2) when using equals, greater, etc.

ReplaceByCondition

image

Replaces elements or sublists matching a condition with a new value.

Parameters

  • list (YailList): Input list (e.g., [["Fighting, Anime", "1"], ["Racing", "2"]]).
  • index (int): 1-based index to check (e.g., 2 for DATA). Use 0 for 1D lists or list-based conditions.
  • condition (String): Selected from the Condition dropdown (see above).
  • value (Object): Value to compare (e.g., "1").
  • replacement (Object): Replacement value (e.g., "100").
  • caseSensitive (boolean): True for case-sensitive string comparisons.

Returns

  • YailList: List with matching elements or sublists replaced.

Example

Goal: Replace DATA (index 2) values equaling "1" with "100".

  • Input List: [["Fighting, Anime", "1"], ["Action, Adventure", "10"], ["Racing", "2"]]
  • Blocks:
    • Use ListNinja.ReplaceByCondition.
    • Set list to the input list.
    • Set index to 2.
    • Select condition as equals from the dropdown.
    • Set value to "1".
    • Set replacement to "100".
    • Set caseSensitive to false.
  • Output: [["Fighting, Anime", "100"], ["Action, Adventure", "10"], ["Racing", "2"]]

Notes:

  • Numeric strings are compared numerically for equals.
  • For list-based conditions, the entire sublist is replaced.

SortByMultipleIndices

Sorts a list of lists by multiple indices in order.
image

Parameters

  • listOfLists (YailList): List of sublists (e.g., [["Fighting, Anime", "1"], ["Racing", "2"]]).
  • indices (YailList): 1-based indices to sort by (e.g., [2] for DATA).
  • ascending (boolean): True for ascending, false for descending.

Returns

  • YailList: Sorted list of sublists.

Example

Goal: Sort by DATA (index 2) in ascending order.

  • Input List: [["Action, Flight", "116"], ["Fighting, Anime", "1"], ["Action, Adventure", "10"]]
  • Blocks:
    • Use ListNinja.SortByMultipleIndices.
    • Set listOfLists to the input list.
    • Set indices to [2].
    • Set ascending to true.
  • Output: [["Fighting, Anime", "1"], ["Action, Adventure", "10"], ["Action, Flight", "116"]]

Notes:

  • Numeric strings (e.g., "116") are sorted numerically.
  • Multiple indices sort sequentially (e.g., [2, 1] sorts by DATA, then Genre).

AggregateByIndex

image

Aggregates numeric values at a specified index, optionally grouped by another index. Operations: sum, average, min, max, count.

Parameters

  • listOfLists (YailList): List of sublists (e.g., [["Fighting, Anime", "1"], ["Racing", "2"]]).
  • valueIndex (int): 1-based index of numeric values (e.g., 2 for DATA).
  • operation (String): Aggregation type (sum, average, min, max, count).
  • groupByIndex (int): 1-based index to group by (e.g., 1 for Genre). Use 0 for no grouping.

Returns

  • YailList: List of [groupKey, result] pairs.

Example

Goal: Sum DATA (index 2) grouped by Genre (index 1).

  • Input List: [["Action, Anime", "1"], ["Action, Adventure", "10"], ["Action, Anime", "2"]]
  • Blocks:
    • Use ListNinja.AggregateByIndex.
    • Set listOfLists to the input list.
    • Set valueIndex to 2.
    • Set operation to "sum".
    • Set groupByIndex to 1.
  • Output: [["Action, Anime", 3.0], ["Action, Adventure", 10.0]]

Notes:

  • Non-numeric values at valueIndex trigger an error.
  • Use groupByIndex = 0 for a single aggregate result.

(Extension updated in the first post)

1 Like