I have the requirement
add_items(AuctionId, [{Item, Desc, Bid}]) -> {ok, [{ItemId, Item]} | {error, unknown_auction}.
How do I use the list of tuples to write my function body?
What I've tried:
add_items(AuctionId, ItemList) -> ...
This works fine, but I haven't matched the requirement - but the requirement returns a function_clause error if I define it that way as it cannot be pattern-matched (and I don't think the question wants me to define the specification this way either as I would write something like
-spec add_items(reference(), [item_info()]) ->
{ok, [{itemid(), nonempty_string()}]} | {error, unknown_auction()}.
It also does not match say trying to do a recursion definition with a head and a tail ala [] and [H|T]