(module main)

(fn empty_values () -> (vec string)
  (std.vec.string.empty))

(fn pair ((first string) (second string)) -> (vec string)
  (let values (vec string) (std.vec.string.empty))
  (let first_values (vec string) (std.vec.string.append values first))
  (std.vec.string.append first_values second))

(fn echo ((values (vec string))) -> (vec string)
  values)

(fn length ((values (vec string))) -> i32
  (std.vec.string.len values))

(fn at ((values (vec string)) (i i32)) -> string
  (std.vec.string.index values i))

(fn call_return_value () -> string
  (at (echo (pair "slovo" "tree")) 1))

(fn original_len_after_append () -> i32
  (let values (vec string) (std.vec.string.empty))
  (let appended (vec string) (std.vec.string.append values "branch"))
  (std.vec.string.len values))

(test "vec string empty length"
  (= (std.vec.string.len (empty_values)) 0))

(test "vec string append length"
  (= (length (pair "alpha" "beta")) 2))

(test "vec string index"
  (= (at (pair "slovo" "tree") 1) "tree"))

(test "vec string append is immutable"
  (= (original_len_after_append) 0))

(test "vec string equality"
  (= (pair "leaf" "root") (std.vec.string.append (std.vec.string.append (std.vec.string.empty) "leaf") "root")))

(fn main () -> i32
  (std.io.print_string (call_return_value))
  0)
