(module main)

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

(fn pair () -> (vec bool)
  (let values (vec bool) (std.vec.bool.empty))
  (let first (vec bool) (std.vec.bool.append values true))
  (std.vec.bool.append first false))

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

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

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

(fn call_return_value () -> bool
  (at (echo (pair)) 1))

(fn original_len_after_append () -> i32
  (let values (vec bool) (std.vec.bool.empty))
  (let appended (vec bool) (std.vec.bool.append values true))
  (std.vec.bool.len values))

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

(test "vec bool append length"
  (= (length (pair)) 2))

(test "vec bool index"
  (= (at (pair) 1) false))

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

(test "vec bool equality"
  (= (pair) (std.vec.bool.append (std.vec.bool.append (std.vec.bool.empty) true) false)))

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