not_found} 16 def read([{key, value} | _], key), do: {:ok, value} 17 def read([_ | db], key), do: read(key, db) 18 19 def match(db, value), do: do_match(db, value, []) 20 21 defp do_match([], _, acc), do: acc 22 defp do_match([{key, value} | db], value, acc), do: do_match(db, value, [key|acc]) 23 defp do_match([_ | db], value, acc), do : do_match(db, value, acc) 24 25 def destroy(_), do: :ok 26 27 end 22 read([], _Key) -> 23 {error, not_found}; 24 read([{Key, Value} | _Db], Key) -> 25 {ok, Value}; 26 read([_ | Db], Key) -> 27 read(Db, Key). 28 29 match(Db, Value) -> 30 do_match(Db, Value, []). 31 32 do_match([], _Value, Acc) -> 33 Acc; 34 do_match([{Key, Value} | Db], Value, Acc) -> 35 do_match(Db, Value, [Key | Acc]); 36 do_match([_ | Db], Value, Acc) -> 37 do_match(Db, Value, Acc). 38 39 destroy(_Db) -> 40 ok. 16