It was my reading of those examples from the docs to interpret the ^ as something like a “type/value checked deference”.
Forging ahead, ignoring what I was told about the scope of out, I’ve restructured my code in a recursive manner.
def iteraterefs(number, refs, table, out, i) when number > 0 do
reducenumber(elem(refs, i), number, elem(table, i), out)
iteraterefs(number, refs, table, out, i + 1)
end
def reducenumber(divisor, number, symbol, out) when number >= divisor do
number = number - divisor
out = out <> symbol
end
The compiler parses iteraterefs and produces:
** (ArgumentError) errors were found at the given arguments:
* 2nd argument: not a tuple
Is this an interaction with the elem(refs, i) call? Here is the refs I constructed by hand:
refs = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]


















