2 ms·
While if you play a bit with Elixir it will likely grow on you, there is nothing preventing you from writing it as something like element = :ets.lookup_element
by qaq 10y ago
While if you play a bit with Elixir it will likely grow on you, there is nothing preventing you from writing it as something like
element = :ets.lookup_element(buffer.ets, pull_index, 2)
pi = rem(pull_index + 1, buffer.max_size)
buffer = %Buffer.Ets{buffer | size: buffer.size - 1, pull_index: pi}
{:ok, {element, buffer}}