So for this cycle of Erlang coding, I did a combination of coding and reading.
Code-wise, one of the most pertinent things I tried was extracting constants. My initial pass at this was to create a module with functions that returned the constants, but, as I thought, it lead me to an illegal guard expression compile error:
roll(on_frame, #frame{first_roll=First, second_roll=Second}, that_knocked_down, Pins_Knocked_Down) when (First =:= constants:all_pins_down()) and (Second =:= undefined) ->
{frame, #frame{first_roll = Pins_Knocked_Down, value = Pins_Knocked_Down}};
I quickly wised up and, through a combination of the Armstrong book and a Google search, I found that macros are the standard way to achieve constants in this language. Thusly:
Read more »