funclist_check_place
func list_check_place(at: int, count: int, word: string)
list: finding, putting in and taking out items of int and string arrays. use "list.jamo"
Sorting ints and strings, and turning arrays around, are in text.jamo: sort_ints, sort_strings, reverse_ints and reverse_strings. The _int and _string versions came first. The ones at the end work on every kind of array, using generics, and sort_by, sort_by_float and sort_by_text sort any array by a key you give each item. sort_with, filtered and mapped take a function of your own.
func list_check_place(at: int, count: int, word: string)
func index_of_int(items: [int], value: int): int
Where value first is in items, counting from 0, or -1 when it isn't there
func index_of_string(items: [string], value: string): int
func contains_int(items: [int], value: int): bool
func contains_string(items: [string], value: string): bool
func insert_int(items: [int], at: int, value: int)
Puts value at place at, moving the items from there on along by one. at can be len(items), to add at the end
func insert_string(items: [string], at: int, value: string)
func remove_int(items: [int], at: int): int
Takes out the item at place at, moving the ones after it back by one, and gives it back
func remove_string(items: [string], at: int): string
func has_item<T>(items: [T], value: T): bool
func find_item<T>(items: [T], value: T): int
Where the first one equal to value is, or -1
func count_item<T>(items: [T], value: T): int
func reversed<T>(items: [T]): [T]
A new array with the items the other way round. The array itself stays as it was
func swap_items<T>(items: [T], a: int, b: int)
func last_item<T>(items: [T]): T
func sort_floats(items: [float])
Sorts floats from smallest to largest. nan goes wherever it lands
func sort_by<T>(items: [T], keys: [int])
Sorts items by int keys, smallest first
func sort_by_float<T>(items: [T], keys: [float])
Sorts items by float keys, smallest first
func sort_by_text<T>(items: [T], keys: [string])
Sorts items by text keys, in the same order as sort_strings ("Zoo" before "apple")
func list_check_keys(items: int, keys: int, word: string)
func list_order_of<K>(keys: [K]): [int]
The places of keys from smallest to largest, by merging runs that double in size. Equal keys keep their order. K must work with <=, so ints and floats
func list_text_order_of(keys: [string]): [int]
The same, for text keys
func sort_with<T>(items: [T], before: func(T, T): bool)
Sorts items so that before(a, b) is true when a should come before b. Items it calls equal, where neither comes before the other, keep their order. before must give the same answer each time for the same two items
func by_score(a: Player, b: Player): bool
return a.score > b.score
end
sort_with(players, by_score) # highest score first
func filtered<T>(items: [T], keep: func(T): bool): [T]
A new array with the items where keep(item) is true, in order
func mapped<T, U>(items: [T], change: func(T): U): [U]
A new array with change(item) for each item, in order
func list_put_in_order<T>(items: [T], order: [int])
Moves items so items[i] becomes what was at items[order[i]]