It’s more common to use a map than a tuple for state…
Then it is easier to make pattern match…
%{chord: chord, tref: tref}
#
# You can pattern match nil tref with...
%{tref: nil}
# instead of
{_, nil}
# and potentially, it's harder to remember where tref is.
{_, _, _, nil, _, _}
It’s also possible to do it with tuples, but it will be easier to pass from map to struct, than from tuple to struct. Unless You need to interface some Erlang record type, the Elixir way is to use a map.
The idea is to write a functional core, separate from any server logic.
BTW You can also replace 60000 with 60_000, it might be more readable.






















