anchor.diff:  prepend(Items, Value) when ?AVRO_IS_ARRAY_VALUE(Value) ->
     new(?AVRO_VALUE_TYPE(Value), Items ++ ?AVRO_VALUE_DATA(Value)).
   
  -append(Items, Value) when ?AVRO_IS_ARRAY_VALUE(Value) ->
  -  new(?AVRO_VALUE_TYPE(Value), ?AVRO_VALUE_DATA(Value) ++ Items).
  -
  -
   %% Only other Avro array type or erlang list can be casted to arrays
   -spec cast(avro_type(), term()) -> {ok, avro_value()} | false.
   
  
positive.code:   do_cast(Type, ?AVRO_VALUE_DATA(Array));
  do_cast(Type, Items) when is_list(Items) ->
    #avro_array_type{type = ItemType} = Type,
    CastedItems =
      lists:foldl(
        fun(_Item, false) -> false;
           (Item, Acc)    -> cast_item(ItemType, Item, Acc)
        end,
        [],
        Items),
    if CastedItems =:= false -> false;
       true -> {ok, ?AVRO_VALUE(Type, lists:reverse(CastedItems))}
    end.
  
  cast_item(TargetType, Item, Acc) ->
    case avro:cast(TargetType, Item) of
      {ok, CastedItem} -> [CastedItem|Acc];
      false            -> false
    end.
  
  %%%===================================================================
  
negative.code: 
  cast_test() ->
    ArrayType = type(avro_primitive:string_type()),
    {ok, Array} = cast(ArrayType, ["a", "b"]),
    ?assertEqual(ArrayType, ?AVRO_VALUE_TYPE(Array)),
    ?assertEqual([avro_primitive:string("a"), avro_primitive:string("b")],
                ?AVRO_VALUE_DATA(Array)).
  
  -endif.
  
  