In the simplest terms I think this would be similar to your code above:
def while(fun) when is_function(fun) do
if (name = fun.() && exists?(name)), do: while(fun), else: name
end
# Call it as:
name = while(&generate_name/1)
In the simplest terms I think this would be similar to your code above:
def while(fun) when is_function(fun) do
if (name = fun.() && exists?(name)), do: while(fun), else: name
end
# Call it as:
name = while(&generate_name/1)