Open spencerdcarlson opened 3 years ago
Printing out the args returns this for the variable with the default value:
{:\\, [line: 170], [{:attrs, [line: 170], nil}, {:%{}, [line: 170], []}]}
and returns this compile error:
....ex:170: undefined function \\/2
Not something I am very familiar with, but I am wondering if this would work:
args_with_or_default =
Enum.reduce(args, [], fn
{:\\, _line, [{_var_name, _var_line, nil}, _default_value]} = ast_for_default, acc ->
new_ast_for_default =
ast_for_default
|> Tuple.delete_at(0)
|> Tuple.insert_at(0, :||)
acc ++ [new_ast_for_default]
arg, acc ->
acc ++ [arg]
end)
And then using args_with_or_default
as the args.
Definition
Usage