Functionsยง
- append_
vec - arr_
empty - arr_eq
- arr_
nonempty - contains
- contains(genericArrayIn, genericValue) โ specialized to strings & ints for now.
For a more dynamic approach weโd pass
Vec<Value>and a Value. We implement a generic helper where T:PartialEq. - count
- count(array)
- first
- first(array)
- index_
of - js_
compat_ array_ slice - last
- last(array)
- normalize_
bounds ๐ - one_
bool - Convert a single primitive into a one-element array (abFromB / anFromN / asFromS).
- one_i32
- one_
string - pop
- JS pop(array) -> subset(array, 0, -2) meaning drop last element. We replicate safe behavior (no negative wrap).
- print_
arr - Wrapper kept for compatibility:
print_arr->str_print_arr - print_
array - Wrapper kept for compatibility:
print_array->str_print_arr - set_
element - setElement(array, index, value) โ panics if out of range except allowing index == len (append) in the original? JS code forbade index > length. If index == len we append.
- shift
- shift(array) -> subset(array, 1, -1) => drop first element
- slice_
inclusive_ bool - slice_
inclusive_ i32 - slice_
inclusive_ string - str_
print_ arr - str_
print_ array - Wrapper kept for compatibility:
str_print_array->str_print_arr - subset
- Close translation of StageL anSubset.
- sum_
array