// index-of-all.el — every byte offset of a substring.
// "abXcdXefX" / "X" -> [2, 5, 8]. Empty list when no matches.
fn run_test() -> String {
    let positions: [Int] = str_index_of_all("abXcdXefX", "X")
    let n: Int = native_list_len(positions)
    let out: String = ""
    let i: Int = 0
    while i < n {
        let p: Int = native_list_get(positions, i)
        if i > 0 {
            let out = out + ","
        }
        let out = out + int_to_str(p)
        let i = i + 1
    }
    return out
}

fn main() -> Void {
    println(run_test())
}
