let array t cond = function
  | Empty -> Empty
  | region -> matrix [t] (fun ts -> cond (List.hd ts)) region